Question

In: Computer Science

Here is an array of multiple choice questions.

Here is an array of multiple choice questions.

var questions = [

{Q: "What's 2 + 2?",

A: "4",

B: "5',

C: "6",

ANS: "A" },

{Q: "What is 2 + 3?",

A: "5",

B: "6",

C: "8",

ANS: "A" },

];

In a separate JavaScript file, define a class of object called Question. The constructor takes an object literal that describes one question, and an integer representing the question number. It constructs the question in a paragraph, the answers in radio buttons with their corresponding labels, and makes a Grade button using .append(). The Question object also contains an addToDOM method, which appends the question to a given DOM element (the addToDOM method adds structure to the document at a given destination, and the destination is given by an argument to the addToDOM method). Please use JQuery.

Solutions

Expert Solution

class Question {
  constructor(q, qNum) {
    this.qNum = qNum;
    this.question = q['Q'];
    this.optionA = q['A'];
    this.optionB = q['B'];
    this.optionC = q['C'];
    this.optionD = q['D'];
    this.answer = q['ANS'];
  }
  addToDOM (elem) {
    s = '

' + this.qNum + ". " + this.question + "

";
    s += '' + this.optionA + '';
    s += '' + this.optionB + '';
    s += '' + this.optionC + '';
    s += '' + this.optionD + '';
    s += '';
    elem.append(s);
  }
}


Related Solutions

A student is given 20 multiple choice questions. Each multiple choice question has 4 options &...
A student is given 20 multiple choice questions. Each multiple choice question has 4 options & only one correct answer. The student answers all the questions in a random manner. a) What is the probability the student scores 80% or above? b) What is the probability the student scores 50% or above?
The rest of the questions on this lab activity (Questions 9-13) are multiple-choice. As you are...
The rest of the questions on this lab activity (Questions 9-13) are multiple-choice. As you are answering each question, please explain your answers in addition to picking what you believe to be the correct letter choice. 9. Which of the following does not need to be known in order to determine the p-value? A. the significance (or alpha) level B. knowledge of whether the test is one-tailed (or one-sided) or two-tailed (or two-sided) C. the value of the test statistic...
Multiple choice Questions: 1) A simple (but incomplete) definition of a/an______ is that it is a...
Multiple choice Questions: 1) A simple (but incomplete) definition of a/an______ is that it is a mathematical entity that has a specific magnitude and direction. A. director B. aviator C. bisector D. scalar E. vector 2) It is a physical quantity expressible by a single real number whose value is independent of the coordinate system (of ordinary physical space). A ________can have a direction in an abstract space. For example, temperature on the Celsius scale: it can have positive or...
The results of a (20 questions) multiple choice questions exam are recorded. Random samples of 10...
The results of a (20 questions) multiple choice questions exam are recorded. Random samples of 10 and 12 students are investigated. For the 10 student sample, the individual performances are 11, 8, 8, 3, 7, 5, 9, 5, 1, and 3 errors. For the 12 student sample, the individual performances are 10, 11, 9, 7, 2, 11, 12, 3, 6, 7, 8, and 12 errors. Assuming the population standard deviations are equal, use the 0.10 level of significance in testing...
There are 20 questions in a multiple choice driver competition. In each question there are 4...
There are 20 questions in a multiple choice driver competition. In each question there are 4 answers of which only one is correct. The score on each question is 0.5 points for each correct answer and 0 for each mistake. A candidate must pass at least 6 credits to pass the exam. If we assume that a candidate is lucky enough to answer all the questions in this test, calculate: A. The probability that the candidate will "pass". B. The...
Multiple-Choice Questions The unemployment rate is calculated as: the percentage of the labor force that is...
Multiple-Choice Questions The unemployment rate is calculated as: the percentage of the labor force that is unemployed. the percentage of the population that is unemployed. all people without jobs, as a percentage of the labor force. all people without jobs, as a percentage of the population. The labor force participation rate is calculated as: the percentage of the population age 16 or older that is unemployed. the percentage of the population age 16 or older that is in the labor...
Multiple choice questions 25. Geert Hofstede is:             a. the prime minister of the Netherlands            ...
Multiple choice questions 25. Geert Hofstede is:             a. the prime minister of the Netherlands             b. a scholar Eof workplace cultural values             c. the General Secretary of the UN             d. none of the above 26. The religion of Islam is composed of the: a. Sunni sect b. Shia sect c. Christian sect d. Global sect e. “a.” and “b.” above 27. The best way to understand Sunni and Shia conflict within Islam is to consider:             a....
Multiple-Choice Questions 1) The price elasticity of demand is a measure of A) the responsiveness of...
Multiple-Choice Questions 1) The price elasticity of demand is a measure of A) the responsiveness of the quantity demanded to price changes. B) the quantity demanded at a given price. C) the shift in the demand curve when price changes. D) the demand for a product holding price constant. 2) The elasticity of demand for a product is likely to be greater A) the smaller the number of substitute products available. B) the smaller the proportion of one's income spent...
These are the answered multiple choice questions about the forces in the Student and Backpack problem....
These are the answered multiple choice questions about the forces in the Student and Backpack problem. Make a clear diagram which properly identifies all of the forces acting on the student (you will also need a similar, separate, diagram for the backpack), and then making the proper arguments leading to the correct answer. (a) Which is stronger force, the force on the student by the backpack or the force on the backpack by the student? The two forces are equally...
In a multiple choice exam, there are 7 questions and 4 choices for each question (a,...
In a multiple choice exam, there are 7 questions and 4 choices for each question (a, b, c, d). Nancy has not studied for the exam at all and decides to randomly guess the answers. What is the probability that: (please round all answers to four decimal places) a) the first question she gets right is question number 3? b) she gets all of the questions right? c) she gets at least one question right?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT