Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 24

Write a C# program to:

  • Check that in the third column (column 2):
    • The pressure sensor reading in the second row (row 1) is exactly 8 units lower than the reading in the first row (row 0)
    • The pressure sensor reading in the third row (row 2) is exactly 8 units lower than the reading in the second row (row 1)
  • Display Stable when the column meets both conditions above
  • Display Unstable when the column does not meet both conditions above

You must use the getPressure subroutine detailed in Table 1 below in your C# code.

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

Table 1: Subroutine Description

SubroutinePurpose
getPressure(row, column)Returns the integer value of the pressure sensor on the monitoring grid at position (row, column)

Figure 1 (Example Sensor Grid - Output: Unstable)

column 0column 1column 2
row 01009580
row 1908572
row 2807560

Figure 2 (Example Sensor Grid - Output: Stable)

column 0column 1column 2
row 0451050
row 1401542
row 2352034
[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