

MCQOPTIONS
Saved Bookmarks
This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.
1. |
What will be the value stored in arr[2][2] when the following code is executed? |
A. | 0 |
B. | 1 |
C. | 2 |
D. | 3View Answer |
Answer» C. 2 | |
2. |
What is space complexity of the following 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? |
A. | O(n*f) |
B. | O(f*s) |
C. | O(n*s) |
D. | O(n*f*s)View Answer |
Answer» D. O(n*f*s)View Answer | |
3. |
What is time complexity of the following 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? |
A. | O(n*f) |
B. | O(f*s) |
C. | O(n*s) |
D. | O(n*f*s)View Answer |
Answer» E. | |
4. |
Consider the following dynamic programming implementation of the dice throw problem: Which of the following lines should be added to complete the above code? |
A. | arr[num_of_dice][S] |
B. | arr[dice][sm] |
C. | arr[dice][S] |
D. | arr[S][dice] View Answer |
Answer» B. arr[dice][sm] | |
5. |
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?$ |
A. | O(n*f) |
B. | O(f*s) |
C. | O(n*s) |
D. | O(n*f*s) |
Answer» B. O(f*s) | |
6. |
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?$ |
A. | O(n*f) |
B. | O(f*s) |
C. | O(n*s) |
D. | O(n*f*s) |
Answer» D. O(n*f*s) | |
7. |
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 |
Answer» B. 2 | |
8. |
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? |
A. | 1 |
B. | f |
C. | n |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
9. |
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 |
Answer» D. 3 | |
10. |
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? |
A. | n*n*n…f times |
B. | f*f*f…n times |
C. | n*n*n…n times |
D. | f*f*f…f times |
Answer» C. n*n*n‚Äö√Ñ√∂‚àö√묨‚àÇn times | |
11. |
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? |
A. | Brute force |
B. | Recursion |
C. | Dynamic programming |
D. | All of the mentioned |
Answer» E. | |