Skip to content

Course home

Programming fundamentals

Programming fundamentals

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
Question 27

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]
Markscheme

Programming fundamentals Questions

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

95 exam-style questions on OCR GCSE Computer Science Programming fundamentals. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank