| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
extern int i;
i=20;
printf("%d",i);
} | | 1 |
| main()
{
char *p = “ayqm”;
char c;
c = ++*p++;
printf(“%c”,c);
} | | 1 |
| main()
{
char *str1="abcd";
char str2[]="abcd";
printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
} | | 1 |
| main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
} | | 1 |
| main()
{
char * strA;
char * strB = I am OK;
memcpy( strA, strB, 6);
}
a. Runtime error.
b. I am OK
c. Compile error
d. I am O | HCL | 2 |
| main()
{
int i;
printf("%d",scanf("%d",&i)); // value 10 is given as
input here
} | | 1 |
| print numbers till we want without using loops or condition
statements like specifically(for,do while, while swiches,
if etc)!
| | 7 |
| int DIM(int array[])
{
return sizeof(array)/sizeof(int );
}
main()
{
int arr[10];
printf(“The dimension of the array is %d”, DIM(arr));
} | | 1 |
| void main()
{
int i=5;
printf("%d",i++ + ++i);
} | | 1 |
| void main()
{
unsigned giveit=-1;
int gotit;
printf("%u ",++giveit);
printf("%u \n",gotit=--giveit);
} | | 1 |
| main()
{
show();
}
void show()
{
printf("I'm the greatest");
} | | 1 |
| main()
{
int c=- -2;
printf("c=%d",c);
} | | 1 |
| main()
{
int i=5;
printf(“%d”,i=++i ==6);
} | | 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 |
| 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 |
| main()
{
int x=5;
clrscr();
for(;x<= 0;x--)
{
printf("x=%d ", x--);
}
}
a. 5, 3, 1
b. 5, 2, 1,
c. 5, 3, 1, -1, 3
d. –3, -1, 1, 3, 5 | HCL | 1 |
| main()
{
int *j;
{
int i=10;
j=&i;
}
printf("%d",*j);
} | | 1 |
| write a program to count the number the same
(letter/character foreg: 's') in a given sentence. | | 1 |
| What is the problem with the following code segment?
while ((fgets(receiving array,50,file_ptr)) != EOF)
; | | 1 |
| struct aaa{
struct aaa *prev;
int i;
struct aaa *next;
};
main()
{
struct aaa abc,def,ghi,jkl;
int x=100;
abc.i=0;abc.prev=&jkl;
abc.next=&def;
def.i=1;def.prev=&abc;def.next=&ghi;
ghi.i=2;ghi.prev=&def;
ghi.next=&jkl;
jkl.i=3;jkl.prev=&ghi;jkl.next=&abc;
x=abc.next->next->prev->next->i;
printf("%d",x);
} | | 1 |
| |
| For more C Code Interview Questions Click Here |