| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
41printf("%p",main);
}8 | | 1 |
| Declare an array of N pointers to functions returning
pointers to functions returning pointers to characters? | | 1 |
| how to return a multiple value from a function? | Wipro | 2 |
| main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
} | | 1 |
| main()
{
int i;
i = abc();
printf("%d",i);
}
abc()
{
_AX = 1000;
} | | 1 |
| struct point
{
int x;
int y;
};
struct point origin,*pp;
main()
{
pp=&origin;
printf("origin is(%d%d)\n",(*pp).x,(*pp).y);
printf("origin is (%d%d)\n",pp->x,pp->y);
} | | 1 |
| union u
{
union u
{
int i;
int j;
}a[10];
int b[10];
}u;
main()
{
printf("\n%d", sizeof(u));
printf(" %d", sizeof(u.a));
// printf("%d", sizeof(u.a[4].i));
}
a. 4, 4, 4
b. 40, 4, 4
c. 1, 100, 1
d. 40 400 4 | HCL | 1 |
| #define FALSE -1
#define TRUE 1
#define NULL 0
main() {
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts("FALSE");
} | | 1 |
| Give a one-line C expression to test whether a number is a
power of 2. | Microsoft | 8 |
| how to return a multiple value from a function? | Wipro | 5 |
| main(){
unsigned int i;
for(i=1;i>-2;i--)
printf("c aptitude");
} | | 1 |
| main()
{
int i=-1;
-i;
printf("i = %d, -i = %d \n",i,-i);
} | | 1 |
| main()
{
char *p = "hello world";
p[0] = 'H';
printf("%s", p);
}
a. Runtime error.
b. “Hello world”
c. Compile error
d. “hello world” | HCL | 5 |
| main()
{
char *cptr,c;
void *vptr,v;
c=10; v=0;
cptr=&c; vptr=&v;
printf("%c%v",c,v);
} | | 1 |
| write the function. if all the character in string B appear in
string A, return true, otherwise return false. | Google | 10 |
| main()
{
char c=' ',x,convert(z);
getc(c);
if((c>='a') && (c<='z'))
x=convert(c);
printf("%c",x);
}
convert(z)
{
return z-32;
} | | 1 |
| void main()
{
int *i = 0x400; // i points to the address 400
*i = 0; // set the value of memory location pointed by i;
} | | 1 |
| main()
{
static int a[3][3]={1,2,3,4,5,6,7,8,9};
int i,j;
static *p[]={a,a+1,a+2};
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j),
*(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i));
}
} | | 1 |
| prog. to produce 1
2 3
4 5 6
7 8 9 10 | | 2 |
| void main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
} | | 1 |
| |
| For more C Code Interview Questions Click Here |