C Language Interview Questions Test 4

This Test will cover complete C with very important questions, starting off from basics to advanced level.

Q. The following program,
if(a > b)
    if(c > b)
	    printf("one");
    else if(c == a) 
        printf("two");
    else 
        printf("three");
else 
    printf("four");
Q. The following program fragment outputs an integer that is same as?
int x = 4, y = x, i;
for(i=1; i<4; ++i)
    x += x;
printf("%d", x); 
Q. Output of the following program fragment will be same as that of?
static char hello[] = "hello";
printf("%s\n", hello);
Q. The following program fragment __________.
int x[5][5], i, j;
for(i = 0; i < 5; ++i)
    for(j=0; j < 5; j++)
    	x[i][j] = x[j][i]; 

Q. The following program fragment __________.
int m, n, b = m = n = 8;
char wer[80];
sprintf(wer, "%d%d%d", m, n, b);
puts(wer);
Q. If n has the value 3, then the statement a[++n] = n++; will __________.
Q. In the following program, If Madam is the required output then the body of first() must be.
main()
{ 
    putchar('M');
	first();
	putchar('m'); 
}
     
first()
{ 
    __________
}

second()
{ 
    putchar('d'); 
}
Q. max is a function that returns the larger of the two integers, given as arguments. Which of the following statements finds the largest of three given numbers?
Q. What is the output of the following program?
main()
{ 
    int a = 4;
    change(a);
    printf("%d", a);
}

change(a)
{ 
	printf("%d", ++a);
}

Q. The following program __________.
main()
{
	int i = 2;
	{ 
		int i = 4, j = 5;
	  	printf("%d%d", i, j);
	}
    printf("%d%d", i, j);
}
Q. The output of the following program is __________.
main()
{ 
	static int x[] = {1, 2, 3, 4, 5, 6, 7, 8};
  	int i;
  	for(i=2; i < 6; ++i)
        x[x[i]] = x[i];
   		for(i=0; i < 8; ++i)
    		printf("%d", x[i]);
}
Q. The following program statements __________.
main()
{ 
	int a = 5, b = 2;
	printf("%d", a+++b);
}
Q. The following program statements __________.
main()
{ 
	int abc();
	abc();
	(*abc) ();
}
int abc()
{	 
	printf("come"); 
}
Q. In the following program. If abcdefg is the input, the output will be?
main()
{
	char x[10], *ptr = x;
	scanf("%s", x);
	// calling change function
	change(&x[4]);
}

change(char a[])
{ 
	puts(a);
}
Q. In the previous question for the function calls, change(x); and change(ptr);. Which of the below statements is true?

SUBMIT TEST