Question 8(a) 2024 · May-June · Paper 32 · 4 marks
Question 8
Part (a)
Complete the pseudocode to find an item in a 1D array Widgets of type STRING, using a linear search. DECLARE Widgets : ARRAY[1:50000] OF STRING DECLARE TopOfList : INTEGER DECLARE EndOfList : INTEGER DECLARE Count : INTEGER DECLARE ToFind : STRING DECLARE Found : BOOLEAN DECLARE NotInList : BOOLEAN TopOfList
Question 1
EndOfList 50000 OUTPUT "Enter the name of the item you wish to find " INPUT ToFind ………………………………………………………………………………………………………………………………… NotInList FALSE Count TopOfList WHILE …………………………………………………………… AND ……………………………………………………………………… IF ……………………………………………………………………………………………………………………………… THEN Found TRUE ENDIF Count Count + 1 IF …………………………………………………………………………………………………………………………… THEN NotInList TRUE ENDIF ENDWHILE IF Found = TRUE THEN OUTPUT "Item found at position ", Count - 1, " in array" ELSE OUTPUT "Item not in array" ENDIF
Why this question appears here
82% assigned-topic match · Data types and structures › Data types and records
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9618_s24_qp_32.pdf
