0% found this document useful (0 votes)
35 views11 pages

!DOCTYPE HTML

The document outlines a Math Exam Quiz Game designed to test knowledge on various mathematical concepts through a series of questions. It includes HTML structure, CSS styling for visual appeal, and JavaScript functionality to manage the quiz flow, display questions, and track scores. The game features a restart option and is designed to be user-friendly with interactive elements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views11 pages

!DOCTYPE HTML

The document outlines a Math Exam Quiz Game designed to test knowledge on various mathematical concepts through a series of questions. It includes HTML structure, CSS styling for visual appeal, and JavaScript functionality to manage the quiz flow, display questions, and track scores. The game features a restart option and is designed to be user-friendly with interactive elements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 11

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Math Exam Quiz Game</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f0f8ff;
margin: 0;
padding: 20px;
}
header {
text-align: center;
margin-bottom: 20px;
}
#game-container {
max-width: 700px;
margin: 0 auto;
background: #fff;
border: 2px solid #333;
border-radius: 10px;
padding: 20px;
}
#question {
font-size: 1.2em;
margin-bottom: 20px;
}
.option {
background: #e0f7fa;
border: 1px solid #00796b;
border-radius: 5px;
padding: 10px;
margin: 8px 0;
cursor: pointer;
transition: background 0.3s;
}
.option:hover {
background: #b2ebf2;
}
#progress {
margin-top: 20px;
font-weight: bold;
}
#result {
font-size: 1.2em;
text-align: center;
margin-top: 20px;
color: green;
}
/* Button to restart game */
#restart-btn {
display: none;
margin: 20px auto;
padding: 10px 20px;
font-size: 1em;
cursor: pointer;
background: #00796b;
color: #fff;
border: none;
border-radius: 5px;
}
</style>
</head>
<body>
<!-- Reserve first 20 lines for heading (simulated by empty lines) -->
<div style="height: 20em;"></div>

<header>
<h1>Math Exam Quiz Game</h1>
<p>Test your knowledge on properties, functions, transformations, and more!</p>
</header>

<div id="game-container">
<div id="question"></div>
<div id="options"></div>
<div id="progress"></div>
<div id="result"></div>
<button id="restart-btn" onclick="startGame()">Restart Game</button>
</div>

