Year 11 Computer Science - 24.25 - T4.1 AP1 - Problem Solving and Algorithms
Year 11 Computer Science - 24.25 - T4.1 AP1 - Problem Solving and Algorithms
(a) Using the correct symbols, draw a flowchart that takes a number as input and prints
whether the number is odd or even.
(a) Explain the difference between a linear search and a binary search.
In a binary search you will need a data that is sorted, however in a linear data
You don’t reqayer that
(b) State which search algorithm is more efficient for a sorted list and explain why.
The following pseudocode takes a list of numbers as input and sorts them using the
bubble sort algorithm:
css
Copy code
for i = 0 to length(list) - 1
for j = 0 to length(list) - i - 1
if list[j] > list[j + 1] then
swap list[j] and list[j + 1]
end if
next j
next i
A school wants to create a program that calculates the average test score for a class of
students.
(a) Write a written description algorithm to show this. The program should:
Input=number
Print(“ please enter the number you want to
add”)
Output=the answer
(b) Modify the algorithm to also find and print the highest score.
Identifying Errors in Algorithms: (6 marks)
The following pseudocode is intended to calculate the factorial of a number, but it contains
an error:
css
Copy code
factorial = 1
for i = 1 to n do
factorial = factorial + i
next i
Algorithm Optimisation
You are given the following algorithm that finds the sum of all even numbers in a list:
typescript
Copy code
total = 0
for each number in list
if number mod 2 = 0 then
total = total + number
end if
next number
(a) Suggest a way to optimise (make better) this algorithm to improve its performance.
A cinema needs a system to allocate seats to customers based on their booking. The system
should prevent double-booking of any seat.
(a) Describe how you would decompose this problem into smaller, manageable tasks.
(b) Write a planning of a code for the system that allows customers to: book seats,
checks seat availability, and prevents double-booking.
A student wrote an algorithm to find the average temperature over 7 days, but the
algorithm keeps producing incorrect results.
(b) Describe two different types of tests you could perform to ensure the program works
correctly.