Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
Question 52

A marine research agency is operating an autonomous deep-sea drone navigating through depth sectors of an ocean trench represented as an array.

Figure 1: Example trench array

Index0123456789
ContentVV

Figure 2: Navigation Rules

  • The drone begins at index 0 of the trench array.
  • The goal is to reach the seabed, which is the final index of the array (target_depth).
  • At each step, the operator is prompted to enter a descent step value: 1, 2, 3, or 4.
    • The drone's depth position is increased by the inputted step value.
  • If the drone's new depth exceeds the final index of the array, or lands on an index containing the hydrothermal vent character 'V':
    • The message "System overheat! Returning to surface." is displayed.
    • The drone's depth position is reset to 0.
  • These steps repeat until the drone successfully reaches (or lands exactly on) the final depth index of the array.

Figure 3: Starting Code

depth = 0
target_depth = len(trench) - 1
while depth < target_depth:

Extend the program from Figure 3 so that the navigation simulation works as described in the rules in Figure 2.

When writing your program, you should assume:

  • There is an existing array called trench.
  • The number of 'V' characters in trench can vary.
  • The positions of the 'V' characters in trench can vary.
  • The 'V' characters have already been initialized in the array.
  • The trench array can be of any length greater than 1.

You should use meaningful variable names and correct programming syntax in your answer.

[8]
Markscheme

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts

298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank