50,545
社区成员
发帖
与我相关
我的任务
分享
Question 67
Given:
23. int z=5;
24.
25. public void stuff1(int x) {
26. assert (x> 0);
27. switch(x) {
28. case 2: x= 3;
29. default: assert false; } }
30.
31. private void stuff2(int y) { assert (y < 0); }
32.
33. private void stuff3() { assert (stuff4O); }
34.
35. private boolean stuff4() { z = 6; return false; }
Which is true?
A. All of the assert statements are used appropriately.
B. Only the assert statement on line 31 is used appropriately.
C. The assert statements on lines 29 and 31 are used appropriately.
D. The assert statements on lines 26 and 29 are used appropriately.
E. The assert statements on lines 29 and 33 are used appropriately.
F. The assert statements on lines 29, 31, and 33 are used
appropriately.
G. The assert statements on lines 26, 29, and 31 are used
appropriately.
Answer: C
switch(x){
case 1:y=3;
case 2: y=9;
case 3: y=27;
default:assert false;