Skip to content

Course home

Programming fundamentals

Programming fundamentals

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
Question 2

An access control system uses different types of keycards. Each card type has a specific code, as shown in the table below:

CodeCard Type
STStudent
SFStaff
VSVisitor

A program is written to update card permissions. The program:

  • asks the user to enter the card type code
  • calls the prewritten function ValidateCardType() to check whether the entered code is valid
  • if valid, asks the user to input the unique card number, combines the code and number, and calls a procedure UpdatePermission()
01  cardType = input("Enter card type code: ")
02  if (ValidateCardType(cardType)) then
03      cardNumber = input("Enter unique card number: ")
04      cardID = cardType + cardNumber
05      UpdatePermission(cardID)
06  endif

Give the line number that contains the call to the prewritten validation function.

[1]
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