
- Unix / Linux - Home
- Unix / Linux - What is Linux?
- Unix / Linux - Getting Started
- Unix / Linux - File Management
- Unix / Linux - Directories
- Unix / Linux - File Permission
- Unix / Linux - Environment
- Unix / Linux - Basic Utilities
- Unix / Linux - Pipes & Filters
- Unix / Linux - Processes
- Unix / Linux - Communication
- Unix / Linux - The vi Editor
- Unix / Linux - Shell Scripting
- Unix / Linux - What is Shell?
- Unix / Linux - Using Variables
- Unix / Linux - Special Variables
- Unix / Linux - Using Arrays
- Unix / Linux - Basic Operators
- Unix / Linux - Decision Making
- Unix / Linux - Shell Loops
- Unix / Linux - Loop Control
- Unix / Linux - Shell Substitutions
- Unix / Linux - Quoting Mechanisms
- Unix / Linux - IO Redirections
- Unix / Linux - Shell Functions
- Unix / Linux - Manpage Help
- Advanced Unix / Linux
- Unix / Linux - Standard I/O Streams
- Unix / Linux - File Links
- Unix / Linux - Regular Expressions
- Unix / Linux - File System Basics
- Unix / Linux - User Administration
- Unix / Linux - System Performance
- Unix / Linux - System Logging
- Unix / Linux - Signals and Traps
Quiz on Unix Decision Making
${quizData[index].explanation}`; explanationDiv.style.display = "block"; if (buttonSpan) { buttonSpan.textContent = "Hide Answer"; } // Find the correct option and highlight it with yellow background const correctRadio = document.querySelector(`input[name="q${index}"][value="${correctAnswerIndex}"]`); if (correctRadio) { // Find the parent list item and highlight it const correctOption = correctRadio.closest('li'); if (correctOption) { correctOption.style.backgroundColor = "#fff9b7"; } } } } function submitQuiz() { let score = 0, attempted = 0; quizData.forEach((q, index) => { // Since we've hidden the radio buttons, we need to check their state const selectedOption = document.querySelector(`input[name="q${index}"]:checked`); if (selectedOption) { attempted++; if (parseInt(selectedOption.value) === q.answer) score++; } }); if (attempted < Math.ceil(quizData.length / 2)) { alert(`Please attempt at least ${Math.ceil(quizData.length / 2)} questions before submitting.`); return; } document.getElementById("result").innerText = `You scored ${score} out of ${quizData.length}!`; document.querySelector(".review-btn").disabled = false; document.querySelector(".review-btn").classList.add("enabled"); document.querySelector(".result-container").style.display = "block"; // Destroy any existing chart to prevent duplicate rendering if (window.quizResultChart) { window.quizResultChart.destroy(); } // Create new chart and store reference window.quizResultChart = new Chart(document.getElementById("resultChart"), { type: 'pie', data: { labels: ["Correct", "Incorrect"], datasets: [{ data: [score, quizData.length - score], backgroundColor: ["#28a745", "#dc3545"] }] } }); } function reviewQuiz() { quizData.forEach((q, index) => { showQuizAnswer(index); }); document.querySelector(".review-btn").disabled = true; } loadQuiz();
Advertisements