Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 12

Write a C# program to help control a warehouse cleaning robot.

The program should:

  • get the user to enter the row number of a cell to clean
  • get the user to enter the column number of a cell to clean
  • check if the cell in the position entered is next to the robot
    • if it is, clean the spill at that position
    • if it is not, output Cannot clean this cell
  • repeat these steps until the warehouse is clean.

You must use the subroutines described in the tables below.

Subroutine Table 1

SubroutinePurpose
isWarehouseClean()Returns true if all spills have been cleaned. Otherwise, returns false.
isSpillNextToRobot(row, column)Returns true if the cell at (row, column) is next to the robot. Otherwise, returns false.

Subroutine Table 2

SubroutinePurpose
cleanSpill(row, column)Moves the robot to (row, column) and cleans the spill, if that cell is next to the robot.

You should use meaningful variable name(s) and C# syntax in your answer.

[6]
Markscheme

Structured programming and subroutines (procedures and functions) Questions

  1. GCSE
  2. /Computer Science
  3. /Structured programming and subroutines (procedures and functions)

131 exam-style questions on AQA GCSE Computer Science Structured programming and subroutines (procedures and functions). Each one has a worked solution and a mark scheme showing where the marks go.

Question bank