Machine-translated by Google. Questions are authored in English.
Top

Discussion

The following code ‘for(;;)’ represents an infinite loop. Which statement exits the loop itself?

  • A.break
  • B.exit(0)
  • C.abort()
  • D.All of the mentioned

Answer: A

Correct answer: break

break is the statement that ends the loop: control passes to the statement after it and the program carries on. exit(0) and abort() would also stop the loop running, but only by ending the whole program, which is a different thing from leaving the loop.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.