Question
void fun(int n)
{
if (n == 0)
return;
printf("%d", n%2);
fun(n/2);
}
a.
11001
b.
10011
c.
11111
d.
00000
Posted under Data Structures and Algorithms
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What does the following function print for n = 25? void fun(int n) { if (n == 0) return; printf("%d", n%2); fun(n/2); }
Similar Questions
Discover Related MCQs
Q. ________________ is a powerful technique which is used to invoke a function.
View solution
Q. A function, which invokes itself repeatedly until some condition is satisfied, is called a_________.
View solution
Q. The number of recursive calls is limited to the _____ of the stack.
View solution
Q. Two or more functions, which invoke (call) each other, are called_________________.
View solution
Q. For certain problems, a recursive solution is ____________as in the case of factorial of a number.
View solution
Q. A recursive function is often less efficient compared to an iterative function. But it is more________.
View solution
Q. An iterative function is preferred when its recursive equivalent is__________.
View solution
Q. What is a good approach to remove recursion from an algorithm?
View solution
Q. A subroutine can be coded so that it may call itself recursively, at___________, in order to perform its task.
View solution
Q. For implementing recursive function the data structure used is:
View solution
Q. Which of the following algorithm cannot be designed without recursion?
View solution
Q. If there is no base criteria in a recursive program, the program will ................
View solution
Q. Infinite recursion leads to ...............
View solution
Q. Recursion is memory-intensive because:
View solution
Q. Part of a recursive algorithm that handles a simple input that can be solved without resorting to a recursive call, is known as
View solution
Q. A recursive agorithm must have
View solution
Q. If an algorithm calls itself to do some part of work, it is said to be
View solution
Q. For which of the following cases will the reversal of a string be equal to the original string?
View solution
Q. Recursion is a method in which the solution of a problem depends on ____________
View solution
Q. Which of the following problems can be solved using recursion?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Data Structures and Algorithms? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!