ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions
2 marks · Standard algorithms
An online company uses a computer program to display particular customer records. The algorithm of this program is shown below. Line 1 SET found TO false Line 2 RECEIVE search_name FROM (STRING) KEYBOARD Line 3 FOR counter FROM 0 TO <End Of List> DO Line 4 IF name[counter] = search_name THEN Line 5 SET found TO true Line 6 SEND name[counter] & counter TO DISPLAY Line 7 END IF Line 8 END FOR Line 9 IF found = false THEN Line 10 SEND “Name not found” TO DISPLAY Line 11 END IF The following data is stored in the name array: Jimmy, Samina, Kate, Jimmy, Adam State the output from the above program if Jimmy is entered at line 2 from the keyboard.
Jimmy 0 Jimmy 3 1 mark for Jimmy output twice Or 1 mark for Jimmy 0 Or 1 mark for Jimmy 3 2 marks for full correct answer If Jimmy is stated twice and the index values are incorrect award 1 mark only.
Previous question: Higher Computing Science 2015 Question 2 (CfE)
Next question: Higher Computing Science 2015 Question 4 (CfE)