Skip to content

Course home

Efficiency of algorithms

Efficiency of algorithms

EasyMedium
123456
Question 4

Program X

print("Enter positive number: ")
num = int(input())
while num >= 2:
    num = num - 2
if num == 0:
    print("Even")
else:
    print("Odd")

Program Y

print("Enter positive number: ")
num = int(input())
if num % 2 == 0:
    print("Even")
else:
    print("Odd")

State which of the two programs is more time-efficient when checking very large integers, and justify your choice.

[2]
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