State whether the following are true or false. If the answer is false, explain why.

1) The default case is required in the switch selection statement.
2) The break statement is required in the default case of a switch selection statement to exit the switch properly.
3) The expression ( x > y && a < b ) is true if either the expression x>y is true or the
expression a 4) An expression containing the || operator is true if either or both of its operands are true.

1) False. The default case is optional. Nevertheless, it is considered good software engineering to always provide a default case.
2) False. The break statement is used to exit the switch statement. The break statement is not required in the default case when it is the last case. Nor will the break statement be required if having control proceed with the next case makes sense.
3) False. When using the && operator, both of the relational expressions must be true for the entire expression to be true.
4) True.

Computer Science & Information Technology

You might also like to view...

EX 2.7. Write four different program statements that increment the value of an integer variable total.

What will be an ideal response?

Computer Science & Information Technology

FIGURE EX 7-1 The arrow shown in the accompanying figure is pointing to where you would ____.

A. attach a copy of the workbook to an email B. type a comment C. sign in to Windows Live D. save a file as a PDF

Computer Science & Information Technology