Skip to content

Course home

Boolean logic

Boolean logic

EasyMedium
123456789101112131415161718192021222324
Question 4

An algorithm, represented using pseudo-code, is used to calculate gym membership fees based on age and tier.

Figure 1

memberAge ← USERINPUT
membershipType ← USERINPUT
monthlyFee ← 0.0
errMessageOne ← "Must be over 12"
errMessageTwo ← "Invalid membership tier"
IF memberAge > 12 AND membershipType != "None" THEN
    IF membershipType == "Premium" THEN
        monthlyFee ← 45.0
        OUTPUT monthlyFee
    ELSE IF membershipType == "Standard" THEN
        monthlyFee ← 30.0
        OUTPUT monthlyFee
    ELSE
        OUTPUT errMessageTwo
    ENDIF
ELSE
    OUTPUT errMessageOne
ENDIF

State how many possible values the result of the comparison memberAge > 12 could have in the algorithm shown in Figure 1.

[1]
Markscheme

Boolean logic Questions

  1. GCSE
  2. /Computer Science
  3. /Boolean logic

30 exam-style questions on AQA GCSE Computer Science Boolean logic. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank