Study notes
No notes have been generated for this topic yet. Open the topic page online and click Generate notes first.
Past exam questions (12)
2022 · Part A · Q12(b) · p.10
What number square will the player finish on when they follow these instructions? [Table: Instructions for a game. Columns: 'Instruction', 'Explanation'. Rows: 'Step Forward' (Step forward one square), 'Turn Right' (Rotate 90 degrees to the right), 'Turn Left' (Rotate 90 degrees to the left). [Diagram: A 3x3 grid of numbered squares, labelled 1 to 9. A 'Start' arrow points to square 1.] [Pseudocode: Repeat 2 times: {Step Forward}, Repeat 3 times: {Turn Right, Step Forward}]
2022 · Part A · Q12(a) · p.10
What number square will the player finish on when they follow these instructions? [Table: Instructions for a game. Columns: 'Instruction', 'Explanation'. Rows: 'Step Forward' (Step forward one square), 'Turn Right' (Rotate 90 degrees to the right), 'Turn Left' (Rotate 90 degrees to the left). [Diagram: A 3x3 grid of numbered squares, labelled 1 to 9. A 'Start' arrow points to square 1.] [Pseudocode: Step Forward, Turn Right, Repeat 2 times: {Step Forward}]
2022 · Part A · Q14(c) · p.16
Using either pseudocode or a flowchart, design the algorithm to solve the problem for the school principal.
2022 · Part A · Q6(b) · p.6
This game will end after the user makes one guess. Suggest an improvement to the algorithm. [Flowchart: Start, Number = Random number between 1 and 10, Guess = user input, Decision: Guess = Number?, If true: Print "Correct", End. If false: Decision A, If true: Print "Too Low". If false: Print "Too High".] [Visual aid: flowchart for a number guessing game]
2021 · Part A · Q10(b) · p.8
The linear search algorithm shown below is to be applied to the following data set: L = [10, 25, 21, 15, 85, 69, 74, 22, 19, 6] Linear Search (List L, Value x) Step 1: Set i to 0 Step 2: Set n to number of items in L Step 3: if i >= n then go to Step 8 Step 4: if L[i] = x then go to Step 7 Step 5: Set i to i + 1 Step 6: Go to Step 3 Step 7: Print position i and go to Step 9 Step 8: Print “item not found” Step 9: Exit What is the output of this algorithm when you are searching for the following values of x? (b) x = 3 [Visual aid: Description of a linear search algorithm]
2021 · Part A · Q10(a) · p.8
The linear search algorithm shown below is to be applied to the following data set: L = [10, 25, 21, 15, 85, 69, 74, 22, 19, 6] Linear Search (List L, Value x) Step 1: Set i to 0 Step 2: Set n to number of items in L Step 3: if i >= n then go to Step 8 Step 4: if L[i] = x then go to Step 7 Step 5: Set i to i + 1 Step 6: Go to Step 3 Step 7: Print position i and go to Step 9 Step 8: Print “item not found” Step 9: Exit What is the output of this algorithm when you are searching for the following values of x? (a) x = 21 [Visual aid: Description of a linear search algorithm]
2021 · Part A · Q14(b)(ii) · p.15
A list contains 60 numbers in numerical order. Calculate the maximum number of steps that may be required to find a particular number when using a binary search.
2021 · Part A · Q14(b)(i) · p.15
Illustrate the steps taken to find the number 8. [List: A numbered list from 1 to 12.] [Visual aid: Numbered list of integers]
2021 · Part A · Q14(a)(iii) · p.14
The following list of numbers is to be searched for a specific number using the binary search algorithm. L = [45, 22, 1, 56, 35, 165, 9, 18, 37, 21, 107, 11, 87] Will the binary search algorithm work on this list? Explain your answer.
2021 · Part A · Q14(a)(ii) · p.14
Why is the binary search algorithm considered to be more efficient than the linear search algorithm?
2021 · Part A · Q14(a)(i) · p.14
The binary search algorithm is often called a "divide and conquer" algorithm. Explain why.
2021 · Part A · Q8 · p.6
What output is produced by the algorithm shown in the flowchart below? [Flowchart: Start -> x = 10 -> Decision: x < 5? (True/False) -> If True: Stop. If False: x = x - 1 -> Go to Decision. -> If False from Decision: Print x -> Stop.] [Visual aid: Flowchart of an algorithm]