| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
char *p = “ayqm”;
printf(“%c”,++*(p++));
} | TCS | 2 |
| Finding a number which was log of base 2 | NetApp | 1 |
| struct point
{
int x;
int y;
};
struct point origin,*pp;
main()
{
pp=&origin;
printf("origin is(%d%d)\n",(*pp).x,(*pp).y);
printf("origin is (%d%d)\n",pp->x,pp->y);
} | | 1 |
| main()
{
int a[10];
printf("%d",*a+1-*a+3);
} | | 1 |
| how to delete an element in an array
| | 1 |
| main()
{
signed int bit=512, mBit;
{
mBit = ~bit;
bit = bit & ~bit ;
printf("%d %d", bit, mBit);
}
}
a. 0, 0
b. 0, 513
c. 512, 0
d. 0, -513 | HCL | 1 |
| main()
{
int i=5,j=10;
i=i&=j&&10;
printf("%d %d",i,j);
} | | 1 |
| main()
{
char not;
not=!2;
printf("%d",not);
} | | 1 |
| write the function. if all the character in string B appear in
string A, return true, otherwise return false. | Google | 10 |
| main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
} | | 1 |
| what will be the position of the file marker?
a: fseek(ptr,0,SEEK_SET);
b: fseek(ptr,0,SEEK_CUR); | | 1 |
| void main()
{
static int i=5;
if(--i){
main();
printf("%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 |
| 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=-1;
-i;
printf("i = %d, -i = %d \n",i,-i);
} | | 1 |
| Write a program that find and print how many odd numbers in
a binary tree | | 1 |
| write a program to count the number the same
(letter/character foreg: 's') in a given sentence. | | 1 |
| Program to Delete an element from a doubly linked list.
| Infosys | 4 |
| What is the subtle error in the following code segment?
void fun(int n, int arr[])
{
int *p=0;
int i=0;
while(i++<n)
p = &arr[i];
*p = 0;
} | | 1 |
| #define SQR(x) x * x
main()
{
printf("%d", 225/SQR(15));
}
a. 1
b. 225
c. 15
d. none of the above | HCL | 1 |
| |
| For more C Code Interview Questions Click Here |