Loop in C MCQs
Which of the following is the correct syntax for a for
loop in C?
- a)
for (initialization; condition; increment/decrement)
- b)
for (initialization, condition, increment/decrement)
- c)
for initialization; condition; increment/decrement
- d)
for (initialization: condition: increment/decrement)
Answer: a) for (initialization; condition; increment/decrement)
Which of the following loops will execute at least once, even if the condition is false initially?
- a)
for
- b)
while
- c)
do-while
- d)
none of the above
Answer: c) do-while
Which keyword is used to immediately terminate a loop in C?
- a)
continue
- b)
break
- c)
exit
- d)
stop
Answer: b) break
Which keyword is used to skip the current iteration of a loop and move to the next iteration?
- a)
break
- b)
skip
- c)
next
- d)
continue
Answer: d) continue