| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
} | | 1 | | Is the following statement a declaration/definition. Find
what does it mean?
int (*x)[10]; | | 1 | | main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
} | | 1 | | how to check whether a linked list is circular. | | 3 | | main()
{
int a=10,*j;
void *k;
j=k=&a;
j++;
k++;
printf("\n %u %u ",j,k);
} | | 1 | | main()
{
int c = 5;
printf("%d", main||c);
}
a. 1
b. 5
c. 0
d. none of the above | HCL | 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=_l_abc(10);
printf("%d\n",--i);
}
int _l_abc(int i)
{
return(i++);
} | | 1 | | Given an array of characters which form a sentence of words,
give an efficient algorithm to reverse the order of the words
(not characters) in it. | Wipro | 2 | | 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 | | 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()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
} | | 1 | | What are the files which are automatically opened when a C
file is executed? | | 1 | | Give a one-line C expression to test whether a number is a
power of 2. | Microsoft | 8 | | 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 | | void main()
{
static int i;
while(i<=10)
(i>2)?i++:i--;
printf(“%d”, i);
} | | 1 | | main()
{
char *cptr,c;
void *vptr,v;
c=10; v=0;
cptr=&c; vptr=&v;
printf("%c%v",c,v);
} | | 1 | | main()
{
int i=400,j=300;
printf("%d..%d");
} | | 1 | | What are segment and offset addresses? | Infosys | 1 | | #define max 5
#define int arr1[max]
main()
{
typedef char arr2[max];
arr1 list={0,1,2,3,4};
arr2 name="name";
printf("%d %s",list[0],name);
} | | 1 | | | | For more C Code Interview Questions Click Here |
|