File size: 16,918 Bytes
40e70fd 1150eed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Engineer's Day Quiz Challenge</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<style>
.gradient-bg {
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}
.option:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
</style>
</head>
<body class="min-h-screen bg-gray-100">
<!-- Hero Section -->
<div id="hero" class="gradient-bg text-white py-20 px-4">
<div class="max-w-6xl mx-auto text-center">
<h1 class="text-4xl md:text-6xl font-bold mb-6" data-aos="fade-down">Engineer's Day Quiz Challenge</h1>
<p class="text-xl md:text-2xl mb-8" data-aos="fade-up" data-aos-delay="100">Test your knowledge about why we celebrate Engineer's Day!</p>
<button id="startQuizBtn" class="bg-white text-blue-600 font-bold py-3 px-8 rounded-full text-lg hover:bg-gray-100 transition-all pulse" data-aos="zoom-in" data-aos-delay="200">
Start Quiz Now
</button>
</div>
</div>
<!-- Registration Form (Hidden Initially) -->
<div id="registrationForm" class="hidden max-w-md mx-auto my-16 bg-white rounded-xl shadow-md overflow-hidden p-8" data-aos="fade-up">
<div class="text-center mb-8">
<h2 class="text-2xl font-bold text-gray-800">Student Registration</h2>
<p class="text-gray-600">Register to participate in the quiz</p>
</div>
<form id="registerForm">
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="name">
Full Name
</label>
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="name" type="text" placeholder="Your name" required>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="email">
Email
</label>
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="email" type="email" placeholder="your@email.com" required>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="college">
College/University
</label>
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="college" type="text" placeholder="Institution name" required>
</div>
<div class="mb-6">
<label class="block text-gray-700 text-sm font-bold mb-2" for="department">
Engineering Department
</label>
<select class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="department" required>
<option value="">Select your department</option>
<option value="Computer">Computer Engineering</option>
<option value="Mechanical">Mechanical Engineering</option>
<option value="Electrical">Electrical Engineering</option>
<option value="Civil">Civil Engineering</option>
<option value="Electronics">Electronics Engineering</option>
<option value="Other">Other</option>
</select>
</div>
<div class="flex items-center justify-between">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full" type="submit">
Register & Start Quiz
</button>
</div>
</form>
</div>
<!-- Quiz Container (Hidden Initially) -->
<div id="quizContainer" class="hidden max-w-3xl mx-auto my-16 bg-white rounded-xl shadow-md overflow-hidden p-8">
<div class="flex justify-between items-center mb-8">
<div class="text-lg font-semibold text-gray-700">Question <span id="currentQuestion">1</span>/10</div>
<div class="text-lg font-semibold text-gray-700">Score: <span id="score">0</span></div>
</div>
<div id="question" class="text-xl font-bold mb-8 text-gray-800"></div>
<div id="options" class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-8">
<!-- Options will be inserted here by JavaScript -->
</div>
<div class="flex justify-between">
<button id="prevBtn" class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded hidden">
Previous
</button>
<button id="nextBtn" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Next
</button>
</div>
</div>
<!-- Results Container (Hidden Initially) -->
<div id="resultsContainer" class="hidden max-w-md mx-auto my-16 bg-white rounded-xl shadow-md overflow-hidden p-8 text-center">
<div class="mb-8">
<i data-feather="award" class="w-16 h-16 text-yellow-500 mx-auto mb-4"></i>
<h2 class="text-2xl font-bold text-gray-800 mb-2">Quiz Completed!</h2>
<p class="text-gray-600 mb-4">Congratulations on completing the Engineer's Day Quiz</p>
<div class="text-4xl font-bold text-blue-600 mb-6">Your Score: <span id="finalScore">0</span>/10</div>
<div id="certificateBtn" class="bg-green-500 hover:bg-green-600 text-white font-bold py-3 px-6 rounded-full inline-block cursor-pointer">
Download Your Certificate
</div>
</div>
<div class="border-t pt-6">
<h3 class="text-xl font-semibold text-gray-800 mb-4">Why We Celebrate Engineer's Day</h3>
<p class="text-gray-600 mb-4 text-left">
Engineer's Day is celebrated on September 15th in India to commemorate the birth anniversary of the legendary engineer Sir M. Visvesvaraya, who made outstanding contributions to engineering and nation-building.
</p>
<p class="text-gray-600 text-left">
This day recognizes the achievements of engineers and their role in technological advancement and societal development.
</p>
</div>
</div>
<script>
// Initialize AOS and Feather Icons
document.addEventListener('DOMContentLoaded', function() {
AOS.init({
duration: 800,
easing: 'ease-in-out',
once: true
});
feather.replace();
// Quiz questions
const questions = [
{
question: "On which date is Engineer's Day celebrated in India?",
options: ["September 15", "October 5", "November 20", "December 25"],
answer: 0
},
{
question: "Engineer's Day in India commemorates the birth anniversary of which famous engineer?",
options: ["A.P.J. Abdul Kalam", "C.V. Raman", "M. Visvesvaraya", "Homi Bhabha"],
answer: 2
},
{
question: "In which year was Sir M. Visvesvaraya awarded the Bharat Ratna?",
options: ["1945", "1955", "1965", "1975"],
answer: 1
},
{
question: "Which of these engineering marvels is Sir M. Visvesvaraya known for?",
options: ["Taj Mahal", "Krishna Raja Sagara Dam", "Qutub Minar", "Gateway of India"],
answer: 1
},
{
question: "What was Sir M. Visvesvaraya's profession before becoming an engineer?",
options: ["Doctor", "Teacher", "Farmer", "He was always an engineer"],
answer: 1
},
{
question: "Which country celebrates Engineer's Day on the same date as India?",
options: ["Sri Lanka", "Singapore", "Germany", "None of these"],
answer: 0
},
{
question: "What was Sir M. Visvesvaraya's contribution to flood protection?",
options: ["Invented the first dam", "Developed automatic sluice gates", "Created flood warning systems", "All of the above"],
answer: 1
},
{
question: "Which engineering college did Sir M. Visvesvaraya help establish?",
options: ["IIT Bombay", "College of Engineering, Pune", "University Visvesvaraya College of Engineering", "BITS Pilani"],
answer: 2
},
{
question: "What was Sir M. Visvesvaraya's role in Mysore state?",
options: ["King", "Chief Engineer", "Diwan (Prime Minister)", "Court Jester"],
answer: 2
},
{
question: "What is the theme of Engineer's Day 2023?",
options: ["Engineering for Sustainable Development", "Engineering Innovations for a Better World", "Engineering Solutions for Climate Change", "The official theme hasn't been announced yet"],
answer: 3
}
];
// Quiz variables
let currentQuestionIndex = 0;
let score = 0;
let userAnswers = [];
let userData = {};
// DOM elements
const startQuizBtn = document.getElementById('startQuizBtn');
const registrationForm = document.getElementById('registrationForm');
const registerForm = document.getElementById('registerForm');
const quizContainer = document.getElementById('quizContainer');
const resultsContainer = document.getElementById('resultsContainer');
const questionElement = document.getElementById('question');
const optionsElement = document.getElementById('options');
const currentQuestionElement = document.getElementById('currentQuestion');
const scoreElement = document.getElementById('score');
const finalScoreElement = document.getElementById('finalScore');
const prevBtn = document.getElementById('prevBtn');
const nextBtn = document.getElementById('nextBtn');
const certificateBtn = document.getElementById('certificateBtn');
// Event listeners
startQuizBtn.addEventListener('click', showRegistrationForm);
registerForm.addEventListener('submit', startQuiz);
nextBtn.addEventListener('click', nextQuestion);
prevBtn.addEventListener('click', prevQuestion);
certificateBtn.addEventListener('click', generateCertificate);
// Show registration form
function showRegistrationForm() {
document.getElementById('hero').classList.add('hidden');
registrationForm.classList.remove('hidden');
}
// Start quiz after registration
function startQuiz(e) {
e.preventDefault();
// Save user data
userData = {
name: document.getElementById('name').value,
email: document.getElementById('email').value,
college: document.getElementById('college').value,
department: document.getElementById('department').value
};
registrationForm.classList.add('hidden');
quizContainer.classList.remove('hidden');
loadQuestion();
}
// Load current question
function loadQuestion() {
const question = questions[currentQuestionIndex];
questionElement.textContent = question.question;
currentQuestionElement.textContent = currentQuestionIndex + 1;
scoreElement.textContent = score;
// Clear previous options
optionsElement.innerHTML = '';
// Add new options
question.options.forEach((option, index) => {
const optionElement = document.createElement('div');
optionElement.className = 'option bg-white border border-gray-200 rounded-lg p-4 cursor-pointer transition-all hover:border-blue-500';
optionElement.innerHTML = `
<div class="flex items-center">
<div class="w-6 h-6 rounded-full border border-gray-300 mr-3 flex items-center justify-center">${String.fromCharCode(65 + index)}</div>
<div>${option}</div>
</div>
`;
// Check if user has already answered this question
if (userAnswers[currentQuestionIndex] !== undefined) {
if (userAnswers[currentQuestionIndex] === index) {
optionElement.classList.add('bg-blue-50', 'border-blue-500');
}
optionElement.classList.add('pointer-events-none');
}
optionElement.addEventListener('click', () => selectAnswer(index));
optionsElement.appendChild(optionElement);
});
// Update navigation buttons
prevBtn.classList.toggle('hidden', currentQuestionIndex === 0);
nextBtn.textContent = currentQuestionIndex === questions.length - 1 ? 'Finish' : 'Next';
}
// Select answer
function selectAnswer(index) {
// If already answered, do nothing
if (userAnswers[currentQuestionIndex] !== undefined) return;
// Mark answer
userAnswers[currentQuestionIndex] = index;
// Highlight selected option
const options = optionsElement.querySelectorAll('.option');
options.forEach(option => option.classList.remove('bg-blue-50', 'border-blue-500'));
options[index].classList.add('bg-blue-50', 'border-blue-500');
// Check if correct
if (index === questions[currentQuestionIndex].answer) {
score++;
scoreElement.textContent = score;
}
}
// Next question
function nextQuestion() {
// If last question, show results
if (currentQuestionIndex === questions.length - 1) {
showResults();
return;
}
// Move to next question
currentQuestionIndex++;
loadQuestion();
}
// Previous question
function prevQuestion() {
currentQuestionIndex--;
loadQuestion();
}
// Show results
function showResults() {
quizContainer.classList.add('hidden');
resultsContainer.classList.remove('hidden');
finalScoreElement.textContent = score;
}
// Generate certificate (simulated)
function generateCertificate() {
alert(`Certificate generated for ${userData.name}!\n(Simulated function - in a real app, this would generate a PDF)`);
}
});
</script>
</body>
</html>
|