1) Suppose u and v both have values of type set and u^v == u – v. From this we can conclude that:

a) u and v are identical
b) u and v are disjoint
c) u is a subset of v
d) v is a subset of u

Answer(s) : 
d) v is a subset of u

2) Suppose u and v both denote sets in Python. Under what condition can we guarantee that u – (u – v) == v?

a) This is true for any u and v.
b) The set u should be a subset of v.
c) The set v should be a subset of u.
d) The sets u and v should be disjoint.

Answer(s) : 
c) The set v should be a subset of u.

3) We have a list of values [17,98,89,42,67,54,89,25,38]. Suppose we build a max-heap by starting with an empty heap and inserting each value from the list into the heap, from left to right. The resulting heap will then be:

a) [98,67,89,38,42,54,89,17,25]
b) [98,89,67,42,17,89,54,25,38]
c) [98,89,89,67,54,42,38,25,17]
d) [98,89,67,17,42,54,89,25,38]

Answer(s) : 
a) [98,67,89,38,42,54,89,17,25]

4) Suppose we insert the value 97 into the heap built in the previous question. The resulting heap will then be:

a) [98,97,67,42,89,89,54,25,38,17]
b) [98,97,89,67,89,42,38,25,17,54]
c) [98,97,89,38,67,54,89,17,25,42]
d) [98,97,89,67,17,89,54,25,38,42]

Answer(s) : 
c) [98,97,89,38,67,54,89,17,25,42]
Categories: NPTEL solution

4 Comments

Mayuresh Vartak · August 16, 2017 at 2:15 PM

Thank u Sir ,Can you please upload week 3 programming assignment. Please sir.

AbrahamJohn · August 20, 2017 at 12:32 PM

Please post week 4 assignment solution.

    raghu · August 25, 2017 at 12:36 PM

    share the link of week 4 programming assignment python nptel solution please

Saurab.B · August 25, 2017 at 5:14 PM

Please post week 4 assignment solution.

Leave a Reply

Your email address will not be published. Required fields are marked *