Program Control Structures: Conditional Control Structures Flashcards
Whether the indentation exists or not, the compiler will, by default, associate an else with the closest previous unpaired if.
True
Break statements are used when you want your program flow to come out of the switch body.
True
The default case can be used for performing a task when none of the cases is true.
True
If no break appears, the flow of control will fall through to subsequent cases until a break is reached.
True
In switch, if there is a match, the associated block of code is executed
True
A break can save a lot of execution time because it “ignores” the execution of all the rest of the code in the switch block.
True
Which of the following must be present in the switch construct?
expression in () after switch
If no break appears, the flow of control will fall through to subsequent cases until a break is reached
True
To make the multiple statements become a compound statement, enclosed the statements with brackets [].
False curly brackets is the right answer.
The constant-expression for a case may be a floating point number.
False
In switch, the value of the expression is compared with the values of each case.
True
Whenever a break statement is encountered in the switch body, the execution flow would directly come out of the switch, ignoring rest of the cases
True
Each case is followed by the value to be compared to and a semicolon.
True
The break statement causes an exit ________.
Innermost loop or switch
Nested switch statements should be avoided as it makes program more complex and less readable.
True