Question 9 2017 · May-June · Paper 32 · 8 marks
Reveal official mark-scheme answer
Official answer for Question 9
Question 8
Show text version of question
Question 9
JavaScript is a programming language used in webpages.
Fig. 2 shows a table created with JavaScript in a webpage.
1 2 3 4 5 6 7 8 9 10
Fig. 2
The code that created the table is shown below:
<html> <body> <script language="javascript"> var tableout; tableout = "<table border='1' width='300' cellspacing='0' cellpadding='3'>" for (b = 1; b <= 10; b++) { tableout = tableout + "<tr>"; for (g = 1; g <= 10; g++) { tableout = tableout + "<td>" + b * g + "</td>"; } tableout = tableout + "</tr>"; } tableout = tableout + "</table>"; document.write (tableout); </script> </body> </html>
Question 15
Explain how the loops in the code create the table.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
......................................................................................................................................................[8]
Question 16
Why this question appears here
98% assigned-topic match · Programming for the web
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 9626_s17_qp_32.pdf
