nerdexam
Python_Institute

PCEP-30-02 · Question #295

What will happen when you attempt to run the following code? ``python 1 while True: 2 print("1") ``

The correct answer is A. The program will not run due to syntax error. See the full explanation below for the reasoning.

Question

What will happen when you attempt to run the following code?
1 while True:
2 print("1")

Options

  • AThe program will not run due to syntax error.
  • BThe program will run and cause an error.
  • CThe program will fall into infinite loop, printing 1 on each line.
  • DThe program will print 1 on one line only.

How the community answered

(60 responses)
  • A
    73% (44)
  • B
    8% (5)
  • C
    3% (2)
  • D
    15% (9)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice