200
5.Given these values for variables i,j,p, and q:
i = 10
j = 19
p = true
q = false
add parentheses (if necessary) to the expressions below so that they evaluate to
true.
a.i == j || p
b.i >= j || i <= j && p
c. !p || p
d.!q && q
6.Given these values for the intvariables i,j,m, and n:
i = 6
j = 7
m = 11
n = 11
what is the output of the following code?
System.out.print("Madam");
if(i < j)
if(m != n)
System.out.print("How");
else
System.out.print("I’m");
if(i >= m)
System.out.print("Cow");
else
System.out.print("Adam");
7.Given the intvariables x,y, and z, where xcontains 3,ycontains 7, and z
contains 6, what is the output of each of the following code fragments?
a.if(x <= 3 )
System.out.print ("x"+ "y");
System.out.print("x"+ "y");
b.if(x != – 1 )
System.out.print("The value of x is "+ x);
else
System.out.print("The value of y is "+ y);
T
E
A
M
F
L
Y
Team-Fly®