1. Home
  2. Computer Science MCQs
  3. C Programming
  4. Inside a for loop, what does the continue statement do?

Added 30 Nov -0001

Inside a for loop, what does the continue statement do?

  1. Restarts the loop from its initial value
  2. Skips the update expression for that pass only
  3. Skips the rest of the body and runs the update step Correct answer
  4. Exits the loop immediately and continues with the next statement

Correct answer

C. Skips the rest of the body and runs the update step

14 views

MCQSEXAM

Explanation

continue abandons the remaining statements of the current iteration and jumps to the loop's update expression, after which the condition is tested again. In a while loop it jumps straight to the condition, which can cause an infinite loop if the counter is updated below the continue. break is the contrasting statement, since it leaves the loop entirely instead of starting the next pass.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C Programming MCQs

Practise all C Programming MCQs

Similar MCQs