Java Reference
In-Depth Information
Short Answer (continued)
13. (continued)
i. (100 + 5) ! = (40 + 65)
j. (a == a) || !( = = a)
14. Given the expression E = 450, S = 670, J = 1, T = 56, I = 34, determine the
truth value of the following compound conditions:
a. ((E < 400) || (J = = 1))
b. ((S == 700) && (T = = 400))
c. ((I == S) || J = = 0))
d. ((S < 300) && ((I < 50) || (J = = 1)))
e. ((S < 300) && (!(I < 50) || (J = = 1)))
15. Determine a value of Q that will cause the condition in the if statements
below to be true:
a. if ((Q > 8) || (Q = 3) || (Z / 10))
b. if ((Q >= 7) && (Q > 0)) strMessage = "Maximum
number exceeded."
c. if (Q / 3 < 9) intCount = intCount + 1
d. if ((Q > 3) && !(Q = = 3)) dblSum = dblSum + dblAmt
16. Given the conditions S = = 0, Y = = 4, B = = 7, T = = 8, and X = = 3,
determine the action taken for each of the following:
a. if (S > 0) JOptionPane.showMessageDialog(null,
"Computation complete.");
b. if ((B == 4) || (T > 7))
if (X > 1) JOptionPane.showMessageDialog(null,
"Computation complete.");
c. if ((X == 3) || (T > 2))
if (Y > 7) JOptionPane.showMessageDialog(null,
"Computation complete.");
d. if ((X + 2) < 5)
if (B < (Y + X))
JOptionPane.showMessageDialog(null, "Computation
complete.");
17. Given five variables with previously defined values intA, intB, intC, intD, and
intE, write an if statement to increment the variable, intTotal, by 1 if all five
variables have the exact value of 10.
18. Given the following code, what will display if the variable, answer, is set to 2?
What will display if the variable, answer, is set to 4?
switch(answer)
{
case 1:
System.out.println("true");
break;
Search WWH ::




Custom Search