var allQuestions = [
{question: "1. Grand Central Terminal, Park Avenue, New York is the world's: ",
options: ["largest railway station", "highest railway station","longest railway station", "none of the above"],
correctAnswer: 0
},
{question: "2. Entomology is the science that studies: ",
options: ["Behavior of human beings", "Insects", "The origin and history of technical and scientific terms", "The formation of rocks"],
correctAnswer: 1
},
{question:"3. Eritrea, which became the 182nd member of the UN in 1993, is in the continent of: ",
options: ["Asia", "Africa", "Europe", "Australia"],
correctAnswer: 1
},
{question: "4. Garampani sanctuary is located at: ",
options: ["Junagarh, Gujarat", "Diphu, Assam","Kohima, Nagaland", "Gangtok, Sikkim"],
correctAnswer: 1
},
{question: "5. For which of the following disciplines is Nobel Prize awarded?",
options: ["Physics and Chemistry",
"Physiology or Medicine", "Literature, Peace and Economics", "All of the above"],
correctAnswer: 3
}];
var quiz = document.getElementById("quiz");
var currentQuestion = 0;
var answers = 0;
function displayQuestion (num) {
quiz.innerHTML = "";
var questionObj = allQuestions[num];
var questions = questionObj["question"];
var questionDiv = document.createElement("div");
var questionText = document.createTextNode(questions);
var options = questionObj["options"];
var optionsDiv = document.createElement("div");
questionDiv.appendChild(questionText);
for (var i = 0; i < options.length; i++) {
var radio = document.createElement("input");
radio.type = "radio";
radio.id = i;
radio.value = i;
radio.name = "option";
radio.required = true;
optionsDiv.appendChild(radio);
var label = document.createElement("label");
label.for =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.