adplus-dvertising

Welcome to the Dynamic Programming MCQs Page

Dive deep into the fascinating world of Dynamic Programming with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Dynamic Programming, a crucial aspect of Data Structures and Algorithms. In this section, you will encounter a diverse range of MCQs that cover various aspects of Dynamic Programming, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Data Structures and Algorithms.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Dynamic Programming. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Data Structures and Algorithms.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Dynamic Programming. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Dynamic Programming MCQs | Page 20 of 22

Q191.
You are given n dice each having f faces. You have to find the number of ways in which a sum of S can be achieved. This is the dice throw problem. Which of the following methods can be used to solve the dice throw problem?
Discuss
Answer: (d).All of the mentioned
Q192.
You have n dice each having f faces. What is the number of permutations that can be obtained when you roll the n dice together?
Discuss
Answer: (b).f*f*f…n times
Q193.
You have 3 dice each having 6 faces. What is the number of permutations that can be obtained when you roll the 3 dice together?
Discuss
Answer: (c).216
Q194.
You have 2 dice each of them having 6 faces numbered from 1 to 6. What is the number of ways in which a sum of 11 can be achieved?

a.

0

b.

1

c.

2

d.

3

Discuss
Answer: (c).2
Q195.
There are n dice with f faces. The faces are numbered from 1 to f. What is the minimum possible sum that can be obtained when the n dice are rolled together?
Discuss
Answer: (c).n
Q196.
There are n dice with f faces. The faces are numbered from 1 to f. What is the maximum possible sum that can be obtained when the n dice are rolled together?
Discuss
Answer: (d).n*f
Q197.
There are 10 dice having 5 faces. The faces are numbered from 1 to 5. What is the number of ways in which a sum of 4 can be achieved?

a.

0

b.

2

c.

4

d.

8

Discuss
Answer: (a).0
Q198.
Consider the following dynamic programming implementation of the dice throw problem.
Which of the following lines should be added to complete thebelow code?
#include<stdio.h>
int get_ways(int num_of_dice, int num_of_faces, int S)
{
     int arr[num_of_dice + 1][S + 1];
     int dice, face, sm;
     for(dice = 0; dice <= num_of_dice; dice++)
         for(sm = 0; sm <= S; sm++)
           arr[dice][sm] = 0;
     for(sm = 1; sm <= S; sm++)
         arr[1][sm] = 1;
     for(dice = 2; dice <= num_of_dice; dice++)
     { 
         for(sm = 1; sm <= S; sm++)
         {
             for(face = 1; face <= num_of_faces && face < sm; face++)
                 arr[dice][sm] += arr[dice - 1][sm - face];
         }
     }
     return _____________;
}
int main()
{
     int num_of_dice = 3, num_of_faces = 4, sum = 6;
     int ans = get_ways(num_of_dice, num_of_faces, sum);
     printf("%d",ans);
     return 0;
}

Discuss
Answer: (a).arr[num_of_dice][S].
Q199.
What is time complexity of the above dynamic programming implementation of the dice throw problem where f is the number of faces, n is the number of dice and s is the sum to be found?
Discuss
Answer: (d).O(n*f*s)
Q200.
What is space complexity of the above dynamic programming implementation of the dice throw problem where f is the number of faces, n is the number of dice and s is the sum to be found?
Discuss
Answer: (c).O(n*s)

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!