Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 11

An automated deep-sea research probe measures water salinity levels across different depths and horizontal offsets using a 2D coordinate grid of rows and columns. A marine biologist wants to check if the salinity levels in the deepest segment (row 3) are strictly increasing from left to right to confirm the presence of a hydrothermal updraft.

Write a Python program to:

  • Check that in row 3:
    • the salinity level at column 1 is strictly greater than the salinity level at column 0
    • the salinity level at column 2 is strictly greater than the salinity level at column 1
  • Display Updraft when both conditions are met.
  • Display No Updraft when the conditions are not met.

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

Subroutine

SubroutinePurpose
getSalinity(row, column)Returns the salinity level (as an integer) of the water positioned at (row, column)

Figure 1: Example A (No Updraft)

column 0column 1column 2
row 3353238
row 4303132

For Example A, the program should display No Updraft (because 32 is not greater than 35).

Figure 2: Example B (Updraft)

column 0column 1column 2
row 3343639
row 4313233

For Example B, the program should display Updraft (since 34 < 36 < 39).

[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