# C Language Interview Questions Test 13

This Test will cover complete C with very important questions, starting off from basics to advanced level.
Q. The purpose of the following program fragment, where `s` and `b` are two integers is to __________?
``````b = s + b;
s = b - s;
b = b - s;``````
 A. transfer the contents of s to b B. transfer the contents of b to s C. exchange(swap) the contents of s and b D. negate the contents of s and b
Q. Consider the function, if `a` and `b` be two non-negative integers, then the call `find(a, find(a,b))` can be used to find __________?
``````find(int x, int y)
{
return((x < y) ? 0 : (x - y));
}``````
 A. maximum of a, b B. positive difference of a, b C. sum of a, b D. minimum of a, b
Q. In the above code, let `a` and `b` be two non-negative integers. Which of the following calls finds the positive difference of `a` and `b`?
 A. find(a, b) + find(b, a) B. find(a, find(a, b)) C. a + find(a, b) D. b + find(a, b)
Q. If an integer needs two bytes of storage then maximum value of a signed integer is?
 A. (2^16)-1 B. (2^15)-1 C. 2^16 D. 2^15

Q. Consider the below statements, if `a` is the first input and `b` is the second input, the output will be?
``````putchar(getchar());
putchar(getchar());``````
 A. an error message B. this can't be an input C. ab D. a b
Q. If `y` is of integer type then the below expressions __________?
``3*(y-8) / 9 and (y-8) / 9*3``
 A. must yield the same value B. must yield different values C. may or may not yield the same value D. none of the above
Q. The following code fragment __________.
``````int x, y = 2, z, a;
x = (y*=2) + (z=a=y);
printf("%d", x);``````
 A. prints 8 B. prints 6 C. print 6 or 8 depending on the compiler implementation D. is syntactically wrong
Q. The code `printf("%c", 100);` __________.
 A. prints 100 B. prints the ASCII equivalent to 100 C. prints garbage D. none of above
Q. The following program fragment, results in the printing of?
``````if(a == 7)
printf("a is seven");
else
printf("a is not seven");``````
 A. a is seven B. a is not seven C. nothing D. garbage

Q. The following program fragment __________.
``````int a = 4, b = 6;
printf("%d", a == b);``````
 A. outputs an error message B. prints 0 C. prints 1 D. none of above
Q. The following program results in __________?
``````main()
{
int i = 5;
if(i == 5)
return;
else
printf("i is not five");
// printf over
printf("over");
}``````
 A. a syntax error B. an execution error C. printing of over D. execution termination, without printing anything
Q. The following statements will result in the printing of?
``````for(i = 3; i < 15; i+=3)
{
printf("%d", i);
++i;
}``````
 A. 3 6 9 12 B. 3 6 9 12 15 C. 3 7 11 D. 3 7 11 15
Q. If `a = 9`, `b = 5` and `c = 3`, then the expression `(a - a/b * b%c) > a%b%c` evaluates to?
 A. true B. false C. invalid D. 0
Q. In the following program fragment, `s2` will be executed if?
``````if(a > b)
if(b > c)
s1;
else
s2;``````
 A. a <= b B. b > c C. b <= c and a <= b D. a > b and b <= c
Q. In the following program fragment, `a <= b` will be printed if?
``````if(a > b)
printf("a > b");
else
printf("else part");
printf("a <= b");
``````
 A. a > b B. a < b C. a == b D. does not depend upon if condition

Having second thoughts for any code related question?

Try executing the code in our

### Related Tests:

#### Explore more Subjects:

Tests for various other programming languages and subjects: