In: Computer Science
java script coding to create a math test program with 5 questions.
JavaScript program to create a math test
The source code:
var myQuestions = [
        {
                question: "What is 2*20?",
                answers: {
                        a: '30',
                        b: '40',
                        c: '50'
                }
                correctAnswer: 'b'
        }
        {
                question: "What is 30/3?",
                answers: {
                        a: '3',
                        b: '5',
                        c: '10'
                }
                correctAnswer: 'c'
        }
{
                question: "What is 199+3?",
                answers: {
                        a: '201',
                        b: '210',
                        c: '202'
                }
                correctAnswer: 'c'
        }
{
                question: "What is 30-3?",
                answers: {
                        a: '27',
                        b: '52',
                        c: '10'
                }
                correctAnswer: 'a'
        }
{
                question: "What is 30% of300?",
                answers: {
                        a: '30',
                        b: '90',
                        c: '100'
                }
                correctAnswer: 'b'
        }
];
console.log(myQuestions);