Skip to content

Course home

Algorithms

Algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
Question 13

An algorithm is used to calculate the rental price of an electric bicycle based on the number of hours rented.

10 SEND "Welcome to E-Bike Rentals" TO DISPLAY
11 SEND "How many hours do you want to rent?" TO DISPLAY
12 RECEIVE hours FROM (INTEGER) KEYBOARD
13 SEND "Pricing for " & hours & " hour(s)" TO DISPLAY
14
15 IF (hours > 8) THEN
16     SET price TO 40 + (5 * (hours - 8))
17 ELSE
18     IF (hours > 5) THEN
19         SET price TO 40
20     ELSE
21         IF (hours > 2) THEN
22             SET price TO 30
23         ELSE
24             SET price TO 15
25         END IF
26     END IF
27 END IF
28
29 SEND "Total: £" & price TO DISPLAY

Complete the table to show the final output displayed by line 29 of the algorithm for each given input.

InputOutput
10
1
6
[3]
Markscheme

Algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Algorithms

159 exam-style questions on Edexcel GCSE Computer Science Algorithms, covering Constructs for solving problems, Variables, constants and data structures, Arithmetic, relational and logical operators, Tracing algorithm output with trace tables, Types of error and correcting logic errors, Standard algorithms (sorts and searches), and Evaluating algorithm fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank