Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 50

Write a C# program to:

  • Check that in the first column (column 0):
    • The card value in the second row (row 1) is exactly 5 more than the card value in the first row (row 0)
    • The card value in the third row (row 2) is exactly 5 more than the card value in the second row (row 1)
  • Display Valid when the column meets both conditions above
  • Display Invalid when the column does not meet both conditions above

You must use the getCardValue 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
getCardValue(row, column)Returns the integer value of the card on the board at the position (row, column)

Figure 1 (Example Game Board - Output: Invalid)

column 0column 1column 2
row 03710
row 1852
row 212119

Figure 2 (Example Game Board - Output: Valid)

column 0column 1column 2
row 0416
row 191012
row 21438
[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