When break statement is encountered in switch statement, it ______
AStops the entire program
BStops the execution of current statement
CExits from switch statement
DRepeats the switch statement
break transfers control to the statement after the switch block.
2.
★ Solved MCQs collection
If the break statement is missed in switch statement then,
AThe compiler will give error
BThis may cause a logical error
CNo effect on program
DProgram stops its execution
Without break, control falls through into the next case, which can cause a logical error.
3.
★ Past paper collection
What is the output of the following code, if the first case is true
switch (var) {
case 'a':cout<<"apple"<<endl;
case 'b':cout<<"banana"<<endl;
case 'm':cout<<"mango"<<endl;
default: cout<<"any fruit"<<endl;
}
Aapple
Bapple
any fruit
Capple
banana
mango
any fruit
Dnone of above
Without break, all statements from case 'a' onward run.
4.
★ Past paper collection
_________statement is used to terminate the processing of a particular case and exit from switch structure.
Aif
Bgoto
Cbreak
Dcontinue
break ends the current case and leaves the switch.
No MCQs match this filter.Is filter mein koi MCQ nahi.
No short questions added yet.Abhi koi short sawal shamil nahi.
No long questions added yet.Abhi koi long sawal shamil nahi.