Answer to Question #165070 in Algorithms for Jean Claude

Question #165070

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

  1. The default case is required in the switch selection statement.
  2. The break statement is required in the last case of a switch selection statement.
  3. The expression ( (x > y) && (a < b ) ) is true if either x > y is true or a < b is true.
  4. An expression containing the || operator is true if either or both of its operands are true.
  5. The comma (,) formatting flag in a format specifier (e.g., %,20.2f) indicates that a value should be output with a thousands separator.
  6. 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.
  7. Listing cases consecutively with no statements between them enables the cases to perform the same set of statements.
1
Expert's answer
2021-02-19T18:53:32-0500

Statement 1 is false. The default case is option in the switch case. If no default case is required then there is no need for a default case.

Statement 2 is false. The beak statement is used to exit the switch statement. The break statement is not compulsory in last line for the switch case statement.

Statement 3 is false. When both x > y and a < b will be true then the given expression ( (x > y) && (a < b ) ) is true.

Statement 4 is true.

Statement 5 is true.

Statement 6 is false. Switch statement does not provide the mechanism for the testing ranges or values. So every which we are going to test should be in separate case label.

Statement 7 is 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

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS