Skip to content

Course home

Boolean operations in a programming language

Boolean operations in a programming language

EasyMedium
123456789101112131415161718
Question 9

An algorithm is designed to calculate loyalty discounts for customers at a retail store, based on their age and number of years of membership.

Figure 1

customerAge ← USERINPUT
membershipYears ← USERINPUT
discountAmount ← 0.0
msgIneligible ← "Does not meet requirements"
msgTooYoung ← "Age limit not reached"
IF customerAge >= 18 AND membershipYears > 0 THEN
    IF membershipYears > 5 THEN
        discountAmount ← 20.0
        OUTPUT discountAmount
    ELSE IF membershipYears > 2 THEN
        discountAmount ← 10.0
        OUTPUT discountAmount
    ELSE
        OUTPUT msgIneligible
    ENDIF
ELSE
    OUTPUT msgTooYoung
ENDIF

State how many possible values the result of the comparison customerAge >= 18 could evaluate to in the algorithm shown in Figure 1.

[1]
Markscheme

Boolean operations in a programming language Questions

  1. GCSE
  2. /Computer Science
  3. /Boolean operations in a programming language

19 exam-style questions on AQA GCSE Computer Science Boolean operations in a programming language. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank