Cambridge International A Level · Computer Science (9618)

Computational thinking and Problem-solving: Practice Questions

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

7 questions21 marksFree, no account
Question 1
1 mark

Which of the following is a necessary condition that must be met before a binary search algorithm can be used on a list of data items?

Question 2
1 mark

Consider the following recursive pseudocode function:

FUNCTION Calculate(n)
    IF n = 1 THEN
        RETURN 1
    ELSE
        RETURN n + Calculate(n - 1)
    END IF
END FUNCTION

What is the value returned by Calculate(4)?

Question 3
2 marks

State the Big O time complexity for finding a specific item in a sorted array containing \(n\) elements using binary search.

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

Question 4
3 marks

A programmer uses a stack Abstract Data Type (ADT) to support undo functionality. Explain why a stack is the most suitable data structure for this purpose.

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

Question 5
5 marks

Explain the role of the call stack during the execution of a recursive function, specifically stating what is stored during recursive calls and what occurs during the unwinding phase.

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

Question 6
4 marks

(a) Stepwise refinement is a key technique in computational thinking. Explain the purpose of using stepwise refinement when designing a complex computer program.

(b) A programmer is designing an algorithm to calculate the total price of a customer's order. The algorithm takes the Unit Price and the Quantity of an item as input, calculates the Subtotal, applies a 10% discount if the Subtotal is over \( 100 \), and then outputs the Final Total.

Complete the following identifier table for this algorithm by providing the data types and descriptions for the four variables mentioned.

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

Question 7
5 marks

A 1D array, MyList, contains 100 integer elements. A programmer needs to design an algorithm to search for a specific value, SearchValue, within this array.

(a) Write pseudocode for a linear search algorithm to find SearchValue in MyList. If the value is found, output its index position; otherwise, output a message stating the value was not found.

(b) Explain one reason why a linear search would be chosen over a binary search for this specific array.

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, graded as you go.

Practice More