logo

Question detail

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

Try the question, check the answer, then read the explanation to understand the curriculum point.

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

Model answer

What a good answer should say

  • 2

Explanation

Why this works

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.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.