Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 61

A automated warehouse shelf uses a coordinate system of rows and columns. A technician wants to ensure that the weights of items loaded on the first row (row 0) are in strictly decreasing order from left to right to prevent structural tipping.

Write a Python program to:

  • Check that in the first row (row 0):
    • the weight of the item at column 1 is less than the weight of the item at column 0
    • the weight of the item at column 2 is less than the weight of the item at column 1
  • Display Safe when both conditions are met.
  • Display Unsafe when the conditions are not met.

You must use the getWeight subroutine described below in your Python code.

Subroutine

SubroutinePurpose
getWeight(row, column)Returns the weight (as an integer) of the item positioned at (row, column)

Figure 1: Example A (Unsafe layout)

column 0column 1column 2
row 0455030
row 1201510

For Example A, the program should display Unsafe (because 50 is not less than 45).

Figure 2: Example B (Safe layout)

column 0column 1column 2
row 0807050
row 1304010

For Example B, the program should display Safe (80 > 70 > 50).

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