Cambridge International AS Level · Computer Science (9618)

Algorithm Design and Problem-solving: Practice Questions

5 multiple-choice questions marked as you go, and 5 written questions with worked solutions. All on Algorithm Design and Problem-solving.

10 questions25 marksFree, no account
Question 1
1 mark

A programmer needs to document an algorithm that calculates the area of a circle. The requirements are:
1. Input the radius (\(r\)).
2. Check if \(r\) is greater than 0.
3. If valid, calculate \(Area = 3.14159 \times r^{2}\).
4. Output the result.

Which tool uses standard geometric symbols such as parallelograms for input/output and diamonds for decisions to represent this logic?

Question 2
1 mark

Study the following pseudocode snippet:

Total ← 0
FOR i ← 1 TO 5
  INPUT Value
  IF Value > 10 THEN
    Total ← Total + 1
  ENDIF
NEXT i


If the input values are 5, 12, 10, 15, and 8, what will be the final value of Total?

Question 3
1 mark

Consider the following pseudocode intended to find the smallest value in an array List with indices from 1 to 10:

Min ← List[1]
FOR Index ← 2 TO 10
  IF List[Index] < Min THEN
    Min ← List[Index]
  ENDIF
NEXT Index


If List contains the values [40, 30, 50, 20, 20, 10, 60, 5, 80, 100], how many times will the assignment Min ← List[Index] be executed?

Question 4
1 mark

An algorithm is being developed using stepwise refinement. Which of the following best describes this process?

Question 5
1 mark

A programmer is designing an algorithm to process a list of 500 employee names stored in a 1D array. The names are currently unsorted. The goal is to find the position of a specific name, "Zackary", within the array.

Which search algorithm must be used in this scenario, and what is the maximum number of comparisons required to determine if the name is not in the list?

Question 6
2 marks

In the context of Algorithm Design and Problem-solving, identify the computational thinking technique that involves hiding unnecessary details to focus on the essential characteristics required for a specific purpose.

Write your answer out first, then check it against the worked solution.

Question 7
3 marks

Consider the following pseudocode snippet that performs a linear search on an array Data[1:5] containing the values [12, 7, 25, 14, 9]:

Found ← FALSE
Index ← 1
WHILE Index <= 5 AND NOT Found
  IF Data[Index] = 14 THEN
    Found ← TRUE
  ELSE
    Index ← Index + 1
  ENDIF
ENDWHILE


What is the final value of Index when the loop terminates?

Write your answer out first, then check it against the worked solution.

Question 8
5 marks

A linked list is implemented using a 1D array of records. The list contains three nodes with StartPointer = 2:
- List[1]: Data = "Cat", NextPointer = -1
- List[2]: Data = "Apple", NextPointer = 3
- List[3]: Data = "Banana", NextPointer = 1

What is the third data value accessed when traversing the linked list from the start pointer?

Write your answer out first, then check it against the worked solution.

Question 9
6 marks

A software developer is creating a computerized model of a city's public transport system. During the design phase, the developer applies abstraction and decomposition.

(a) Explain the purpose of abstraction when creating this model. (2 points)

(b) Suggest two details that would be essential to include in the model and two details that could be ignored through abstraction. (2 points)

(c) The task "Calculate Journey Time" needs to be broken down. Use decomposition to identify two sub-tasks that would be required to calculate the total travel time between two bus stops. (2 points)

Write your answer out first, then check it against the worked solution.

Question 10
4 marks

Consider the following pseudocode function:


FUNCTION CalculateScore(Data[1:4] : INTEGER) RETURNS INTEGER
  DECLARE Result : INTEGER
  Result ← 0
  FOR i ← 1 TO 4
    IF Data[i] MOD 2 <> 0 THEN
      Result ← Result + (Data[i] * 2)
    ELSE
      Result ← Result + (Data[i] DIV 2)
    ENDIF
  NEXT i
  RETURN Result
ENDFUNCTION


If the array passed to the function contains the values [3, 8, 5, 4], what is the value returned by the function?

Write your answer out first, then check it against the worked solution.

* The content provided by thinka is generated by AI and may not always be accurate or up-to-date. Please use it as a supplementary resource and verify with official materials.

You've seen the model answer. Now get yours marked.

This page can show you how a good answer looks. It cannot tell you what your answer was missing. thinka marks your written work against the real mark scheme in about 15 seconds.

Want more questions like these? Get a fresh set on this topic, marked as you go.

Practise More