In: Computer Science
What is the output of the following code snippet? (If there is some kind of syntax error indicate this by marking "error" in your answer choice)
1.
int laps = 8;
if (laps++ > --laps)
laps += 2;
else if (--laps > (laps - 1))
laps += 4;
else if (++laps)
laps -= 3;
cout << laps << endl;
2.
What is the output of the following code snippet?
3.
integer i = 67;
double d = i - 1;
i = d;
character c = i;
if i > 65
cout << "The character
is: " << c << " in the alphabet" << endl;
else i <= 65
cout << "The character
is before the alphabet" << endl;
The character is: B in the alphabet |
||
The character is: C in the alphabet |
||
The character is: c in the alphabet |
||
The character is before the alphabet |
||
Error: the code will not compile |
4.
What is the output of the following? (if there is a syntax or runtime error enter “error” for your answer)
int know = 4;
short test = 5;
long large = 28;
if (large / 5 < test && ++test > know && ++test < large)
{
test += know;
}
else if (--test == know++)
{
test -= know;
}
large -= test;
cout << large << endl;
5.
What is the output of the following code snippet? (If there is some kind of syntax error indicate this by marking "error" in your answer choice)
//Note that there are no endl's until the end of the problem
short k = 5;
float red = 7.7f;
if (++k < --red)
cout << k;
if (k < --red)
cout << 4;
if (++red > k--)
cout << 2;
cout << k << endl;