**DOWNLOAD FREE PDF** **<<CLICK HERE>>**

## Data Structure Questions and Answers-Minimum Number of Jumps

Congratulations - you have completed *Data Structure Questions and Answers-Minimum Number of Jumps*.

You scored %%SCORE%% out of %%TOTAL%%.

Your performance has been rated as %%RATING%%

Your answers are highlighted below.

Question 1 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER] |

You are given an array of elements where each array element represents the MAXIMUM number of jumps that can be made in the forward direction from that element. You have to find the minimum number of jumps that are required to reach the end of the array. Which of these methods can be used to solve the problem?

Dynamic Programming | |

Greedy Algorithm | |

Recursion | |

All of the mentioned |

Question 1 Explanation:

Both recursion and dynamic programming can be used to solve minimum number of jumps problem.

Question 2 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER] |

Consider the following array:

{1, 3, 5, 8, 9, 2, 6, 7, 6}

What is the minimum number of jumps required to reach the end of the array?

1 | |

2 | |

3 | |

4 |

Question 2 Explanation:

The jumps made will be:{1 -> 2 -> 4 -> 9}. So, the number of jumps is three.

Question 3 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER] |

Consider the following recursive implementation:

#include<stdio.h> #include<limits.h> int min....jumps(int *arr, int strt, int end) { int idx; if(strt == end) return 0; if(arr[strt] == 0) // jump cannot be made return INT....MAX; int min = INT....MAX; for(idx = 1; idx <= arr[strt] && strt + idx <= end; idx++) { int jumps = min....jumps(....., ....., .....) + 1; if(jumps < min) min = jumps; } return min; } int main() { int arr[] ={1, 3, 5, 8, 9, 2, 6, 7, 6}, len = 9; int ans = min....jumps(arr, 0, len-1); printf("%d\n", ans); return 0; }

Which of these arguments should be passed by the min....jumps function represented by the blanks?

arr, strt + id, x end | |

arr + id, x strt, end | |

arr, strt, end | |

arr, strt, end + idx |

Question 3 Explanation:

arr, strt + id, x end should be passed as arguments.

Question 4 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER] |

For a given array, there can be multiple ways to reach the end of the array using minimum number of jumps.

True | |

False |

Question 4 Explanation:

Consider the array {1, 2, 3, 4, 5}. It is possible to reach the end in the following ways: {1 -> 2 -> 3 -> 5} or {1 -> 2 -> 4 -> 5}.

In both the cases the number of jumps is 3, which is minimum. Hence, it is possible to reach the end of the array in multiple ways using minimum number of jumps.

Question 5 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER] |

What is the output of the following program?

#include<stdio.h> #include<limits.h> int min....jumps(int *arr, int strt, int end) { int idx; if(strt == end) return 0; if(arr[strt] == 0) // jump cannot be made return INT....MAX; int min = INT....MAX; for(idx = 1; idx <= arr[strt] && strt + idx <= end; idx++) { int jumps = min....jumps(arr, strt + idx, end) + 1; if(jumps < min) min = jumps; } return min; } int main() { int arr[] ={1, 2, 3, 4, 5, 4, 3, 2, 1}, len = 9; int ans = min....jumps(arr, 0, len-1); printf("%d\n", ans); return 0; }

4 | |

5 | |

6 | |

7 |

Question 5 Explanation:

The program prints the minimum number of jumps required to reach the end of the array. One way reach the end using minimum number of jumps is

{1 -> 2 -> 4 -> 8 -> 9}. So, the number of jumps is 4.

Once you are finished, click the button below. Any items you have not completed will be marked incorrect.

There are 5 questions to complete.