130k views
4 votes
1)

Which expression follows the practice of using parentheses to make the intended order of evaluation explicit?
x > y && !a == b
Group of answer choices
(x > y) && (!a == b)
(x > (y)) && ((!a == b))
((x > y) && !a == (b))
((x > y)) && ((!a == b))
2)
Given x = 1, y = 2, and z = 3, how is the expression evaluated? In the choices, items in parentheses are evaluated first.
(x == 5) || (y == 2) && (z == 5)
Group of answer choices
false OR (true AND false) --> false OR true --> true
false OR (true AND false) --> false OR false --> false
(false OR true) AND false --> true AND false --> false
(false OR true) AND false --> true AND false --> true
3)
What is the ending value of numItems if myChar = 'X'?
switch (myChar) {
case 'W':
numItems = 1; case 'X':
numItems = 2;
case 'Y':
numItems = 3; case 'Z':
numItems = 4;
}
Group of answer choices
4
9
2
3

User Nalan
by
7.3k points

1 Answer

7 votes
4 Is Correct.

It is to be noted that the expression that follows the practice of using parentheses to make the intended order of evaluation explicit is; (× > y) && (la == b) (Option A)

Once the case gets true the cases below also executes if break is not used. Here, case x gets true and because of this case y , c
User Ecoplaneteer
by
7.5k points