| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| Given n nodes. Find the number of different structural
binary trees that can be formed using the nodes. | Aricent | 7 |
| 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 |
| Program to find the largest sum of contiguous integers in
the array. O(n) | | 7 |
| void main()
{
int i;
char a[]="\0";
if(printf("%s\n",a))
printf("Ok here \n");
else
printf("Forget it\n");
} | | 1 |
| String reverse with time complexity of n/2 with out using
temporary variable. | NetApp | 8 |
| main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++) {
printf(" %d ",*c);
++q; }
for(j=0;j<5;j++){
printf(" %d ",*p);
++p; }
} | | 1 |
| How to return multiple values from a function?
| | 4 |
| main()
{
extern int i;
i=20;
printf("%d",i);
} | | 1 |
| main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
} | | 1 |
| Write out a function that prints out all the permutations of
a string.
For example, abc would give you abc, acb, bac, bca, cab,
cba. You can assume that all the characters will be unique. | Microsoft | 4 |
| #if something == 0
int some=0;
#endif
main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
} | | 1 |
| main( )
{
char *q;
int j;
for (j=0; j<3; j++) scanf(“%s” ,(q+j));
for (j=0; j<3; j++) printf(“%c” ,*(q+j));
for (j=0; j<3; j++) printf(“%s” ,(q+j));
} | | 1 |
| main()
{
char not;
not=!2;
printf("%d",not);
} | | 1 |
| Link list in reverse order. | NetApp | 7 |
| main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
} | | 1 |
| main(){
char a[100];
a[0]='a';a[1]]='b';a[2]='c';a[4]='d';
abc(a);
}
abc(char a[]){
a++;
printf("%c",*a);
a++;
printf("%c",*a);
} | | 1 |
| main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
} | | 1 |
| union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l;
}st;
int i;
}u;
main()
{
u.i = 100;
printf("%d, %d, %d",u.i, u.st.i, u.st.l);
}
a. 4, 4, 0
b. 0, 0, 0
c. 100, 4, 0
d. 40, 4, 0 | HCL | 1 |
| main()
{
show();
}
void show()
{
printf("I'm the greatest");
} | | 1 |
| #include <stdio.h>
main()
{
char * str = "hello";
char * ptr = str;
char least = 127;
while (*ptr++)
least = (*ptr<least ) ?*ptr :least;
printf("%d",least);
} | | 1 |
| |
| For more C Code Interview Questions Click Here |