WorksheetsCPT C07 Algorithm Design
Total questions: 10
Worksheet time: 7mins
To find the maximum value in a list without using max(), which algorithmic approach is correct?
Start with current = 0, then compare every item
Start with current = list[0], then compare and replace if larger
Use sum(list) and divide by length
Sort list and pick last element
Which describes correctly how to calculate the average of numbers in a list without using sum()?
Add… sum divided by count
Multiply all and take root
Use list indexing
Use len() only
Which of these are valid linear search steps without using index()?
Iterate list with for i in range(len(list))
Compare each element to target
Skip iteration if target is found
Return index when match found
To extract items from a list based on a condition (e.g. values > 10), you typically loop and (a) each satisfying item into a new list.
The technique of solving many small instances manually to identify the general steps is called (a) .
A school canteen tracks daily sales of items. You need to design an algorithm to find the most popular item sold without using the built‑in max function.
Which of the following is the best approach?
Sort counts descending, pick first
Set best = counts[0], loop and replace if higher
Use average to estimate boundary
Compare only first and last entries
Designing a linear search algorithm for a list of student IDs to verify attendance (stop search when found). Which steps apply?
Loop over list indexes
Compare element vs ID
Stop loop as soon as ID found
Continue scanning the entire list even if found
You are designing a function to compute class average and count number of failing students (< 40). Which design principle supports breaking it into two smaller functions—one computes average, the other counts fails?
Incremental design
Modular decomposition
Generalisation
Adaptation
When you test the average‑score function first on a small list [70, 80, 90], then gradually add boundary values like 0, 100, you are applying which approach?
Adaptation
Modularity
Incremental approach
Dry‑run only once
A dataset contains varied-length strings of student remarks (“GOOD”, “EXCELLENT”, “AVERAGE”, “POOR”). You need an algorithm to count how many remarks contain substring “EX” (e.g. “EXCELLENT”). Without using find(), in, or count(), which steps are valid?
Loop through each remark and then each character position
Check consecutive characters for ‘E’ then ‘X’ sequence
As soon as match found within remark, increment count and stop scanning that remark
Use Python’s in operator for substring detection
