What does a break statement do inside a loop?
-
A
It leaves the innermost enclosing loop
Correct answer
-
B
It skips only the current iteration
-
C
It terminates the whole program at once
-
D
It restarts the loop from the beginning
Correct answer
A. It leaves the innermost enclosing loop
17 views
Explanation
break moves control to the statement after the innermost loop or switch that encloses it.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