Skip to content

Course home

Efficiency of algorithms

Efficiency of algorithms

EasyMedium
123456789
Question 9

Figure 1

Program X

limit = int(input("Enter a value: "))
sum_even = 0
counter = 1
while counter <= limit:
    sum_even = sum_even + (counter * 2)
    counter = counter + 1
print(sum_even)

Program Y

limit = int(input("Enter a value: "))
sum_even = limit * (limit + 1)
print(sum_even)

Select one option to indicate which of the statements is true about 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

The efficiency of the programs cannot be compared without knowing the value of limit.

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