Programming fundamentals
51
0/2

A secure access control system at a biological research facility regulates entry based on clearance levels. The clearance codes are defined in the table below:

CodeClearance Level
L1General Lab Area
L2Restricted Bio-hazard
L3High-Containment Suite

A program is written to process access requests at the security gate. The program:

  • Asks the researcher to input their clearance code.
  • Calls a prewritten function ValidateClearance() to verify if the entered code is valid.
  • If the code is valid, the researcher is prompted to input their alphanumeric employee ID, which is concatenated with the clearance code to form a unique access token, and the function GrantAccess() is called.
01 clearanceLevel = input("Enter clearance code:")
02 if ValidateClearance(clearanceLevel) then
03     employeeID = input("Enter employee ID:")
04     accessToken = clearanceLevel + employeeID
05     GrantAccess(accessToken)
06 endif

Identify two programming constructs that have been used in the program above.

[2]

Programming fundamentals Questions

Practise OCR GCSE Computer Science Programming fundamentals with exam-style questions for GCSE Computer Science. 100 questions, matched to the OCR GCSE Computer Science (J277) specification and written in Component 01 and Component 02 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

Programming fundamentals Questions

  1. GCSE
  2. /Computer Science
  3. /Programming fundamentals