| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
char *p = “ayqm”;
printf(“%c”,++*(p++));
} | TCS | 2 |
| 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 |
| void main()
{
int i;
char a[]="\0";
if(printf("%s\n",a))
printf("Ok here \n");
else
printf("Forget it\n");
} | | 1 |
| main()
{
int i=5;
printf("%d",++i++);
} | | 1 |
| Printf can be implemented by using __________ list. | | 1 |
| main()
{
char *p;
p="%d\n";
p++;
p++;
printf(p-2,300);
} | | 1 |
| main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
} | | 1 |
| main()
{
int a[10];
printf("%d",*a+1-*a+3);
} | | 1 |
| main()
{
if (!(1&&0))
{
printf("OK I am done.");
}
else
{
printf("OK I am gone.");
}
}
a. OK I am done
b. OK I am gone
c. compile error
d. none of the above | HCL | 1 |
| void main()
{
int i=5;
printf("%d",i+++++i);
} | | 1 |
| write a program in c to merge two array | | 1 |
| #define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
} | | 1 |
| main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
} | | 1 |
| main()
{
char *p = “ayqm”;
char c;
c = ++*p++;
printf(“%c”,c);
} | | 1 |
| main()
{
if ((1||0) && (0||1))
{
printf("OK I am done.");
}
else
{
printf("OK I am gone.");
}
}
a. OK I am done
b. OK I am gone
c. compile error
d. none of the above | HCL | 1 |
| Which version do you prefer of the following two,
1) printf(“%s”,str); // or the more curt one
2) printf(str); | | 1 |
| main()
{
char name[10],s[12];
scanf(" \"%[^\"]\"",s);
}
How scanf will execute? | | 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.
| Microsoft | 7 |
| #define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
} | | 1 |
| Program to Delete an element from a doubly linked list.
| Infosys | 4 |
| |
| For more C Code Interview Questions Click Here |