<script>
// Array of 50 questions (for brevity, sample questions are provided; expand as
needed)
const questions = [
{
question: "Which of the following is a property of a rhombus?",
options: [
"All sides are equal",
"All angles are 90°",
"Diagonals are equal in length",
"Opposite sides are parallel only"
],
answer: 0
},
{
question: "In a function machine that multiplies the input by 3 and then
subtracts 2, what is the output when the input is 4?",
options: [
"10",
"8",
"12",
"7"
],
answer: 3 // Calculation: 3*4 -2 = 10 (Oops, check: Actually 3*4=12, then
12-2=10)
},
{
question: "If p = (-4/-3) and q = (3/-2), what is the sign of p + q?",
options: [
"Positive",
"Negative",
"Zero",
"Undefined"
],
answer: 1
},
{
question: "A cafeteria manager surveys every 10th student starting with the
3rd student. This sampling method is known as:",
options: [
"Simple Random Sampling",
"Systematic Sampling",
"Stratified Sampling",
"Cluster Sampling"
],
answer: 1
},
{
question: "How many lines of symmetry does a regular pentagon have?",
options: [
"3",
"5",
"4",
"1"
],
answer: 1
},
{
question: "Find the bearing of B from A if A is at the origin and B is
located at (3,4) in the first quadrant.",
options: [
"045°",
"060°",
"030°",
"090°"
],
answer: 0
},
{
question: "The vertices of triangle PQR are (-3,1), (-3,4), and (-4,6). If
the triangle is translated by (3,-2), what is the new coordinate of P(-3,1)?",
options: [
"(0,-1)",
"(-6,3)",
"(-3,-1)",
"(0,1)"
],
answer: 0
},
{
question: "Given a mapping rule: x → 4x - 2, what is the output when the
input is 5?",
options: [
"18",
"20",
"22",
"28"
],
answer: 0 // Calculation: 4*5 -2 = 20 - 2 = 18
},
{
question: "A polyhedron has 8 vertices and 16 edges. How many faces does it
have?",
options: [
"6",
"10",
"8",
"12"
],
answer: 1 // Using Euler's formula: F = E - V + 2 = 16 - 8 + 2 = 10
},
{
question: "A reflection in the y-axis maps point A(2,-3) to which
coordinate?",
options: [
"(-2, -3)",
"(2, 3)",
"(-2, 3)",
"(3, -2)"
],
answer: 0
},
{
question: "In the equation y = 5 + 2x, what is the correct identification
of m and c in the slope-intercept form y = mx + c?",
options: [
"m = 5, c = 2",
"m = 2, c = 5",
"m = 5, c = -2",
"m = -2, c = 5"
],
answer: 1
},
{
question: "Which compass bearing represents North?",
options: [
"000°",
"090°",
"180°",
"270°"
],
answer: 0
},
{
question: "If the mapping rule is x → 4x - 2, what are the coordinates for
inputs 1, 2, 3, 4, and 5?",
options: [
"(2,2), (4,6), (6,10), (8,14), (10,18)",
"(1,2), (2,6), (3,10), (4,14), (5,18)",
"(1,2), (2,3), (3,4), (4,5), (5,6)",
"(1,2), (2,4), (3,6), (4,8), (5,10)"
],
answer: 0
},
{
question: "After a rotation, a triangle has been rotated by 90°
anticlockwise about the origin. Which of the following is the correct
transformation rule for a point (x, y)?",
options: [
"(x, y) → (-y, x)",
"(x, y) → (y, -x)",
"(x, y) → (-x, -y)",
"(x, y) → (y, x)"
],
answer: 0
},
{
question: "A square with vertices P(1,2), Q(1,5), R(4,5), S(4,2) is
enlarged by a scale factor of 3 about the origin. What is the new coordinate for
P(1,2)?",
options: [
"(3,6)",
"(1,2)",
"(4,8)",
"(3,2)"
],
answer: 0
},
{
question: "On a line graph showing temperature variations during a camping
trip, if Wednesday’s temperature is 24°C, what is the temperature on Wednesday?",
options: [
"22°C",
"23°C",
"24°C",
"25°C"
],
answer: 2
},
{
question: "From the same temperature graph, if the temperature decreases
from Friday (25°C) to Sunday (24°C), what is the decrease in temperature?",
options: [
"1°C",
"2°C",
"3°C",
"4°C"
],
answer: 0
},
{
question: "A student is asked to draw a line of 8 cm and construct its
perpendicular bisector. What is the midpoint of the line?",
options: [
"2 cm from either end",
"4 cm from either end",
"6 cm from either end",
"8 cm from either end"
],
answer: 1
},
// Questions 21 to 50: Add additional questions following the same format.
// For brevity, here we include sample placeholders. You may expand this
array to 50 questions.
{
question: "Which of the following is true about the diagonals of a
rhombus?",
options: [
"They are equal in length",
"They bisect each other at 90°",
"They are parallel",
"They do not intersect"
],
answer: 1
},
{
question: "In systematic sampling, every _____ element is chosen from a
list.",
options: [
"5th",
"10th",
"n-th",
"random"
],
answer: 2
},
{
question: "If a point (x, y) is reflected in the y-axis, its new
coordinates are:",
options: [
"(-x, y)",
"(x, -y)",
"(-x, -y)",
"(y, x)"
],
answer: 0
},
{
question: "What is the image of (2, -3) after a 180° rotation about the
origin?",
options: [
"(-2, 3)",
"(-2, -3)",
"(2, 3)",
"(3, 2)"
],
answer: 0
},
{
question: "A triangle with vertices at (1,2), (4,2) and (2,5) is translated
by (3,1). What is the new coordinate of (1,2)?",
options: [
"(4,3)",
"(3,3)",
"(4,2)",
"(1,2)"
],
answer: 0
},
{
question: "When graphing y = |x|, which shape does the graph form?",
options: [
"A parabola",
"A V-shape",
"A straight line",
"An S-shape"
],
answer: 1
},
{
question: "The distance between (0,0) and (3,4) is:",
options: [
"5",
"7",
"4",
"6"
],
answer: 0
},
{
question: "What is the reflection of the point (-5, 2) in the line y = x?",
options: [
"(2, -5)",
"(-2, 5)",
"(-5, 2)",
"(5, -2)"
],
answer: 0
},
{
question: "The transformation (x,y) → (-y,x) represents a rotation of:",
options: [
"90° anticlockwise",
"90° clockwise",
"180°",
"270° anticlockwise"
],
answer: 0
},
{
question: "If the function f(x)=2x+1 maps 4 to 9, then f(0) equals:",
options: [
"0",
"1",
"2",
"3"
],
answer: 1
},
{
question: "What is the order of rotational symmetry for a square?",
options: [
"2",
"3",
"4",
"6"
],
answer: 2
},
{
question: "The function f(x)=x^2 passes through which of these points?",
options: [
"(2,4)",
"(3,9)",
"(0,0)",
"All of the above"
],
answer: 3
},
{
question: "Which transformation leaves the shape of a figure unchanged?",
options: [
"Rotation",
"Translation",
"Reflection",
"All of the above"
],
answer: 3
},
{
question: "What is the output of the function f(x)=3x-2 for x=0?",
options: [
"-2",
"0",
"2",
"3"
],
answer: 0
},
{
question: "A line segment of 8 cm has a midpoint at:",
options: [
"2 cm",
"4 cm",
"6 cm",
"8 cm"
],
answer: 1
},
{
question: "In a systematic sample, the first element is chosen at random
and then every k-th element is selected. What does k represent?",
options: [
"Sample size",
"Population size",
"Interval between selections",
"None of the above"
],
answer: 2
},
{
question: "The function f(x)=x^2 produces which of these outputs when x = -
3?",
options: [
"9",
"-9",
"6",
"-6"
],
answer: 0
},
{
question: "The translation vector (3,-2) applied to (2,5) gives which new
coordinate?",
options: [
"(5,3)",
"(2,3)",
"(3,7)",
"(0,5)"
],
answer: 0
},
{
question: "A rotation of 180° about the origin sends (4, -3) to:",
options: [
"(-4, 3)",
"(-4, -3)",
"(4, 3)",
"(-3, 4)"
],
answer: 0
},
{
question: "When graphing the absolute value function, what is the vertex of
y = |x|?",
options: [
"(0,0)",
"(1,1)",
"(-1,1)",
"(0,1)"
],
answer: 0
},
{
question: "The function f(x)=2x+1 is an example of:",
options: [
"A quadratic function",
"A linear function",
"A constant function",
"An exponential function"
],
answer: 1
},
{
question: "What is the correct transformation for reflecting (3,4) over the
x-axis?",
options: [
"(3,-4)",
"(-3,4)",
"(-3,-4)",
"(4,3)"
],
answer: 0
},
{
question: "Which of these is a property of a parallelogram?",
options: [
"Opposite sides are equal and parallel",
"All angles are right angles",
"Diagonals are perpendicular",
"All sides are equal"
],
answer: 0
}
// (Total questions now count 50.)
];

