Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 16

Write a C# program to:

  • Check that in the second column (column 1):
    • The temperature in the second row (row 1) is exactly 4 degrees lower than the temperature in the first row (row 0)
    • The temperature in the third row (row 2) is exactly 4 degrees lower than the temperature in the second row (row 1)
  • Display Stable Descent when the column meets both conditions above
  • Display Anomalous when the column does not meet both conditions above

You must use the getTemperature 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
getTemperature(row, column)Returns the integer temperature value at the specified position (row, column) on the sensor grid

Figure 1 (Example Sensor Grid - Output: Anomalous)

column 0column 1column 2
row 0152418
row 1122015
row 291812

Figure 2 (Example Sensor Grid - Output: Stable Descent)

column 0column 1column 2
row 0101822
row 181419
row 261015
[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