Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CPT C07 Algorithm Design

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

To find the maximum value in a list without using max(), which algorithmic approach is correct?

a)

Start with current = 0, then compare every item

b)

Start with current = list[0], then compare and replace if larger

c)

Use sum(list) and divide by length

d)

Sort list and pick last element

2.

Which describes correctly how to calculate the average of numbers in a list without using sum()?

a)

Add… sum divided by count

b)

Multiply all and take root

c)

Use list indexing

d)

Use len() only

3.

Which of these are valid linear search steps without using index()?

a)

Iterate list with for i in range(len(list))

b)

Compare each element to target

c)

Skip iteration if target is found

d)

Return index when match found

4.

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.

5.

The technique of solving many small instances manually to identify the general steps is called (a)   .

6.

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?

a)

Sort counts descending, pick first

b)

Set best = counts[0], loop and replace if higher

c)

Use average to estimate boundary

d)

Compare only first and last entries

7.

Designing a linear search algorithm for a list of student IDs to verify attendance (stop search when found). Which steps apply?

a)

Loop over list indexes

b)

Compare element vs ID

c)

Stop loop as soon as ID found

d)

Continue scanning the entire list even if found

8.

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?

a)

Incremental design

b)

Modular decomposition

c)

Generalisation

d)

Adaptation

9.

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?

a)

Adaptation

b)

Modularity

c)

Incremental approach

d)

Dry‑run only once

10.

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?

a)

Loop through each remark and then each character position

b)

Check consecutive characters for ‘E’ then ‘X’ sequence

c)

As soon as match found within remark, increment count and stop scanning that remark

d)

Use Python’s in operator for substring detection