int a = 3, b = 4;
if (a == b)
Write("X");
WriteLine("Y");
C. Y
What is the output of the following code segment?
int a = 3, b = 4;
if (a < b)
{
Write("Y");
WriteLine("Z");
}
C. YZ
What is the output of the following code segment?
int a = 3, b = 4;
if (a > b)
Write("Up");
else
WriteLine("Down");
A. Down
If the following code segment compiles correctly, what do you know about the variable x?
if(x) WriteLine("OK");
D. x is a Boolean variable
What is the output of the following code segment?
int c = 6, d = 12;
if(c > d);
Write("Green");
WriteLine("Yellow");
B. GreenYellow
What is the output of the following code segment?
int c = 6, d =12;
if(c > d)
if(c > 8)
Write("Blue");
else
Write("Red");
else
Write("Green");
D. Red
What is the output of the following code segment?
int e = 5, f = 10;
if (e < f && f < 0)
Write("Red");
else
Write("Orange");
D. Orange
What is the output of the following code segment?
int e = 5, f = 10;
if (e < f || f < 0)
Write("Purple");
else
Write("Gold");
B. Purple
Which of the following expressions is equivalent to the following code segment?
if (g > h)
if (g < k)
Write("Brown");
A. if (g > h && g < k)
Write("Brown");
B. if (g > h && < k)
Write("Brown");
C. if (g > h || g < k)
Write("Brown");
D. two of these
A. if (g > h && g < k)
Write("Brown");
Which of the following expressions assigns true to a Boolean variable named isIDValid when idNumber is both greater than 1000 and less than or equal to 9999, or else is equal to 123456?
A. two of these
Which of the following expressions is equivalent to a || b && c || d?
C. a || (b && c) || d
How many case labels would a switch statement require to be equivalent to the following if statement?