Past-paper question · 2021 May-June · Paper 12 · Q5(d)

Question 5(d) 2021 · May-June · Paper 12 · 1 mark

Original past-paper question for 5(D)
Original past-paper question for 5(D)
Original past-paper question for 5(D)
Reveal official mark-scheme answer

Official answer for Question 5

Part (d)

✓
(logical) OR

Question 1

Mark scheme 9608_s21_ms_12.pdf →

Show text version of question

Question 5

Part (d)

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 (d)

State the meaning of the || operator in line 15 of the code.

.............................................................................................................................................

[1]
Topic relevance

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

Keep practising this topic