Here is the pseudo-code for an algorithm that determines the classification of an item - Edexcel - GCSE Computer Science - Question 4 - 2018 - Paper 1
Question 4
Here is the pseudo-code for an algorithm that determines the classification of an item.
SET maxWeights TO [0, 100, 750, 2000, 20000]
SET typeItem TO ["Too small", "... show full transcript
Worked Solution & Example Answer:Here is the pseudo-code for an algorithm that determines the classification of an item - Edexcel - GCSE Computer Science - Question 4 - 2018 - Paper 1
Step 1
State the name for this type of error.
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Logic error.
Step 2
Identify the error in Line 11 and reconstruct pseudo-code.
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The loop never executes because 'found' is initialized to False.
Corrected line: WHILE (found == False) DO.
Step 3
Identify the error in Line 18 and reconstruct pseudo-code.
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
It prints the wrong item type. It prints the item to the right of the correct one.
Corrected line: SEND typeItem[i] TO DISPLAY.