## ONLINE TEST 9-12 AM | Solution for NPTEL Programming, Data Structures and Algorithms using Python

Question – 1 :- Here is an function to return the maximum value in a list. There is an error in this function. Provide an input list for which `maxbad` produces an incorrect output. def maxbad(l): end = len(l) – 1 mymax = l[-1] for i in range(end,0,-1): if l[i] > Read more…

## Solution for NPTEL, Introduction to Algorithm and Analysis Week 6 MCQs

1) Consider the Red Black Tree given below, given that the node containing key value 35 is red, how many black nodes are there in the red black tree?(Do not count the nils) A). 3 B). 2 C). 5 D). 6 Answer(s) : C). 5 [quads id=1] 2) Which of Read more…

## Solution for NPTEL Programming, Data Structures and Algorithms using Python Week 7 MCQs

1) Given the following permutation of a,b,c,d,e,f,g,h,i,j, what is the next permutation in lexicographic (dictionary) order? Write your answer without any blank spaces between letters. bfaijhgedc Answer(s) : bfajcdeghi 2) We want to add a function sum() to the class Node that implements user defined lists of numbers which will Read more…

## Solution for NPTEL Programming, Data Structures and Algorithms using Python Week 6 MCQs

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) Read more…

## Solution for NPTEL, Introduction to Modern Application Development(IMAD) Week 6 MCQs

1) What is the importance of the Cocoa Touch Layer : a) It contains frameworks that define the appearance of the app b) It provides the basic App Infrastructure c) Provides support for multitasking d) All of the above Answer(s) : d) All of the above 2) Which layer is Read more…

## Solution for NPTEL, Introduction to Modern Application Development(IMAD) Week 5 MCQs

1) How many threads are created by asyncTask in Android? a) Only one b) Two c) AsyncTask doesn’t have threads. d) None of the above Answer(s) : a) Only one 2) What is the application class in android? a) A class that can create only an object. b) Anonymous class Read more…

## Solution for NPTEL Programming, Data Structures and Algorithms using Python, Week 4 Programming Assignment

Question :- Write a Python function frequency(l) that takes as input a list of integers and returns a pair of the form (minfreqlist,maxfreqlist) where minfreqlist is a list of numbers with minimum frequency in l, sorted in ascending order maxfreqlist is a list of numbers with maximum frequency in l, Read more…

## Solution for NPTEL, Introduction to Algorithm and Analysis Week 5 MCQs

1.A collision in hash function means A). Two keys match to same slot B). Two keys match to two consecutive slots C). Both A) and B). D). None of the above Ans: A). Two keys match to same slot 2.In chaining, we put all those elements into same linked list Read more…

## Solution for NPTEL Programming, Data Structures and Algorithms using Python, Week 5 Programming Assignment

Solution :- Download Python File :- Download import operator input(”) class Stu: def __init__(self, name, fname): self.name = name self.fname = fname self.num = 0 self.total = 0 def add(self, gr): self.num +=1 if gr==”A”: self.total +=10 elif gr==”AB”: self.total+=9 elif gr==”B”: self.total+=8 elif gr==”BC”: self.total+=7 elif gr==”C”: self.total+=6 elif Read more…

## Solution for NPTEL Programming, Data Structures and Algorithms using Python, Week 4 Programming Assignment

Question :- Write a Python function frequency(l) that takes as input a list of integers and returns a pair of the form (minfreqlist,maxfreqlist) where minfreqlist is a list of numbers with minimum frequency in l, sorted in ascending order maxfreqlist is a list of numbers with maximum frequency in l, Read more…