| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| 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 |
| void main()
{
static int i;
while(i<=10)
(i>2)?i++:i--;
printf(“%d”, i);
} | | 1 |
| Given an array of size N in which every number is between 1
and N, determine if there are any duplicates in it. You are
allowed to destroy the array if you like. | Microsoft | 15 |
| main()
{
int i = 0xff ;
printf("\n%d", i<<2);
}
a. 4
b. 512
c. 1020
d. 1024 | HCL | 1 |
| main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
} | | 1 |
| void main()
{
unsigned giveit=-1;
int gotit;
printf("%u ",++giveit);
printf("%u \n",gotit=--giveit);
} | | 1 |
| main ( )
{
static char *s[ ] = {“black”, “white”, “yellow”,
“violet”};
char **ptr[ ] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
**++p;
printf(“%s”,*--*++p + 3);
} | | 1 |
| Is the following code legal?
void main()
{
typedef struct a aType;
aType someVariable;
struct a
{
int x;
aType *b;
};
} | | 1 |
| main()
{
register int a=2;
printf("Address of a = %d",&a);
printf("Value of a = %d",a);
} | | 1 |
| main()
{
int k=1;
printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE");
} | | 1 |
| void main()
{
if(~0 == (unsigned int)-1)
printf(“You can answer this if you know how values are
represented in memory”);
} | | 1 |
| main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
} | | 1 |
| main()
{
int x=5;
clrscr();
for(;x==0;x--) {
printf("x=%d\n”", x--);
}
}
a. 4, 3, 2, 1, 0
b. 1, 2, 3, 4, 5
c. 0, 1, 2, 3, 4
d. none of the above | HCL | 1 |
| main()
{
struct date;
struct student
{
char name[30];
struct date dob;
}stud;
struct date
{
int day,month,year;
};
scanf("%s%d%d%d", stud.rollno, &student.dob.day,
&student.dob.month, &student.dob.year);
} | | 1 |
| Printf can be implemented by using __________ list. | | 1 |
| main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
} | | 1 |
| How to return multiple values from a function?
| | 4 |
| Given n nodes. Find the number of different structural
binary trees that can be formed using the nodes. | Aricent | 7 |
| #include<stdio.h>
void fun(int);
int main()
{
int a;
a=3;
fun(a);
printf("\n");
return 0;
}
void fun(int i)
{
if(n>0)
{
fun(--n);
printf("%d",n);
fun(--n);
}
} the answer is 0 1 2 0..someone explain how the code is
executed..? | Wipro | 1 |
| |
| For more C Code Interview Questions Click Here |