ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions

Higher Computing Science 2024 Question 4

4 marks · Standard algorithms

An array surnames contains a list of surnames. Using a design technique of your choice, design an algorithm to find the number of characters in the longest surname.

Marking scheme

• Initialise maxLength to 0/length of first surname/position = 0 • Loop until the end of surnames • If length of current surname>maxLength/name at max position then • Set maxLength to length of current surname/maxposition to current position

Previous question: Higher Computing Science 2024 Question 3

Next question: Higher Computing Science 2024 Question 5