| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| Evaluate the following:
int fn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return fn(v/2)+2;
else
return fn(v-1)+3;
}
for fn(7);
1) 10
2) 11
3) 1
| | 6 |
| what is the maximum no. of bytes calloc can allocate | Mphasis | 2 |
| Write a program to generate prime factors of a given integer? | | 3 |
| write a c program to check weather a particluar bit is set
or not? | IBM | 4 |
| main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n",x,y);
}
| CitiGroup | 17 |
| Tell about strtok & strstr functions | Motorola | 2 |
| what is the diference between pointer to the function and
function to the pointer? | | 2 |
| What will be the result of the following program?
main()
{
char p[]="String";
int x=0;
if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation
| IBM | 10 |
| 15.what is the disadvantage of using macros?
16.what is the self-referential structure?
17.can a union be self-referenced?
18.What is a pointer?
19.What is the Lvalue and Rvalue?
20.what is the difference between these initializations?
21.Char a[]=”string”;
22.Char *p=”literal”;
23.Does *p++ increment p, or what it points to? | CTS | 2 |
| struct ptr
{
int a;
char b;
int *p;
}abc;
what is d sizeof structure without using "sizeof" operator?? | Verifone | 8 |
| #define min((a),(b)) ((a)<(b))?(a):(b)
main()
{
int i=0,a[20],*ptr;
ptr=a;
while(min(ptr++,&a[9])<&a[8]) i=i+1;
printf("i=%d\n",i);}
| | 3 |
| CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION. | | 6 |
| What is external and internal variables
What is dynamic memory allocation
what is storage classes in C | | 2 |
| program to find the ASCII value of a number | | 5 |
| n=7623
{
temp=n/10;
result=temp*10+ result;
n=n/10
}
| Wipro | 4 |
| if a five digit number is input through the keyboard, write
a program to calculate the sum of its digits.
(hint:-use the modulus operator.'%') | | 9 |
| What is the meaning When we write "#include" what is # and
what does include does there??? | HCL | 11 |
| who is the founder of c | HP | 9 |
| for(i=1;i>0;i++);
printf("i=%d",i);
what will be the answer???? | | 6 |
| what is the differance between pass by reference and pass
by value. | Infosys | 4 |
| |
| For more C Interview Questions Click Here |