b. Test Your Knowledge
🅰️ Section A – Multiple-choice review
(1 mark each – Section A exam style)
1. Which feature of a programming language allows a value to be accessed from any function in a program?
A. Local variable
B. Constant
C. Global variable
D. Parameter
Answer
C. Global variable
2. Which control structure is most appropriate when the number of repetitions is unknown and depends on user input?
A. FOR
B. WHILE
C. SEQUENCE
D. IF
Answer
B. WHILE
3. Which operator is used to test whether two values are not equal?
A. ==
B. =
C. !=
D. <=
Answer
C. !=
4. Which of the following best describes a logic error?
A. The program crashes when dividing by zero
B. The program does not compile due to a missing bracket
C. The program runs but produces incorrect output
D. The program exceeds memory limits
Answer
C. The program runs but produces incorrect output
5. A validation rule checks that a student's age is between 12 and 18 inclusive. Which validation technique is being applied?
A. Type checking
B. Existence checking
C. Range checking
D. Format checking
Answer
C. Range checking
🅱️ Section B – Short-answer practice
(2–4 marks each – Section B style)
1. Explain why validation checks must be performed in a specific order. Name the correct order in your response.
(3 marks)
2. Identify the type of error in the following pseudocode and justify your answer.
(3 marks)
3. Describe one situation where a FOR iteration would be more appropriate than a WHILE iteration.
(2 marks)