Question 6(a)(iii) 2019 · October-November · Paper 13 · 1 mark
Reveal official mark-scheme answer
Official answer for Question 6
Part (a)
(iii)
Question 14
Question 1
Show text version of question
Question 6
Part (a)
(iii)
Question 6
Willow is creating a website.
One of the web pages includes the following JavaScript code and HTML tags.
01 <html> 02 <body> 03 <form> 04 <p id="displayQuestion"></p> 05 <input type="text" id="answer"> 06 <button id="submit" onclick="checkAnswer()"> Submit </button> 07 </form> 08 </body> 09 <script> 10 val1 = Math.floor((Math.random() * 10) + 1); 11 val2 = Math.floor((Math.random() * 10) + 1); 12 document.getElementById("displayQuestion").innerHTML = "What is" + val1.toString() + "*" + val2.toString() + "?"; 13 function checkAnswer(){ 14 userAnswer = document.getElementById("answer").value; 15 answer = val1 * val2 16 if (userAnswer == answer.toString()){ 17 alert("Correct, well done"); 18 }else{ 19 alert("Sorry that's incorrect"); 20 } 21 } 22 </script> 23 </html>
(iii)
Identify the line number of the JavaScript code that takes data the user has input and
stores it in a variable.
.....................................................................................................................................
Question 13
Why this question appears here
71% assigned-topic match · Programming › Programming basics
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_w19_qp_13.pdf
