| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | void main()
{
int i=5;
printf("%d",i+++++i);
} | | 1 | | int i;
main(){
int t;
for ( t=4;scanf("%d",&i)-t;printf("%d\n",i))
printf("%d--",t--);
}
// If the inputs are 0,1,2,3 find the o/p | | 1 | | Give a very good method to count the number of ones in a 32
bit number.
(caution: looping through testing each bit is not a solution) | Microsoft | 5 | | #include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
} | | 1 | | void ( * abc( int, void ( *def) () ) ) (); | | 1 | | void main()
{
int *mptr, *cptr;
mptr = (int*)malloc(sizeof(int));
printf(“%d”,*mptr);
int *cptr = (int*)calloc(sizeof(int),1);
printf(“%d”,*cptr);
} | | 1 | | main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
} | | 1 | | main()
{
char *p="hai friends",*p1;
p1=p;
while(*p!='\0') ++*p++;
printf("%s %s",p,p1);
} | | 1 | | #define prod(a,b) a*b
main()
{
int x=3,y=4;
printf("%d",prod(x+2,y-1));
} | | 1 | | Program to Delete an element from a doubly linked list.
| Infosys | 4 | | How to reverse a String without using C functions ? | Wipro | 14 | | void main()
{
int i=i++,j=j++,k=k++;
printf(“%d%d%d”,i,j,k);
} | | 1 | | #define int char
main()
{
int i=65;
printf("sizeof(i)=%d",sizeof(i));
} | | 1 | | program to Reverse a linked list | Ness-Technologies | 4 | | main()
{
int i;
float *pf;
pf = (float *)&i;
*pf = 100.00;
printf("\n %d", i);
}
a. Runtime error.
b. 100
c. Some Integer not 100
d. None of the above | HCL | 1 | | 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 | | main( )
{
int a[ ] = {10,20,30,40,50},j,*p;
for(j=0; j<5; j++)
{
printf(“%d” ,*a);
a++;
}
p = a;
for(j=0; j<5; j++)
{
printf(“%d ” ,*p);
p++;
}
} | | 1 | | #include<stdio.h>
main()
{
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
int *p,*q;
p=&a[2][2][2];
*q=***a;
printf("%d..%d",*p,*q);
} | | 1 | | Derive expression for converting RGB color parameters to
HSV values | | 1 | | struct Foo
{
char *pName;
};
main()
{
struct Foo *obj = malloc(sizeof(struct Foo));
clrscr();
strcpy(obj->pName,"Your Name");
printf("%s", obj->pName);
}
a. Your Name
b. compile error
c. Name
d. Runtime error | HCL | 1 | | | | For more C Code Interview Questions Click Here |
|