Skip to content

Course home

Efficiency of algorithms

Efficiency of algorithms

EasyMedium
123456789
Question 4

Figure 1

Program X

num = int(input("Enter a positive integer: "))
total = 0
for count in range(1, num + 1):
    total = total + (count * 2)
print(total)

Program Y

num = int(input("Enter a positive integer: "))
total = num * (num + 1)
print(total)

Select one option to indicate which of the statements is true about the efficiency of the programs in Figure 1.

A

Both programs are equally efficient.

B

Program X is more efficient than Program Y.

C

Program Y is more efficient than Program X.

D

Program X is more efficient for small inputs, while Program Y is more efficient for large inputs.

Markscheme

Efficiency of algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Efficiency of algorithms

15 exam-style questions on AQA GCSE Computer Science Efficiency of algorithms. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank