| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit = (bit >> (i - (i -1))));
}
}
a. 512, 256, 128, 64, 32
b. 256, 128, 64, 32, 16
c. 128, 64, 32, 16, 8
d. 64, 32, 16, 8, 4 | HCL | 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 | | In the following pgm add a stmt in the function fun such
that the address of
'a' gets stored in 'j'.
main(){
int * j;
void fun(int **);
fun(&j);
}
void fun(int **k) {
int a =0;
/* add a stmt here*/
} | | 1 | | Write a procedure to implement highlight as a blinking
operation | | 1 | | How to access command-line arguments? | | 4 | | write a program in c to merge two array | | 1 | | main()
{
int i=5;
printf(“%d”,i=++i ==6);
} | | 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 | | how can u draw a rectangle in C | Wipro | 31 | | main( )
{
int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
printf(“%u %u %u %d \n”,a,*a,**a,***a);
printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);
} | | 1 | | main()
{
printf("%d", out);
}
int out=100; | | 1 | | main()
{
int i=-1;
-i;
printf("i = %d, -i = %d \n",i,-i);
} | | 1 | | Is the following code legal?
struct a
{
int x;
struct a b;
} | | 1 | | # include<stdio.h>
aaa() {
printf("hi");
}
bbb(){
printf("hello");
}
ccc(){
printf("bye");
}
main()
{
int (*ptr[3])();
ptr[0]=aaa;
ptr[1]=bbb;
ptr[2]=ccc;
ptr[2]();
} | | 1 | | Program to Delete an element from a doubly linked list.
| Infosys | 4 | | main()
{
printf("%x",-1<<4);
} | | 1 | | void ( * abc( int, void ( *def) () ) ) (); | | 1 | | main(){
unsigned int i;
for(i=1;i>-2;i--)
printf("c aptitude");
} | | 1 | | #define SQR(x) x * x
main()
{
printf("%d", 225/SQR(15));
}
a. 1
b. 225
c. 15
d. none of the above | HCL | 1 | | func(a,b)
int a,b;
{
return( a= (a==b) );
}
main()
{
int process(),func();
printf("The value of process is %d !\n
",process(func,3,6));
}
process(pf,val1,val2)
int (*pf) ();
int val1,val2;
{
return((*pf) (val1,val2));
} | | 1 | | | | For more C Code Interview Questions Click Here |
|