Edexcel IGCSEComputer ScienceGeneral Applications7 Marks
A developer is writing an algorithm to find the largest number in a list of 10 positive integers.
- (a)Identify a suitable data structure to store the 10 positive integers.[1]
- (b)Write pseudocode for an algorithm that takes a list of 10 positive integers as input and outputs the largest number found in the list.[6]
Mark scheme
Marking points from the official mark scheme. The mark or mark type is shown in brackets.
- **(a)**
- B1 for Array / List
- **(b)**
- C1 for initialising a variable for the largest number (e.g., to the first element or 0 if all positive)
- C1 for correctly looping through the list of 10 numbers (e.g. FOR loop 1 to 10 / WHILE loop)
- C1 for using a conditional statement (IF statement) inside the loop
- C1 for comparing current number with stored largest number
- C1 for updating the largest number variable if a larger number is found
- C1 for outputting the largest number after the loop terminates
- Accept variations in pseudocode syntax as long as the logic is clear and correct.
- Example Pseudocode:
- LIST_OF_NUMBERS = [num1, num2, ..., num10] // Assume input/populated list
- LARGEST = LIST_OF_NUMBERS[0] // Or 0 if guaranteed positive
- FOR EACH NUMBER IN LIST_OF_NUMBERS
- IF NUMBER > LARGEST THEN
- LARGEST = NUMBER
- END IF
- NEXT NUMBER
- OUTPUT LARGEST
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →