Signup/Sign In

C Language Interview Questions Test 6

This Test will cover complete C with very important questions, starting off from basics to advanced level.
Q. The following program fragment will __________.
int a = 4, b = 6;
printf("%d", a == b);
Q. A possible output of the following program fragment is __________.
for(i = getchar() ; ; i = getchar()) 
{
    if(i=='x') {
        break;
    }
    else {
        putchar(i);
    }
}
Q. The following program fragment will output __________?
int i = 5;
do {
    putchar(i+100); 
    printf("%d", i--);
}
while(i);
Q. The following program fragment will result in?
int i = 107, x = 5;
printf((x > 7) ? "%d": "%c", i);

Q. The following loop will __________.
while(printf("%d", printf("az"))) 
{
    printf("by");
}
Q. The following program fragment __________.
int x = 0;
if(2 < 1);
else
    x = (2 < 0) ? printf("one") : printf("fout");
printf("%d", x);
Q. How many times, the body of the following for loop will be executed?
for(putchar('a'); putchar(0); putchar('c'))
    putchar('b');
Q. What will sizeof(myArray) in the following type definition? (Assume one character occupies 1 byte)
typedef char x[10];
x myArray[5];
Q. The following program __________.
main()
{
    static int a[] = {7,8,9};
	printf("%d", 2[a] + a[2]);
}

Q. The following program __________.
main()
{
    static char a[3][4] = {"abcd", "mnop", "fghi"};
	putchar(**a);
}
Q. The default parameter passing mechanism is __________?
Q. The following program __________.
main()
{
	printf("tim");
    main();
}
Q. The following program __________.
main()
{
    inc(); inc(); inc();
}
	 
inc()
{
    static int x;
	printf("%d", ++x);
}
Q. The code printf("ab", "cd", "ef"); prints __________?
In the following code fragment, on termination j will have the value?
i = 6720; j = 4;
while((i%j) == 0) 
{
    i = i/j;
	j = j+1;
}

Related Tests: