Skip to content

Course home

Programming fundamentals

Programming fundamentals

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
Question 21

An automated library book-sorting system uses different hardware components. Each type of component has an identifier code as shown in the table:

CodeComponent
RFRFID Reader
BSBook Scanner
SGSorting Gate

A program is written to initialize and route books through these components. The program:

  • Prompts the operator to enter the code of the component they want to initialize.
  • Calls the prewritten function VerifyReaderCode() to check whether the entered code is valid.
  • Reads a target shelf identifier as input if the code is valid.
  • Calls the procedure AssignBookToShelf() using a combined assignment key.
01  readerCode = input("Enter reader code to initialize")
02  if (VerifyReaderCode(readerCode)) then
03      shelfNumber = input("Enter target shelf identifier")
04      assignmentKey = readerCode + shelfNumber
05      AssignBookToShelf(assignmentKey)
06  endif

Give the identifier of a variable used in the program.

[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