Question 5(f) 2021 · May-June · Paper 12 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (f)
Question 1
mark for each correct letter/statement in each space
Question 4
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Show text version of question
Question 5
Part (f)
Question 5
A web page includes HTML and JavaScript code.
01 <html> 02 <body> 03 04 Calculate area of a triangle: 05 <form name = "Triangle"> 06 <p>Base <input type = "number" name = "B" value = ""></p> 07 <p>Height <input type = "number" name = "H" value = ""></p> 08 <button onclick = "area()">Calculate</button> 09 </form>
Question 10
11 <script> 12 function area() { 13 var base = document.forms["Triangle"]["B"].value; 14 var height = document.forms["Triangle"]["H"].value; 15 if (base == "" || height == "") { 16 alert("Both values must be entered"); 17 return false; 18 } 19 else { 20 area = 0.5 * height * base; 21 alert("The area is: " + area); 22 } 23 } 24 </script> 25 </body> 26 </html>
Part (f)
Bochen visits the Cambridge International Holidays website to book a holiday.
The sequence (1 to 8) below describes the steps that take place when he submits a booking.
Four of the statements A, B, C, D, E and F are used to complete the sequence.
PHP code is executed to generate a confirmation (HTML) web page that is returned to C the client’s web browser.
JavaScript code is executed to generate a confirmation (HTML) web page that is E returned to the client’s web browser. F JavaScript code is executed on the client’s web browser to validate the form data.
Write one of the letters (A, B, C, D, E or F) in the appropriate row to complete the sequence.
1 Bochen completes the online booking and clicks ‘Submit’.
2 .........................
3 Any errors found are flagged, and step 1 is repeated.
4 .........................
5 PHP code is executed to perform extra data validation checks on the form data.
6 .........................
7 The booking details are added to the database.
8 .........................
Question 13
Why this question appears here
71% assigned-topic match · Hardware › Logic gates and logic circuits
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_s21_qp_12.pdf
