Constitution Quiz
by Eminence
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="container">
<div class="text-center">
<div class="well" id="q">
<h1>Constitution Quiz</h1>
<br>
<p>This is a quiz on the constitution, the bill of rights, and general knowledge of the government's
infrastructure. References for study material are shown near the bottom of the page.
<br><br>
Directions: The questions will show up in this box. The quiz is multiple choice, so buttons
will appear under this box with respective answers for each button. You scores will be tallied and
presented to you at the end of the quiz.</p>
</div>
<form id="btns"></form>
<div id="sub">
<button class="btn" onclick="init_quiz()">Start</button>
</div>
</div>
</div>
JavaScript
let prompts = [ // 16 prompts
"What are the three branches of government?",
"How many supreme court justices are there?",
"The number of representatives of a state is proportionate to what?",
"What is the Bill of Rights?",
"Which chambers make up Congress?",
"How many Senators represent each state?",
"What fraction of senators must agree in order to impeach a member of the government?", // 2/3
"What branch of government does Article 1 of the constitution talk about?",
"What branch of government does Article 2 of the constitution talk about?",
"What branch of government does Article 3 of the constitution talk about?",
"Who presided over the Constitutional Convention?",
"Which amendment guarantees the freedom of speech, press, religion, petition, and assembly?",
"Which amendment reserves powers (not possessed by the federal government) to the states and people?",
"Which amendment protects one from unreasonable searches and seizures?",
"Which of the following is <b>not</b> an explicit power of the president?",
"What was the country's first Constitution called?"
];
// The i-th array in answers corresponds to the i-th question in prompts
let answers = [ // 64 answers, in groups (arrays) of 4
["Legislative, Judicial, and Executive",
"Supreme court, House of representatives, and Congress",
"Presidential, Legislative, and Judicial",
"Congress, White house, and Supreme Court"],
["9",
"8",
"7",
"11"],
["Population size",
"Average income",
"Number of businesses",
"Number of courts"],
["The first 10 amendments",
"The Emancipation Proclamation",
"All 27 amendments",
"The first 20 amendments"],
["The House of Representatives and the Senate",
"The White House and the House of Representatives",
"The Sentate and the White House",
"The White House and the Supreme Court"],
["2",
"1",
"3",
"Each state does not have the same number of senators"],
["2/3",
"1/2",
"3/4",
"All senators...