Programming for the web: past paper questions
Real questions on programming for the web
The newest 20 of 106 written questions. Open one to see it on the real paper.
- 9626/31 · May/June 2026 · Q11[6]
The code displays a person’s full name (given name and family name) when it is entered into a web page. The line numbers are shown only for reference. <html> <body> <h2>This code collects a person's name and displays it</h2> <br> <br> <p id="idl"></p> <script> var a = "Your name is " const GName = prompt ("Your given n...
See it on the paper → - 9626/32 · May/June 2026 · Q1[6]
Data that is output from JavaScript code is passed to HTML so that a web browser can display it. Aweb page displays the name of a question paper in a web browser. The emboldened title of the page is created by HTML code, but the name of the question paper is output by JavaScript code and is displayed. D oO CB x | +e -«...
See it on the paper → - 9626/33 · May/June 2026 · Q9a[4]
The display property of an element can be set using the JavaScript statement: document.getElementById(id).style.display = "none" Describe how this statement is used in JavaScript to hide HTML elements.
See it on the paper → - 9626/33 · May/June 2026 · Q9b[3]
HTML elements can also be hidden using the visibility property in the JavaScript statement: document.getElementBylId(id).style.visibility = "hidden" Explain why JavaScript programmers prefer to use this statement instead of the statement given in 9(a).
See it on the paper → - 9626/13 · October/November 2025 · Q9[4]
A programmer is developing a new piece of software. The programmer has decided to write code that needs to be interpreted so that it will run. Justify the programmer’s decision.
See it on the paper → - 9626/32 · October/November 2025 · Q10a[4]
Describe how the JavaScript in this HTML code changes the display of text on the web page when a mouse button is clicked. The line numbers are included for reference only. 1 2 3 4 5 <html> <body> <h2>Cambridge International JS Code: HTML Event</h2> <h2 onclick="changeText(this)">Click on this line to see the name of th...
See it on the paper → - 9626/32 · October/November 2025 · Q10b[2]
Describe two other HTML events that can be used to trigger the execution of JavaScript code.
See it on the paper → - 9626/33 · October/November 2025 · Q7[6]
The JavaScript code in Fig. 7.1 is executed when it is loaded into a web browser. The line numbers are for reference only. <html> <body> <p id="ALP3"></p> const qp = ["A Level", "IT", "9626", "Paper", 3]; let paper = ""; for (let x in qp) { paper += qp[x] + "<BR>"; } document.getElementById("ALP3").innerHTML = paper; <...
See it on the paper → - 9626/31 · May/June 2025 · Q4a(i)[1]
++
See it on the paper → - 9626/31 · May/June 2025 · Q4a(ii)[2]
**
See it on the paper → - 9626/31 · May/June 2025 · Q4b[4]
Describe the use of two other arithmetic operators in JavaScript.
See it on the paper → - 9626/32 · May/June 2025 · Q9a[2]
Describe the purpose of comparison operators.
See it on the paper → - 9626/32 · May/June 2025 · Q9b[4]
Explain the differences in function between the === and !== comparison operators.
See it on the paper → - 9626/32 · February/March 2025 · Q1a[2]
Describe what is meant by an HTML event.
See it on the paper → - 9626/32 · February/March 2025 · Q1b(i)[1]
onmouseover()
See it on the paper → - 9626/32 · February/March 2025 · Q1b(ii)[1]
onmouseout() (ii)
See it on the paper → - 9626/32 · February/March 2025 · Q1b(iii)[1]
onload() (iii)
See it on the paper → - 9626/32 · October/November 2024 · Q1a[3]
In JavaScript, the for loop has the following syntax: for (Statement_1; Statement_2; Statement_3){ // block of code to be executed is written here } Statement_1 Statement_2 Describe the purpose of each of the three statements: Statement_3
See it on the paper → - 9626/32 · October/November 2024 · Q1b[3]
Compare the use of a for loop with a for in loop.
See it on the paper → - 9626/33 · October/November 2024 · Q1a[1]
Define the term string as used in JavaScript.
See it on the paper →
What examiners said
An HTML event is a change in a web page caused by a user or by the browser. Many learners referred to the user action but most did not correctly refer to the change in the web page. Common errors included inaccurate references to scripted dialogue boxes and alerts.
— Examiner report, February/March 2025, 9626/32 Q1(a) (Cambridge)
Good answers referred to the mouse pointer moving over or into an area of an element on a web page.
— Examiner report, February/March 2025, 9626/32 Q1(b)(i) (Cambridge)
Good answers referred to the mouse pointer moving from or out of an area of an element on a web page. A common error was to state that the event happens when the pointer is ‘not over’ the element of area. Such an answer is inaccurate as it implies that the mouse pointer could be anywhere on the screen to trigger the event. Answers must be precise in their meaning to gain credit.
— Examiner report, February/March 2025, 9626/32 Q1(b)(ii) (Cambridge)
Past papers, syllabus and examiner reports © UCLES (Cambridge University Press & Assessment). Questions are matched to topics from the official syllabus. AssessPro is independent and not endorsed by Cambridge.