Sunday 5 October 2014

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

Leave a Comment


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

Solution


  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. 
If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: