Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 43

Write a C# program to help control an autonomous asteroid-mining probe.

The program should:

  • get the user to enter the sector number of a target
  • get the user to enter the depth in meters of a target
  • check if the target coordinates are within the drilling arm's reach
    • if it is, extract the core at that position
    • if it is not, output Target out of range
  • repeat these steps until the mining operation is finished.

You must use the subroutines described in the tables below.

Subroutine Table 1

SubroutinePurpose
isMiningFinished()Returns true if all required mineral cores have been extracted. Otherwise, returns false.
isTargetInRange(sector, depth)Returns true if the coordinates (sector, depth) are within the drilling arm's reach. Otherwise, returns false.

Subroutine Table 2

SubroutinePurpose
extractCore(sector, depth)Deploys the drill to (sector, depth) and extracts the mineral core, if the location is within reach.

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

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