C Language Interview Questions Test 5
This Test will cover complete C with very important questions, starting off from basics to advanced level.
Q. If an integer needs two bytes of storage then maximum value of an unsigned integer is __________?
Q. The code printf("%d",printf("tim"));
__________.
Q. If abc
is the input then the following program fragment results in __________?
char x, y, z;
printf("%d", scanf("%c%c%c", &x, &y, &z));
Q. Let a
and b
be two positive integers. Which of the following options correctly relates /
and %
?
Q. If the required output is abcdefghijklmnopqrstuvwxyz
then xxx
should be __________?
char c = 'a';
while(c++ <= 'z')
{
putchar(xxx);
}
Q. The expression 5 - 2 - 3 * 5 - 2
will evaluate to 18
, if __________?
Q. The below mentioned program fragment will __________.
int i = 263;
putchar(i);
Q. The following program fragment will print __________.
unsigned i = 1;
int j = -4;
printf("%u",i+j);
Q. If the following program fragment(assume negative numbers are stored in 2's complement
form)
unsigned i = 1;
int j = -4;
printf("%u", i+j);
prints
x
then
printf("%d", 8*sizeof(int));
outputs an integer that is same as __________. (log in the answers are to the base two)?
Q. The following program fragment results in __________?
for(i = 3; i < 15; i += 3);
printf("%d", i);
Q. The following program fragment results in __________?
for(i = 1; i < 5 ; ++i)
{
if(i == 3)
{
continue;
}
else
{
printf("%d", i);
}
}
Q. The following program fragment will __________.
int k = -7;
printf("%d", 0 < !k);
Q. What will be the output of the following loop?
for(putchar('c'); putchar('a'); putchar('r'))
{
putchar('t');
}
Q. What will be the output of the following loop?
for(i=1, j=10; i<6; ++i, --j)
{
printf("%d %d", i, j);
}
Q. The minimum number of temporary variables needed to swap the contents of two variables is __________?