| |
|
| | | |
| | | |
|
| Question |
fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} | |
Question Submitted By :: Sid08 | |
I also faced this Question!! |
Rank |
Answer Posted By | | |
|
Re: fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} |
Answer
# 1 | 0 1 2 5 10  |
| Guest | | |
|
Re: fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} |
Answer
# 2 | 5  |
| Megha | | | |
| | | | |
|
Re: fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} |
Answer
# 3 | 0  |
| Divya | | |
|
Re: fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} |
Answer
# 4 | 0 1 2 5 10...Please don't post the wrong answer.  |
| Raj | | |
|
Re: fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} |
Answer
# 5 | it will print "0" i.e zero since compiler wont get to the
print statement until the value is zero.  |
| Mortal | | |
|
Re: fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} |
Answer
# 6 | Guest & Raj is correct.......
Please don't post the wrong answer if u r not clear about this  |
| Code | | |
|
Re: fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} |
Answer
# 7 | 0 1 2 5 10 is the answer. But can anybody explain why the
printing order 0 1 2 5 10. Why not 10 5 2 1 0 ? please...
Is it depends on stack allocation??  |
| Gg | | |
|
Re: fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} |
Answer
# 8 | 10,5,2,1
after that it terminated.  |
| Vinay | | | | |
| | |
|
|
| Other C Interview Questions |
| | | Question | Asked @ | Answers | | | | We can draw a box in cprogram by using only one printf();&
without using graphic.h header file? | NIIT | 1 | | What is the difference between char a[] = "string"; and
char *p = "string"; ? | Honeywell | 7 | | 1,4,8,13,21,30,36,45,54,63,73,?,?. | Franklin-Templeton | 3 | | the format specified for hexa decimal is
a.%d
b.%o
c.%x
d.%u
| TCS | 3 | | main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
what is the output?
| Ramco | 3 | |
main()
{
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d\n",x,y);
}
output?? | Ramco | 11 | | How do I declare a pointer to an array? | | 4 | | O,T,T,F,F,S,S,E,N,?,?,?,T,F,F,S,S,E,N | ADP | 5 | | why you will give me a job in TCS. | TCS | 5 | | How do you write a program which produces its own source
code as its output? | | 2 | | What is macro? | IBM | 3 | | Which of these statements are false w.r.t File Functions?
i)fputs() ii)fdopen() iii)fgetpos() iv)ferror()
A)ii B)i,ii C)iii D)iv
| Accenture | 3 | | Give the output for the following program.
#define STYLE1 char
main()
{
typedef char STYLE2;
STYLE1 x;
STYLE2 y;
clrscr();
x=255;
y=255;
printf("%d %d\n",x,y);
}
| ADITI | 1 | | what will be the result of the following program ?
char *gxxx()
{
static char xxx[1024];
return xxx;
}
main()
{
char *g="string";
strcpy(gxxx(),g);
g = gxxx();
strcpy(g,"oldstring");
printf("The string is :
%s",gxxx());
}
a) The string is : string
b) The string is :Oldstring
c) Run time error/Core dump
d) Syntax error during compilation
e) None of these
| IBM | 2 | | if ENTERED FIVE DIGITS DESIGN A PROGRAM THAT WILL FIND
CORRESPONDING VALUE FROM ASCII TABLE | | 1 | | If we have an array of Interger values, find out a sub array
which has a maximum value of the array and start and end
positions of the array..The sub array must be contiguious.
Take the start add to be 4000.
For Ex if we have an array arr[] =
{-1,-2,-5,9,4,3,-6,8,7,6,5,-3}
here the sub array of max would be
{8,7,6,5} coz the sum of max contiguous array is 8+7+6+5 =
26.The start and end position is 4014(8) and 4020(5). | Microsoft | 3 | | C passes By value or By reference? | Geometric-Software | 3 | | Explain in detail how strset (string handling function
works )pls explain it with an example. | | 1 | | How many ways are there to swap two numbers without using
temporary variable? Give the each logic. | | 4 | | what is the use of using linked list and array? | Infosys | 7 | | | | For more C Interview Questions Click Here |
|