nerdexam
Python_Institute

PCEP-30-02 · Question #308

How many stars will the following code print to the monitor? ``python x = 1 while x < 10: print('*') x = x << 1 ``

The correct answer is D. eight. See the full explanation below for the reasoning.

Question

How many stars will the following code print to the monitor?
x = 1
while x < 10:
 print('*')
 x = x << 1

Options

  • Atwo
  • Bone
  • Cfour
  • Deight

How the community answered

(58 responses)
  • A
    16% (9)
  • B
    3% (2)
  • C
    7% (4)
  • D
    74% (43)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice