Professional Documents
Culture Documents
About Exam 1
Below is NOT exam1. It is a practice exam for you to have a very good feel
of what to expect. It is highly recommended that you try the questions on
paper first before you test them on the computer. Expect around 30
questions in Exam1.
NOTE WELL: Assume that the code in each question has no syntax errors.
int x = 1, y = 2 , z = 3; a) x is 1
b) x is 2
printf("x is %d", z); c) x is 3
x = y; d) None of the above
a) x is 1
int x = 1, y = 2 , z = 3; b) x is 2
c) x is 3
x = y; d) None of the above
printf("x is %d", (z+y-1)/x+x);
3 - What does the code print to the
screen?
a) x++ is 1
b) x++ is 2
int x = 1; c) x++ is 3
d) None of the above
++x;
printf("x++ is %d", x);
a) TRUETRUE
int x = 3; b) TRUE
c) TRUETRUETRUE
switch ( x + 1) d) TRUETRUETRUETRUE
{ e) None of the above
case 3: printf("TRUE");
case 4: printf("TRUE");
default: printf("TRUE");
}
printf("TRUE");
int n = 0; a) n = 7
for(n = 7; n<0; n--) b) n = 0
{ c) n = -1
printf("*****\n"); d) None of the above
n = n + 1;
}
printf("n = %d", n);
int n = 3; a) 3
while( n > 1) b) 0
{ c) 8
n = n + 5; d) None of the above
if ( n <= 7 )
{
break;
printf ("%d\n", n);
}
printf ("%d\n", n);
}
15 -what does the code print to the
screen ? a) Outside Loop
int counter = 2; b) Inside Loop
c) Inside LoopOutside Loop
while (counter < 10) d) None of the above
{
counter ++;
if ( counter < 5 ) continue;
else if ( counter >=6 ) break;
printf("Inside Loop");
}
printf("Outside Loop");