Review Questions c#2
1.If the following code segment compiles correctly, what do you
know about the variable x?
if(x) Console.WriteLine("OK");
a. x is an integer variable
b. x is a Boolean variable
c. x is greater than 0
d. none of these
2. What is the output of the following code segment?
int c = 6, d = 12;
if(c < d)
if(c > 8)
Console.Write("Green");
else
Console.Write("Yellow");
else
Console.Write("Blue");
a. Green
b. Yellow
c. Blue
d. nothing
3.Which of the following expressions is equivalent to the
following code segment?
if(g > h)
if(g < k)
Console.Write("Brown");
a. if(g > h