C++ Loops

Last Updated :
Discuss
Comments

Question 1

Which loop guarantees at least one iteration?

  • A

    for

  • B

    while

  • C

    do-while

  • D

    All of the above

Question 2

What does the break statement do in a loop?

  • A

    Skips to the next iteration

  • B

    Exits the loop

  • C

    Restarts the loop

  • D

    Pauses the loop

Question 3

What is the purpose of a continue statement?

  • A

    Exits the loop

  • B

    Skips the current iteration

  • C

    Defines a condition

  • D

    Allocates memory

Question 4

Which loop is best for a fixed number of iterations?

  • A

    while

  • B

    do-while

  • C

    for

  • D

    None

Question 5

What is the primary cause of an infinite loop?

  • A

    Missing break

  • B

    Incorrect condition

  • C

    Missing continue

  • D

    Wrong variable type

Tags:

There are 5 questions to complete.

Take a part in the ongoing discussion