Programming Constructs and Operators: Question 5

Syllabus 8.1

Multiple choice 1 mark

A cinema's admission rule is: "A customer may watch a 12A-rated film if they are at least 12 years old, or if they are accompanied by an adult."

A program declares Age : INTEGER and AccompaniedByAdult : BOOLEAN for each customer.

Which pseudocode condition correctly represents this admission rule?

Choose an answer to check it, then compare with the worked solution below.

Show worked solution Hide worked solution

Worked solution

Step 1: Break the rule into two separate conditions

“A customer may watch the film if they are at least 12 years old, or if they are accompanied by an adult” contains two conditions joined by the word “or”:

  • Condition 1: the customer is at least 12 years old → Age >= 12
  • Condition 2: the customer is accompanied by an adult → AccompaniedByAdult (this is already a Boolean variable, so it can be used directly in a condition without needing to write = TRUE)

Because the rule only requires one of the two conditions to be true (either is enough on its own), the two conditions must be combined with OR, not AND.

Step 2: Write the combined condition

(Age >= 12) OR AccompaniedByAdult

This is true whenever the customer is 12 or older, whenever they are accompanied by an adult, or both, which exactly matches the admission rule. This is option A.

Step 3: Check the distractor conditions against the rule

  • Option B, (Age >= 12) AND AccompaniedByAdult, requires both conditions to hold at once. Under this rule, an unaccompanied 14-year-old would be wrongly refused entry, even though the stated rule alone (being at least 12) should be enough to admit them.
  • Option C, NOT(Age >= 12) OR AccompaniedByAdult, negates the age condition. This admits customers under 12 who are unaccompanied (clearly wrong), and would refuse an unaccompanied 12-year-old, since NOT(12 >= 12) is FALSE and AccompaniedByAdult is also FALSE for them.
  • Option D, (Age >= 12) OR NOT AccompaniedByAdult, negates the accompaniment condition instead. This would admit an unaccompanied young child simply because NOT AccompaniedByAdult is TRUE for them, the opposite of what the rule intends.

Final answer

  • The correct condition is (Age >= 12) OR AccompaniedByAdult, option A.