|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <title>Ptah Nifty Assignment Quiz</title> |
| 6 | + <style> |
| 7 | + body { font-family: Arial, sans-serif; margin: 20px; background: #f9f9f9; } |
| 8 | + h1, h2 { color: #00274c; } |
| 9 | + h1 { font-size: 2.2em; text-align: center; } |
| 10 | + .question { margin: 15px 0; padding: 15px; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); } |
| 11 | + .question-title { font-weight: bold; } |
| 12 | + .options { margin-left: 20px; } |
| 13 | + .btn { padding: 10px 16px; background: #0055a4; color: #fff; border: none; border-radius: 4px; cursor: pointer; margin-top: 20px; } |
| 14 | + .score { font-size: 1.2em; font-weight: bold; margin-top: 20px; } |
| 15 | + </style> |
| 16 | +</head> |
| 17 | +<body> |
| 18 | + <h1>Ptah: Nifty Assignment Quiz</h1> |
| 19 | + <p>Answer all questions below and click Submit to see your score.</p> |
| 20 | + <form id="quizForm"> |
| 21 | + </form> |
| 22 | + <button class="btn" onclick="submitQuiz()">Submit All</button> |
| 23 | + <div class="score" id="finalScore"></div> |
| 24 | + |
| 25 | + <script> |
| 26 | + const questions = []; |
| 27 | + // Populate questions array same as index: PQC, LW, ORC, HW, MON (100 total) |
| 28 | + // Example for first few: |
| 29 | + questions.push({ title: 'Which PQC algorithm is standardized for digital signatures?', options: ['CRYSTALS-Kyber','CRYSTALS-Dilithium','ASCON'], answer: 'CRYSTALS-Dilithium', points: 2 }); |
| 30 | + // ... (add all 100 questions here) ... |
| 31 | + |
| 32 | + const form = document.getElementById('quizForm'); |
| 33 | + questions.forEach((q, idx) => { |
| 34 | + const div = document.createElement('div'); |
| 35 | + div.className = 'question'; |
| 36 | + const p = document.createElement('p'); p.className='question-title'; p.textContent = `${idx+1}. ${q.title}`; |
| 37 | + div.appendChild(p); |
| 38 | + const opts = document.createElement('div'); opts.className='options'; |
| 39 | + q.options.forEach(opt => { |
| 40 | + const label = document.createElement('label'); |
| 41 | + const inp = document.createElement('input'); inp.type='radio'; inp.name=`q${idx}`; inp.value=opt; |
| 42 | + label.appendChild(inp); label.appendChild(document.createTextNode(' '+opt)); |
| 43 | + opts.appendChild(label); opts.appendChild(document.createElement('br')); |
| 44 | + }); |
| 45 | + div.appendChild(opts); |
| 46 | + form.appendChild(div); |
| 47 | + }); |
| 48 | + |
| 49 | + function submitQuiz() { |
| 50 | + let score=0; |
| 51 | + questions.forEach((q, idx) => { |
| 52 | + const sel = document.querySelector(`input[name="q${idx}"]:checked`); |
| 53 | + if (sel && sel.value===q.answer) score+=q.points; |
| 54 | + }); |
| 55 | + document.getElementById('finalScore').textContent = `Your Score: ${score} / ${questions.length*2}`; |
| 56 | + } |
| 57 | + </script> |
| 58 | +</body> |
| 59 | +</html> |
1 | 60 |
|
0 commit comments