logo

AQA A-Level Computer Science practice

How many times is the indented statement executed? number = 1 while number < 4: number = number * 2

Try the question first, then check the answer and practise the same topic again.

At a glance

MCQ

Type

practice

Style

Topic

Programming

Exam-style question

Try this first

How many times is the indented statement executed? number = 1 while number < 4: number = number * 2.

  1. A.1
  2. B.2
  3. C.3
  4. D.The loop never ends

Answer and explanation

Concise answer

2

Why this is correct

The loop starts with number equal to 1. The first iteration changes it to 2, and the second changes it to 4. The condition is then false, so the loop stops.

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions