| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | how to return a multiple value from a function? | Wipro | 5 | | main()
{
{
unsigned int bit=256;
printf("%d", bit);
}
{
unsigned int bit=512;
printf("%d", bit);
}
}
a. 256, 256
b. 512, 512
c. 256, 512
d. Compile error | HCL | 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 | | why java is platform independent? | Wipro | 10 | | Is the following code legal?
typedef struct a
{
int x;
aType *b;
}aType | | 1 | | main()
{
printf("%d", out);
}
int out=100; | | 1 | | #define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
} | | 1 | | main()
{
char *p;
p="%d\n";
p++;
p++;
printf(p-2,300);
} | | 1 | | main()
{
int i =10, j = 20;
clrscr();
printf("%d, %d, ", j-- , --i);
printf("%d, %d ", j++ , ++i);
}
a. 20, 10, 20, 10
b. 20, 9, 20, 10
c. 20, 9, 19, 10
d. 19, 9, 20, 10 | HCL | 1 | | enum colors {BLACK,BLUE,GREEN}
main()
{
printf("%d..%d..%d",BLACK,BLUE,GREEN);
return(1);
} | | 1 | | main()
{
int i =0;j=0;
if(i && j++)
printf("%d..%d",i++,j);
printf("%d..%d,i,j);
} | | 1 | | main()
{
char str1[] = {s,o,m,e};
char str2[] = {s,o,m,e,\0};
while (strcmp(str1,str2))
printf(Strings are not equal\n);
} | | 1 | | main(int argc, char **argv)
{
printf("enter the character");
getchar();
sum(argv[1],argv[2]);
}
sum(num1,num2)
int num1,num2;
{
return num1+num2;
} | | 1 | | How can u say that a given point is in a triangle?
1. with the co-ordinates of the 3 vertices specified.
2. with only the co-ordinates of the top vertex given. | | 1 | | Is the following code legal?
struct a
{
int x;
struct a b;
} | | 1 | | main()
{
char *p = ayqm;
printf(%c,++*(p++));
} | TCS | 2 | | main()
{
float i=1.5;
switch(i)
{
case 1: printf("1");
case 2: printf("2");
default : printf("0");
}
} | | 1 | | main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit >> (i - (i -1)));
}
}
a. 512, 256, 0, 0, 0
b. 256, 256, 0, 0, 0
c. 512, 512, 512, 512, 512
d. 256, 256, 256, 256, 256 | HCL | 1 | | What are the files which are automatically opened when a C
file is executed? | | 1 | | main()
{
41printf("%p",main);
}8 | | 1 | | | | For more C Code Interview Questions Click Here |
|