| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
char *str1="abcd";
char str2[]="abcd";
printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
} | | 1 |
| Link list in reverse order. | NetApp | 7 |
| main()
{
int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
} | | 1 |
| how to delete an element in an array
| | 1 |
| void func1(int (*a)[10])
{
printf("Ok it works");
}
void func2(int a[][10])
{
printf("Will this work?");
}
main()
{
int a[10][10];
func1(a);
func2(a);
}
a. Ok it works
b. Will this work?
c. Ok it worksWill this work?
d. None of the above | HCL | 1 |
| String reverse with time complexity of n/2 with out using
temporary variable. | NetApp | 8 |
| String copy logic in one line. | NetApp | 9 |
| main()
{
char *p="GOOD";
char a[ ]="GOOD";
printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d",
sizeof(p), sizeof(*p), strlen(p));
printf("\n sizeof(a) = %d, strlen(a) = %d",
sizeof(a), strlen(a));
} | | 1 |
| main()
{
int i=5,j=10;
i=i&=j&&10;
printf("%d %d",i,j);
} | | 1 |
| Finding a number multiplication of 8 with out using
arithmetic operator | NetApp | 8 |
| write a program to Insert in a sorted list | Microsoft | 4 |
| Extend the sutherland-hodgman clipping algorithm to clip
three-dimensional planes against a regular paralleiepiped | IBM | 1 |
| main()
{
clrscr();
}
clrscr(); | | 1 |
| main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
} | | 1 |
| #define FALSE -1
#define TRUE 1
#define NULL 0
main() {
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts("FALSE");
} | | 1 |
| void main()
{
int const * p=5;
printf("%d",++(*p));
} | | 1 |
| main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
} | | 1 |
| Is there any difference between the two declarations,
1. int foo(int *arr[]) and
2. int foo(int *arr[2]) | | 1 |
| #include<conio.h>
main()
{
int x,y=2,z,a;
if(x=y%2) z=2;
a=2;
printf("%d %d ",z,x);
} | | 1 |
| #include<stdio.h>
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
} | | 1 |
| |
| For more C Code Interview Questions Click Here |