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...

Which of the following segments is a proper way to call the method readData four times?

a. double k = 0.0; while (k != 4) { readData(); k = k + 1; } b. int i = 0; while (i <= 4) { readData(); i = i + 1; } c. int i = 0; while (i < 4) { readData(); } d. int i = 0; while (i < 4) { readData(); i = i + 1; }

Computer Science & Information Technology

Grouped objects are below non-grouped objects so that they do not connect with or segment other objects.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

(Selection Sort) A selection sort searches an array looking for the smallest element. Then, the smallest element is swapped with the first element of the array. The process is repeated for the subarray beginning with the second element of the array. Each pass of the array results in one ele- ment being placed in its proper location. This sort performs comparably to the insertion sort—for an

array of n elements, n – 1 passes must be made, and for each subarray, n – 1 comparisons must be made to find the smallest value. When the subarray being processed contains one element, the array is sorted. Write recursive function selectionSort to perform this algorithm. What will be an ideal response?

Computer Science & Information Technology

A GUI object on a Windows Form object can be deleted by selecting it and pressing the ____________________ key on the keyboard.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology