Skip to content

Course home

Algorithms

Algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
Question 57

A computer science student has written a block of pseudocode to find the minimum atmospheric pressure recorded during a weather balloon flight from an array of 6 sensor readings.

1  pressures = [1013, 998, 985, 1002, 991, 1007]
2  lowest = pressures
3  idx = 1
4  WHILE idx <= 6
5      IF pressures[idx] < lowest THEN
6          pressures[idx] = lowest
7      ENDIF
8      idx = idx + 1
9  ENDWHILE
10 OUTPUT "Lowest pressure: " + lowest

Line 4 and Line 6 contain errors.

Identify the error in each line and construct new lines of pseudocode that will correct the errors.

Line NumberErrorCorrection
Line 4
Line 6
[4]
Markscheme

Algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Algorithms

159 exam-style questions on Edexcel GCSE Computer Science Algorithms, covering Constructs for solving problems, Variables, constants and data structures, Arithmetic, relational and logical operators, Tracing algorithm output with trace tables, Types of error and correcting logic errors, Standard algorithms (sorts and searches), and Evaluating algorithm fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank