The food-delivery program checks a discount voucher before the order is confirmed. A voucher is valid when the customer is new, or when the order total is a...

Assessment: Computer Science 9210 | Paper 1 Mock 01 | Programming (on-screen) Subject: Computer Science - 9210

Question 1 Report

The food-delivery program checks a discount voucher before the order is confirmed. A voucher is valid when the customer is new, or when the order total is at least 30 pounds and the customer has entered a loyalty code. The comparisons and input check return Boolean values. The programmer proposes validVoucher = newCustomer OR (largeOrder AND loyaltyCode). A test user is not new, has a large order, and has entered no loyalty code. Another user is new with a small order and no code.

(a) Explain why the large-order and loyalty-code tests are joined by AND. [2]
(b) When the first test user has values False, True, False, state the value of validVoucher. [1]
(c) When the second user has values True, False, False, state the value of validVoucher. [1]
(d) Explain one reason for using brackets in this statement. [2]

Answer Details

The condition is newCustomer OR (largeOrder AND loyaltyCode). AND requires both inputs to be True; OR requires at least one input to be True.

  1. (a) A returning customer must have a large order. [1] They must also have entered a loyalty code. [1] Therefore these two checks are joined by AND.
  2. (b) For False, True, False: largeOrder AND loyaltyCode is False, and False OR False is False. [1]
  3. (c) For True, False, False: the new-customer condition is already True, so True OR (...) is True. [1]
  4. (d) The brackets group largeOrder AND loyaltyCode into one condition. [1] That grouped result is then combined with newCustomer using OR, making the intended logic clear. [1]

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning