Programming, Data Structures and Algorithms Using Python - Unit 15 - Week 6 Quiz
Programming, Data Structures and Algorithms Using Python - Unit 15 - Week 6 Quiz
Week 6 Quiz
The due date for submitting this assignment has passed.
Due on 2022-09-07, 23:59 IST.
As per our records you have not submitted this assignment.
All questions carry equal weightage. All Python code is assumed to be executed using Python3. You may submit as many times as you like within the deadline. Your final submission will be
graded.
Note:
If the question asks about a value of type string, remember to enclose your answer in single or double quotes.
If the question asks about a value of type list, remember to enclose your answer in square brackets and use commas to separate list items.
Suppose u and v both have values of type set and are disjoint. Which of the following expressions evaluates to True? 2.5 points
u == v | (u^v)
u == (v^u)
u == v^(u | v)
u == u^(v | u)
No, the answer is incorrect.
Score: 0
Feedback:
Check set theoretically.
Accepted Answers:
u == v^(u | v)
Suppose u and v both denote sets in Python. What is the most general condition that guarantees that u|v == u^v? 2.5 points
Feedback:
u^v has all elements that are in exactly one of u or v. This is the same as u|v - u&v. Since u^v = u|v, we have u&v is empty,
so u and v are disjoint.
Accepted Answers:
The sets u and v should be disjoint.
Consider the min-heap [15, 27, 33, 39, 66, 39, 47, 58, 51]. built by repeatedly inserting values into an empty heap. Which of 2.5 points
the following could not have been the last element inserted into this heap?
27
15
58
51
No, the answer is incorrect.
Score: 0
Feedback:
The last position added was the one containing 51. The last element added must lie on the path from 51 to the root: {15, 27, 39, 51}.
Accepted Answers:
58
Suppose we execute delete-min twice on the min-heap [13,29,24,67,52,89,45,98,79,58]. What is the resulting heap?
Feedback:
The original heap is:
13
/ \
29 24
/ \ / \
67 52 89 45
/ \ /
98 79 58
24
/ \
29 45
/ \ / \
67 52 89 58
/ \
98 79
https://onlinecourses.nptel.ac.in/noc22_cs70/unit?unit=79&assessment=129 1/2
9/20/22, 8:53 PM Programming, Data Structures And Algorithms Using Python - - Unit 15 - Week 6 Quiz
29
/ \
52 45
/ \ / \
67 79 89 58
98
Accepted Answers:
(Type: Regex Match) [ ]*[29[ ]*,[ ]*52[ ]*,[ ]*45[ ]*,[ ]*67[ ]*,[ ]*79[ ]*,[ ]*89[ ]*,[ ]*58[ ]*,[ ]*98[ ]*][ ]*
2.5 points
https://onlinecourses.nptel.ac.in/noc22_cs70/unit?unit=79&assessment=129 2/2