A programmer is writing an algorithm to search through a collection of books to find the one with the highest page count.
RECORD Book
title : String
author : String
pages : Integer
isHardback : Boolean
ENDRECORD
book1 ← Book('Neuromancer', 'Gibson', 271, False)
book2 ← Book('Snow Crash', 'Stephenson', 470, False)
book3 ← Book('Foundation', 'Asimov', 255, True)
book4 ← Book('Hyperion', 'Simmons', 482, True)
library ← [book1, book2, book3, book4]
maxPages ← 0
indexFound ← 0
FOR i ← 0 TO L_LIMIT
IF library[i].pages > maxPages THEN
maxPages ← library[i].pages
indexFound ← i
ENDIF
ENDFOR
OUTPUT library[indexFound].title, ' has the most pages.'
What should the label L_LIMIT in the algorithm be replaced by?
444
LEN(library)\text{LEN}(\text{library})LEN(library)
LEN(library)−1\text{LEN}(\text{library}) - 1LEN(library)−1
maxPages\text{maxPages}maxPages
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.