| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | #include <stdio.h>
#define a 10
main()
{
#define a 50
printf("%d",a);
} | | 1 | | Write a function to find the depth of a binary tree. | Adobe | 8 | | main()
{
int x=5;
for(;x!=0;x--) {
printf("x=%d\n", x--);
}
}
a. 5, 4, 3, 2,1
b. 4, 3, 2, 1, 0
c. 5, 3, 1
d. none of the above | HCL | 1 | | write a program in c to merge two array | | 1 | | enum colors {BLACK,BLUE,GREEN}
main()
{
printf("%d..%d..%d",BLACK,BLUE,GREEN);
return(1);
} | | 1 | | Extend the sutherland-hodgman clipping algorithm to clip
three-dimensional planes against a regular paralleiepiped | IBM | 1 | | main()
{
extern i;
printf("%d\n",i);
{
int i=20;
printf("%d\n",i);
}
} | | 1 | | Which version do you prefer of the following two,
1) printf(%s,str); // or the more curt one
2) printf(str); | | 1 | | int aaa() {printf(Hi);}
int bbb(){printf(hello);}
iny ccc(){printf(bye);}
main()
{
int ( * ptr[3]) ();
ptr[0] = aaa;
ptr[1] = bbb;
ptr[2] =ccc;
ptr[2]();
} | | 1 | | main()
{
extern int i;
i=20;
printf("%d",sizeof(i));
} | | 1 | | main()
{
int i = 100;
clrscr();
printf("%d", sizeof(sizeof(i)));
}
a. 2
b. 100
c. 4
d. none of the above | HCL | 2 | | main()
{
int i=5,j=6,z;
printf("%d",i+++j);
} | | 1 | | Write, efficient code for extracting unique elements from
a sorted list of array.
e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).
| Microsoft | 10 | | main()
{
int i = 257;
int *iPtr = &i;
printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
} | | 1 | | main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
} | | 1 | | print a semicolon using Cprogram without using a semicolon
any where in the C code in ur program!!
| Tata-Elxsi | 19 | | main( )
{
static int a[ ] = {0,1,2,3,4};
int *p[ ] = {a,a+1,a+2,a+3,a+4};
int **ptr = p;
ptr++;
printf(\n %d %d %d, ptr-p, *ptr-a, **ptr);
*ptr++;
printf(\n %d %d %d, ptr-p, *ptr-a, **ptr);
*++ptr;
printf(\n %d %d %d, ptr-p, *ptr-a, **ptr);
++*ptr;
printf(\n %d %d %d, ptr-p, *ptr-a, **ptr);
} | | 1 | | #include<stdio.h>
main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i,++j);
} | | 1 | | void main()
{
int i=10, j=2;
int *ip= &i, *jp = &j;
int k = *ip/*jp;
printf(%d,k);
} | | 1 | | main()
{
int a[10];
printf("%d",*a+1-*a+3);
} | | 1 | | | | For more C Code Interview Questions Click Here |
|