Skip to content

Course home

Programming fundamentals

Programming fundamentals

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
Question 54

A hotel booking system handles room registrations across different blocks. Each block has a distinct code prefix, as shown in the table:

PrefixBlock Name
EXExecutive Suite
DEDeluxe Wing
STStandard Wing

A program is used to reserve a room. The program:

  • asks the user to enter the block prefix
  • checks if the prefix is valid using the function VerifyPrefix()
  • if the prefix is valid, it asks for the room number
  • it combines the prefix and room number to create a unique room code
  • calls the ReserveRoom() procedure
01  blockCode = input("Enter block prefix: ")
02  isValid = VerifyPrefix(blockCode)
03  if isValid == true then
04      roomNum = input("Enter room number: ")
05      roomCode = blockCode + roomNum
06      ReserveRoom(roomCode)
07  endif

Give the line number where concatenation is used.

[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