| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| how to delete an element in an array
| | 1 |
| #include<stdio.h>
main()
{
int i=1,j=2;
switch(i)
{
case 1: printf("GOOD");
break;
case j: printf("BAD");
break;
}
} | | 1 |
| 1)
int i=5;
j=i++ + i++ + i++;
printf("%d",j);This code gives the answer 15.But if we
replace the value of the j then anser is different?why?
2)int i=5;
printf("%d",i++ + i++ + i++);
this givs 18. | Infosys | 6 |
| main()
{
int i, j, *p;
i = 25;
j = 100;
p = &i; // Address of i is assigned to pointer p
printf("%f", i/(*p) ); // i is divided by pointer p
}
a. Runtime error.
b. 1.00000
c. Compile error
d. 0.00000 | HCL | 1 |
| main()
{
int i=400,j=300;
printf("%d..%d");
} | | 1 |
| Give a oneline C expression to test whether a number is a
power of 2?
| Motorola | 16 |
| Write a program that find and print how many odd numbers in
a binary tree | | 1 |
| 1
o 1
1 0 1
0 1 0 1
1 0 1 0 1
how to design this function format in c-language ? | | 1 |
| struct Foo
{
char *pName;
char *pAddress;
};
main()
{
struct Foo *obj = malloc(sizeof(struct Foo));
clrscr();
obj->pName = malloc(100);
obj->pAddress = malloc(100);
strcpy(obj->pName,"Your Name");
strcpy(obj->pAddress, "Your Address");
free(obj);
printf("%s", obj->pName);
printf("%s", obj->pAddress);
}
a. Your Name, Your Address
b. Your Address, Your Address
c. Your Name Your Name
d. None of the above | HCL | 1 |
| 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 |
| main()
{
{
unsigned int bit=256;
printf("%d", bit);
}
{
unsigned int bit=512;
printf("%d", bit);
}
}
a. 256, 256
b. 512, 512
c. 256, 512
d. Compile error | HCL | 1 |
| programming in c lanugaue programm will errror error with
two header file one as stdio.h and other one is conio.h | | 1 |
| main()
{
int i=300;
char *ptr = &i;
*++ptr=2;
printf("%d",i);
} | | 1 |
| Extend the sutherland-hodgman clipping algorithm to clip
three-dimensional planes against a regular paralleiepiped | IBM | 1 |
| int i,j;
for(i=0;i<=10;i++)
{
j+=5;
assert(i<5);
} | | 1 |
| main()
{
extern i;
printf("%d\n",i);
{
int i=20;
printf("%d\n",i);
}
} | | 1 |
| why java is platform independent? | Wipro | 10 |
| Write a C function to search a number in the given list of
numbers. donot use printf and scanf | Honeywell | 4 |
| main()
{
int i=5,j=10;
i=i&=j&&10;
printf("%d %d",i,j);
} | | 1 |
| #define DIM( array, type) sizeof(array)/sizeof(type)
main()
{
int arr[10];
printf(“The dimension of the array is %d”, DIM(arr,
int));
} | | 1 |
| |
| For more C Code Interview Questions Click Here |