Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to create a JavaScript Quiz (without jQuery). The spec of the quiz are as follow, there should be an array used to store

I need to create a JavaScript Quiz (without jQuery). The spec of the quiz are as follow, there should be an array used to store questions and one answer for each question. The user will be using a TEXT FIELD NOT RADIO BUTTONS to answer the question. Once all the questions have been answered, write a function that display a summary of the quiz to the user. Include the number of questions answered correctly and incorrectly. Include in the function if they answered all 10 questions correctly display a congratulations message. If they scored 9/10 let them know they did a good job. ALL MUST BE HARDCODED in JAVASCRIPT.

Here is what I have done so far

// Array that stores the question and answer for the quiz

var myQuestions = [

{

question: "Are programming languages the same as the English langauage?",

answer: "No"

},

{

question: "Is Machine Language made up of Binary numbers?",

answer: "Yes"

},

{

question: "Is Django a library in Python used for mobile development?",

answer: "No",

},

{

question: "Let is meant for declaring unchangeable variables in Swift.",

answer: "Yes"

},

{

question: "Are both Linux and Windows operating systems?",

answer: "Yes"

},

{

question: "Do you user the function println in Swift?",

answer: "No"

},

{

question: "Can you use Swift or Objective-C for both iOS and Android development?",

answer: "No"

},

{

question: "Is the interpreter and compiler the same in programming?",

answer: "No"

},

{

question: "Do programming take place in game development?",

answer: "Yes"

},

{

question: "Is the extension .txt a programming language extension?",

answer: "No"

},

]

// Stored reference to the element in variable

var quizContainer = document.getElementById('quiz');

var resultsContainer = document.getElementById('results');

var submitButton = document.getElementById('submit');

generateQuiz(myQuestions, quizContainer, resultsContainer, submitButton);

function generateQuiz(questions, quizContainer, resultContainer, submitButton){

function showQuestions(questions, quizContainer){

var output = [];

var answer;

for (var i = 0; i < question.length; i++){

answer = [];

for questions[i].answer {

answer.push(

'

+ ''

+ questions[i].answer

+ ''

);

output.push(

'

' + questions[i].question + '
'

+ '

' + answer.join('') + '
'

);

}

}

quizContainer.innerHTML = output.join('');

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

Project management skills and/or experience desirable

Answered: 1 week ago