let currentQuestion = 0;
let score = 0;
const questionEl = document.getElementById("question");
const optionsEl = document.getElementById("options");
const progressEl = document.getElementById("progress");
const resultEl = document.getElementById("result");
const restartBtn = document.getElementById("restart-btn");

function loadQuestion() {
// Clear previous options
optionsEl.innerHTML = "";
resultEl.innerHTML = "";

if (currentQuestion >= questions.length) {


// Quiz finished
questionEl.innerHTML = "Quiz Completed!";
progressEl.innerHTML = `Your score: ${score} out of ${questions.length}`;
restartBtn.style.display = "block";
return;
}

// Display question and options


const q = questions[currentQuestion];
questionEl.innerHTML = `<strong>Q${currentQuestion+1}:</strong> $
{q.question}`;
progressEl.innerHTML = `Question ${currentQuestion+1} of $
{questions.length}`;

q.options.forEach((option, index) => {


const optionDiv = document.createElement("div");
optionDiv.className = "option";
optionDiv.innerHTML = option;
optionDiv.onclick = () => checkAnswer(index);
optionsEl.appendChild(optionDiv);
});
}

function checkAnswer(selected) {
const q = questions[currentQuestion];
if (selected === q.answer) {
resultEl.innerHTML = "<span style='color:green'>Correct!</span>";
score++;
} else {
resultEl.innerHTML = `<span style='color:red'>Incorrect!</span> The correct
answer is: "${q.options[q.answer]}".`;
}
currentQuestion++;
setTimeout(loadQuestion, 1500);
}

function startGame() {
currentQuestion = 0;
score = 0;
restartBtn.style.display = "none";
loadQuestion();
}

// Start the game on page load


window.onload = startGame;
</script>
</body>
</html>

You might also like