Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
C
« Previous
Next »
___________ will immediately jump to the end of the current block of code
Options
- continue
- exit
- goto
- break
CORRECT ANSWER : break
Discussion Board
break-
The break statement terminates the loop immediately when it is encountered. This statement jump end of the current block.
Whenever it is encountered in switch-case block, the control comes out of the switch-case body.
Syntax:
break;
Sapna 02-24-2017 12:12 AM
Break statement
This is a BADLY WORDED question with no answer. The writer is confusing the term "code block" with an execution loop statement. The correct QUESTION should be: "What causes an enclosing for, range-for, while or do-while loop or switch statement to terminate?" (en.cppreference.com).
Break does not cause execution to jump to the end of the current (enclosing) block!! When the following code executes, the break statement terminates the while loop; it does not simply skip over code which follows it inside the containing conditional code block.
int i = 5;
while (i--) {
if (true) {
std::cout << "Before break" << std::endl;
break;
std::cout << "After break" << std::endl;
}
std::cout << "Next iteration" << std::endl;
}
std::cout << "End break test" << std::endl;
gds 06-15-2014 07:59 PM
Controls in C
- continue - forces the next iteration of the loop to occur, skipping any code in between.
- exit function calls all functions registered and terminates the program
- goto - this statement is used for altering the normal sequence of program execution. The control of the program is transferred to some other part of the program.
- break - break statement terminates the execution of the nearest enclosing.
Aparna 07-5-2013 06:30 AM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
C test (42)
C (12)
C++ for beginners (10)
C++ (20)
C++ (24)
C++ (18)
C++ (14)
C++ (12)
C++ (15)
C++ (15)
Data structure (20)
Data structure (10)
Data structure (10)
Data structure (10)
PERL (25)
VC++ (11)
Oops (30)
Mainframe (41)
Mainframe (15)
Embedded systems (15)
OOAD (49)
Advertisement
▲