10Easy
0/1

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]

Boolean operations in a programming language Questions

Practise AQA GCSE Computer Science Boolean operations in a programming language with exam-style questions for GCSE Computer Science. 19 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Boolean operations in a programming language Questions

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