Answer to Question #168634 in C++ for Lucy

Question #168634

State whether each of the following is true or false. Explain why.

a. The default case is required in the switch selection statement.

b. The break statement is required in the last case of a switch selection statement.

c. The expression ( (x > y) && (a < b ) ) is true if either x > y is true or a < b is true .

d. An expression containing the || operator is true if either or both of its operands are true.

e. The comma (,) formatting flag in a format specifier (e.g., %,20.2f) indicates that a value should be output with a thousands separator.

f. To test for a range of values in a switch statement, use a hyphen () between the start and end values of the range in a case label.

g. Listing cases consecutively with no statements between them enables the cases to perform the same set of statements.


1
Expert's answer
2021-03-03T13:32:31-0500
  1. False: The default case is optional. If no default action is needed, then there is no need for a default case.
  2. False: The break statement is used to exit the switch structure. the break statement is not required when the default case is the last case.
  3. False: Both of the relational expressions must be true in order for the entire expression to be true when using the && operator.
  4. True. 
  5. True.
  6. False: The switch statement does not provide a mechanism for testing ranges of values, so every value that must be tested should be listed in a separate case label
  7. True.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Lucy
04.03.21, 00:32

Wow I love the answers

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS