co-d / index.html
devendra88's picture
don't add programming questions add basic questions - Initial Deployment
2d542f2 verified
Raw History Blame Contribute Delete
20.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Computer Diploma 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>
.progress-bar {
transition: width 0.3s ease;
}
.option:hover {
transform: translateY(-2px);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.pulse {
animation: pulse 1s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
</style>
</head>
<body class="bg-gradient-to-br from-blue-900 to-purple-900 min-h-screen text-white">
<div id="app" class="container mx-auto px-4 py-8">
<!-- Start Screen -->
<div id="start-screen" class="text-center max-w-2xl mx-auto mt-16" data-aos="zoom-in">
<div class="bg-white/10 backdrop-blur-md rounded-xl p-8 shadow-2xl border border-white/20">
<h1 class="text-4xl font-bold mb-6 text-transparent bg-clip-text bg-gradient-to-r from-blue-300 to-purple-300">Computer Diploma Quiz</h1>
<p class="text-xl mb-8 text-blue-100">Test your knowledge with 20 challenging questions in just 2 minutes!</p>
<div class="flex items-center justify-center mb-8">
<i data-feather="clock" class="w-8 h-8 mr-2"></i>
<span class="text-lg">2 Minute Challenge</span>
</div>
<button id="start-btn" class="bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-bold py-3 px-8 rounded-full text-lg transition-all duration-300 transform hover:scale-105 shadow-lg pulse">
Start Quiz
</button>
</div>
</div>
<!-- Quiz Screen -->
<div id="quiz-screen" class="hidden max-w-3xl mx-auto mt-8">
<div class="flex justify-between items-center mb-6">
<div class="text-xl font-semibold">
Question <span id="question-counter">1</span>/20
</div>
<div class="flex items-center">
<i data-feather="clock" class="w-5 h-5 mr-2"></i>
<span id="timer" class="text-xl font-bold">02:00</span>
</div>
</div>
<div class="bg-white/10 backdrop-blur-md rounded-xl p-6 shadow-xl border border-white/20">
<!-- Progress Bar -->
<div class="h-3 bg-white/20 rounded-full mb-6">
<div id="progress-bar" class="progress-bar h-full bg-gradient-to-r from-blue-400 to-purple-500 rounded-full" style="width: 5%"></div>
</div>
<!-- Question -->
<h2 id="question" class="text-2xl font-semibold mb-8"></h2>
<!-- Options -->
<div id="options" class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-8">
<!-- Options will be inserted here by JavaScript -->
</div>
<!-- Navigation -->
<div class="flex justify-between">
<button id="prev-btn" class="bg-white/20 hover:bg-white/30 text-white font-medium py-2 px-6 rounded-lg transition-all duration-200 hidden">
<i data-feather="arrow-left" class="inline mr-2"></i> Previous
</button>
<button id="next-btn" class="bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-medium py-2 px-6 rounded-lg transition-all duration-200 ml-auto">
Next <i data-feather="arrow-right" class="inline ml-2"></i>
</button>
<button id="submit-btn" class="bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-6 rounded-lg transition-all duration-200 hidden">
Submit <i data-feather="check" class="inline ml-2"></i>
</button>
</div>
</div>
</div>
<!-- Results Screen -->
<div id="results-screen" class="hidden max-w-2xl mx-auto mt-16 text-center">
<div class="bg-white/10 backdrop-blur-md rounded-xl p-8 shadow-2xl border border-white/20" data-aos="zoom-in">
<h2 class="text-3xl font-bold mb-6">Quiz Completed!</h2>
<div class="text-5xl font-bold mb-6 text-transparent bg-clip-text bg-gradient-to-r from-blue-300 to-purple-300">
<span id="score">0</span>/20
</div>
<div class="text-xl mb-8">
<span id="percentage">0</span>% Correct
</div>
<div class="h-4 bg-white/20 rounded-full mb-8">
<div id="score-bar" class="h-full bg-gradient-to-r from-blue-400 to-purple-500 rounded-full" style="width: 0%"></div>
</div>
<div class="mb-8">
<p id="feedback" class="text-lg"></p>
</div>
<button id="restart-btn" class="bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-bold py-3 px-8 rounded-full text-lg transition-all duration-300 transform hover:scale-105 shadow-lg">
Try Again <i data-feather="refresh-cw" class="inline ml-2"></i>
</button>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
feather.replace();
AOS.init();
// Quiz questions
const questions = [
{
question: "What is the full form of WWW?",
options: [
"World Wide Web",
"Web World Wide",
"Wide World Web",
"World Web Wide"
],
answer: 0
},
{
question: "Which key is used to refresh a webpage?",
options: [
"F1",
"F5",
"F9",
"F12"
],
answer: 1
},
{
question: "What is the main purpose of a mouse?",
options: [
"Typing",
"Pointing and clicking",
"Printing",
"Scanning"
],
answer: 1
},
{
question: "Which of these is NOT an input device?",
options: [
"Keyboard",
"Mouse",
"Monitor",
"Scanner"
],
answer: 2
},
{
question: "What does USB stand for?",
options: [
"Universal Serial Bus",
"United Serial Bus",
"Universal System Bus",
"United System Bus"
],
answer: 0
},
{
question: "Which company created Windows?",
options: [
"Apple",
"Microsoft",
"Google",
"IBM"
],
answer: 1
},
{
question: "What is the default extension for Word documents?",
options: [
".txt",
".docx",
".pdf",
".xlsx"
],
answer: 1
},
{
question: "Which program is used for spreadsheets?",
options: [
"Word",
"PowerPoint",
"Excel",
"Access"
],
answer: 2
},
{
question: "What is the shortcut to copy text?",
options: [
"Ctrl+A",
"Ctrl+C",
"Ctrl+V",
"Ctrl+X"
],
answer: 1
},
{
question: "Which of these is a web browser?",
options: [
"Photoshop",
"Chrome",
"Word",
"Excel"
],
answer: 1
},
{
question: "What is the function of the 'Delete' key?",
options: [
"Move cursor left",
"Remove text to the right",
"Create new line",
"Save document"
],
answer: 1
},
{
question: "Which folder contains deleted files?",
options: [
"Downloads",
"Documents",
"Recycle Bin",
"Desktop"
],
answer: 2
},
{
question: "What does PDF stand for?",
options: [
"Portable Document Format",
"Personal Document File",
"Printed Document Format",
"Public Document File"
],
answer: 0
},
{
question: "Which key combination opens Task Manager?",
options: [
"Ctrl+Alt+Delete",
"Shift+Alt+Delete",
"Ctrl+Shift+Esc",
"Both 1 and 3"
],
answer: 3
},
{
question: "What is the purpose of a screensaver?",
options: [
"Improve performance",
"Prevent screen burn-in",
"Increase brightness",
"Show notifications"
],
answer: 1
},
{
question: "Which of these is a social media platform?",
options: [
"Word",
"Excel",
"Facebook",
"Photoshop"
],
answer: 2
},
{
question: "What does 'CC' mean in email?",
options: [
"Carbon Copy",
"Computer Copy",
"Central Copy",
"Client Copy"
],
answer: 0
},
{
question: "Which device connects computers to the internet?",
options: [
"Printer",
"Scanner",
"Modem",
"Speaker"
],
answer: 2
},
{
question: "What is the function of the 'Caps Lock' key?",
options: [
"Delete text",
"Type in uppercase",
"Open calculator",
"Save document"
],
answer: 1
},
{
question: "Which of these is a search engine?",
options: [
"Facebook",
"Google",
"WhatsApp",
"Instagram"
],
answer: 1
}
];
// Quiz state
let currentQuestion = 0;
let score = 0;
let timeLeft = 120; // 2 minutes in seconds
let timer;
let userAnswers = Array(questions.length).fill(null);
// DOM elements
const startScreen = document.getElementById('start-screen');
const quizScreen = document.getElementById('quiz-screen');
const resultsScreen = document.getElementById('results-screen');
const startBtn = document.getElementById('start-btn');
const prevBtn = document.getElementById('prev-btn');
const nextBtn = document.getElementById('next-btn');
const submitBtn = document.getElementById('submit-btn');
const restartBtn = document.getElementById('restart-btn');
const questionCounter = document.getElementById('question-counter');
const timerElement = document.getElementById('timer');
const progressBar = document.getElementById('progress-bar');
const questionElement = document.getElementById('question');
const optionsContainer = document.getElementById('options');
const scoreElement = document.getElementById('score');
const percentageElement = document.getElementById('percentage');
const scoreBar = document.getElementById('score-bar');
const feedbackElement = document.getElementById('feedback');
// Start quiz
startBtn.addEventListener('click', startQuiz);
function startQuiz() {
startScreen.classList.add('hidden');
quizScreen.classList.remove('hidden');
startTimer();
showQuestion();
}
// Timer function
function startTimer() {
updateTimerDisplay();
timer = setInterval(() => {
timeLeft--;
updateTimerDisplay();
if (timeLeft <= 0) {
clearInterval(timer);
endQuiz();
}
}, 1000);
}
function updateTimerDisplay() {
const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;
timerElement.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
// Change color when time is running low
if (timeLeft <= 30) {
timerElement.classList.add('text-red-400', 'animate-pulse');
} else {
timerElement.classList.remove('text-red-400', 'animate-pulse');
}
}
// Show question
function showQuestion() {
const question = questions[currentQuestion];
questionElement.textContent = question.question;
questionCounter.textContent = currentQuestion + 1;
// Update progress bar
const progress = ((currentQuestion + 1) / questions.length) * 100;
progressBar.style.width = `${progress}%`;
// Clear previous options
optionsContainer.innerHTML = '';
// Add new options
question.options.forEach((option, index) => {
const optionElement = document.createElement('button');
optionElement.className = `option bg-white/10 hover:bg-white/20 border border-white/20 rounded-lg p-4 text-left transition-all duration-200 ${userAnswers[currentQuestion] === index ? 'bg-blue-500/30 border-blue-400' : ''}`;
optionElement.textContent = option;
optionElement.addEventListener('click', () => selectOption(index));
optionsContainer.appendChild(optionElement);
});
// Update navigation buttons
prevBtn.classList.toggle('hidden', currentQuestion === 0);
nextBtn.classList.toggle('hidden', currentQuestion === questions.length - 1);
submitBtn.classList.toggle('hidden', currentQuestion !== questions.length - 1);
}
// Select option
function selectOption(optionIndex) {
userAnswers[currentQuestion] = optionIndex;
// Highlight selected option
const options = optionsContainer.querySelectorAll('.option');
options.forEach((option, index) => {
if (index === optionIndex) {
option.classList.add('bg-blue-500/30', 'border-blue-400');
} else {
option.classList.remove('bg-blue-500/30', 'border-blue-400');
}
});
}
// Navigation
prevBtn.addEventListener('click', () => {
if (currentQuestion > 0) {
currentQuestion--;
showQuestion();
}
});
nextBtn.addEventListener('click', () => {
if (currentQuestion < questions.length - 1) {
currentQuestion++;
showQuestion();
}
});
submitBtn.addEventListener('click', endQuiz);
// End quiz
function endQuiz() {
clearInterval(timer);
quizScreen.classList.add('hidden');
resultsScreen.classList.remove('hidden');
// Calculate score
score = 0;
userAnswers.forEach((answer, index) => {
if (answer === questions[index].answer) {
score++;
}
});
const percentage = Math.round((score / questions.length) * 100);
// Display results
scoreElement.textContent = score;
percentageElement.textContent = percentage;
scoreBar.style.width = `${percentage}%`;
// Provide feedback
if (percentage >= 80) {
feedbackElement.textContent = "Excellent! You have a strong understanding of computer diploma concepts.";
} else if (percentage >= 60) {
feedbackElement.textContent = "Good job! You have a solid foundation but could use some more practice.";
} else if (percentage >= 40) {
feedbackElement.textContent = "Not bad! Consider reviewing some key concepts to improve.";
} else {
feedbackElement.textContent = "Keep practicing! Review the material and try again.";
}
}
// Restart quiz
restartBtn.addEventListener('click', () => {
currentQuestion = 0;
score = 0;
timeLeft = 120;
userAnswers = Array(questions.length).fill(null);
resultsScreen.classList.add('hidden');
startScreen.classList.remove('hidden');
// Reset timer display
timerElement.classList.remove('text-red-400', 'animate-pulse');
});
});
</script>
<script>feather.replace();</script>
<script>AOS.init();</script>
</body>
</html>