Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

HackerRank Recursion and Heap Quiz-1

Question 1

Time: 00:00:00
The method of repeating items in a self similar way is defined as

Binary Search

Binary Search

Recursion

Recursion

Repetition

Repetition

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Among programming languages, if a program lets you call a function within the same function, it is named a function as

Call by value

Call by value

Call by function

Call by function

Recursive call of the function

Recursive call of the function

Recursive call of the value

Recursive call of the value

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Recursive functions help to solve several mathematical problems, such as

Factorial

Factorial

Fibonacci series

Fibonacci series

Tree traversal

Tree traversal

All the mentioned

All the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Recursion is a way of solving a problem where the solution varies depending on solutions as

Smaller instances of the same problem

Smaller instances of the same problem

Smaller instances of different problem

Smaller instances of different problem

Larger instances of the different problem

Larger instances of the different problem

Larger instances of the same problem

Larger instances of the same problem

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is the output of the code given below ?

#include
int fact (int i)
{

if (i <= 1)
{
return 1;
}
return i * fact (i - 1);
}

int main ()
{
int i = 10;
printf ("Factorial of %d is %d\n", i, fact (i));
return 0;
}

Factorial of 10 is 3622800

Factorial of 10 is 3622800

Factorial of 10 is 3662800

Factorial of 10 is 3662800

Factorial of 10 is 3628800

Factorial of 10 is 3628800

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What's the Recursion-Iteration difference?

recursion is a method being called is the same as the one making the call while iteration is when a loop is repeatedly executed until a certain condition is meet

recursion is a method being called is the same as the one making the call while iteration is when a loop is repeatedly executed until a certain condition is meet

recursion is a method being called when a loop is repeatedly executed until a certain condition is meet while iteration is method being called is the same as the one making the call

recursion is a method being called when a loop is repeatedly executed until a certain condition is meet while iteration is method being called is the same as the one making the call

Both

Both

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
What is the result of the following C programming code?
#include
int fibo (int i)
{
if (i == 0)
{
return 0;
}
if (i == 1)
{
return 1;
}
return fibo (i - 1) + fibo (i - 2);
}
int main ()
{
int i;
printf("The fibonacci series is : ");
for (i = 0; i < 5; i++)
{
printf ("%d ", fibo (i));
}
return 0;
}

The Fibonacci series is: 0 0 1 2 3

The Fibonacci series is: 0 0 1 2 3

The Fibonacci series is: 1 2 3 4 5

The Fibonacci series is: 1 2 3 4 5

The Fibonacci series is: 0 1 1 2 3

The Fibonacci series is: 0 1 1 2 3

The Fibonacci series is: 0 1 2 3 4

The Fibonacci series is: 0 1 2 3 4

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
In recursion the condition the function stops attempting to call itself is known as

recursion case

recursion case

base case

base case

best case

best case

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What is the result of the following C programming code?
#include
void prepinsta(int n)
{
if(n == 0)
return;
prepinsta(n-1);
printf(" %d ",n);
}
int main()
{
printf("It will print :");
prepinsta(5);
return 0;
}

It will print : 1 2 3 4 5

It will print : 1 2 3 4 5

It will print : 0 1 2 3 4

It will print : 0 1 2 3 4

It will print : 2 4 6 8 10

It will print : 2 4 6 8 10

It will print : -4 -3 -2 -1 0

It will print : -4 -3 -2 -1 0

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
In recursion, the condition the function attempting to call itself is known as

worst case

worst case

best case

best case

base case

base case

recursion case

recursion case

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]