# programming data structures and algorithms using python nptel previous question papers

### Mohammed

Guys, does anyone know the answer?

get programming data structures and algorithms using python nptel previous question papers from screen.

## Programming, Data Structures And Algorithms Using Python

Courses >

## Programming, Data Structures And Algorithms Using Python

By Prof. Madhavan Mukund | Chennai Mathematical Institute

Learners enrolled: 41541

This course is an introduction to programming and problem solving in Python. It does not assume any prior knowledge of programming. Using some motivating examples, the course quickly builds up basic concepts such as conditionals, loops, functions, lists, strings and tuples. It goes on to cover searching and sorting algorithms, dynamic programming and backtracking, as well as topics such as exception handling and using files. As far as data structures are concerned, the course covers Python dictionaries as well as classes and objects for defining user defined datatypes such as linked lists and binary search trees.

**INTENDED AUDIENCE:**Students in any branch of mathematics/science/engineering, 1st year

**PREREQUISITES:**School level mathematics.

**INDUSTRY SUPPORT:**This course should be of value to any company requiring programming skills.

Summary

Course Status : Completed

Course Type : Elective

Duration : 8 weeks

Start Date : 14 Sep 2020

End Date : 06 Nov 2020

Exam Date : 18 Dec 2020 IST

Enrollment Ends : 25 Sep 2020

Category :

Computer Science and Engineering

Programming Data Science

Artificial Intelligence

Foundations of Computing

Credit Points : 2

Level : Undergraduate

Facebook Twitter Email LinkedIn WhatsApp Share

### Course layout

**Week 1**Informal introduction to programmin, algorithms and data structures viagcd

Downloading and installing Python

gcd in Python: variables, operations, control flow - assignments, condition-als, loops, functions

**Week 2**Python: types, expressions, strings, lists, tuples

Python memory model: names, mutable and immutable values

List operations: slices etc

Binary search

Inductive function denitions: numerical and structural induction

Elementary inductive sorting: selection and insertion sort

In-place sorting

**Week 3**Basic algorithmic analysis: input size, asymptotic complexity, O() notation

Arrays vs lists Merge sort Quicksort Stable sorting

**Week 4**Dictionaries

More on Python functions: optional arguments, default values

Passing functions as arguments

Higher order functions on lists: map, lter, list comprehension

**Week 5**Exception handling

Basic input/output Handling files String processing

**Week 6**Backtracking: N Queens, recording all solutions

Scope in Python: local, global, nonlocal names

Nested functions

Data structures: stack, queue

Heaps

**Week 7**Abstract datatypes

Classes and objects in Python

"Linked" lists: find, insert, delete

Binary search trees: find, insert, delete

Height-balanced binary search trees

**Week 8**Effcient evaluation of recursive denitions: memoization

Dynamic programming: examples

Other programming languages: C and manual memory management

Other programming paradigms: functional programming

### Books and references

NIL

### Instructor bio

### Prof. Madhavan Mukund

Chennai Mathematical Institute

Madhavan Mukund studied at IIT Bombay (BTech) and Aarhus University (PhD). He has been a faculty member at Chennai Mathematical Institute since 1992, where he is presently Professor and Dean of Studies. His main research area is formal verification. He has active research collaborations within and outside India and serves on international conference programme committees and editorial boards of journals.

He has served as President of both the Indian Association for Research in Computing Science (IARCS) (2011-2017) and the ACM India Council (2016-2018). He has been the National Coordinator of the Indian Computing Olympiad since 2002. He served as the Executive Director of the International Olympiad in Informatics from 2011-2014.

In addition to the NPTEL MOOC programme, he has been involved in organizing IARCS Instructional Courses for college teachers. He is a member of ACM India's Education Committee. He has contributed lectures on algorithms to the Massively Empowered Classroom (MEC) project of Microsoft Research and the QEEE programme of MHRD.

### Course certificate

The course is free to enroll and learn from. But if you want a certificate, you have to register and write the proctored exam conducted by us in person at any of the designated exam centres.

The exam is optional for a fee of Rs 1000/- (Rupees one thousand only).

Date and Time of Exams: **18**** December 2020** Morning session 9am to 12 noon; Afternoon Session 2pm to 5pm.

Registration url: Announcements will be made when the registration form is open for registrations.

The online registration form has to be filled and the certification exam fee needs to be paid. More details will be made available when the exam registration form is published. If there are any changes, it will be mentioned then.

स्रोत : **onlinecourses.nptel.ac.in**

## NPTEL Programming Data Structures And Algorithms Using Python ASSIGNMENT 2021

NPTEL Programming Data Structures And Algorithms Using Python This course is an introduction to programming and problem-solving in Python. This course helps students to understand the concepts of data structures and algorithms using python, without having any prior knowledge of programming concepts. Programming Data Structures And Algorithms Using Python is a MOOC course offered by… Read More »NPTEL Programming Data Structures And Algorithms Using Python ASSIGNMENT 2021

## NPTEL Programming Data Structures And Algorithms Using Python ASSIGNMENT 2021

by QuizXp TeamAugust 10, 2021

**NPTEL Programming Data Structures And Algorithms Using Python**This course is an introduction to programming and problem-solving in Python. This course helps students to understand the concepts of data structures and algorithms using python, without having any prior knowledge of programming concepts.

**Programming Data Structures And Algorithms Using Python**is a MOOC course offered by IIT Kharagpur on the NPTEL platform. This course helps the students to achieve problem-solving methods through a programming language. The course is developed by

**Prof. Madhavan Mukund studied at IIT Bombay (BTech) and Aarhus University (PhD).**

**Who Can Join:**All UG/PG students.

**Requirements/Prerequisites:**Nil.

**INDUSTRY SUPPORT:**All IT Industries

**CRITERIA TO GET A CERTIFICATE**

Average assignment score = 25% of the average of the best 6 assignments out of the total 8 assignments given in the course.

Exam score = 75% of the proctored certification exam score out of 100 Final scores = Average assignment score + Exam score

Students will be eligible for CERTIFICATE ONLY IF AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If any of the 2 criteria are not met, the student will not get the certificate even if the Final score >= 40/100.

## Programming Data Structures And Algorithms Using Python online programming test Evening:-

Contents [hide]

1 Programming Data Structures And Algorithms Using Python online programming test Evening:-

2 Programming Data Structures And Algorithms Using Python online programming test:-

3 Programming Data Structures And Algorithms Using Python ASSIGNMENT WEEK 5 ANSWERS:-

4 Programming Data Structures And Algorithms Using Python ASSIGNMENT WEEK 4 ANSWERS:-

5 Programming Data Structures And Algorithms Using Python ASSIGNMENT WEEK 3 ANSWERS:-

6 Programming Data Structures And Algorithms Using Python ASSIGNMENT WEEK 2 ANSWERS:-

**Q1.**Here is an function to return the maximum value in a list of integers. There is an error in this function. Provide an input list for which maxbad produces an incorrect output.

**Code:-**

[-1,-9,-6,-6]

**Q2.**Here is a function to check if there are any repeated values among four input integers. You have to fill in the missing lines.

**Code:-**

if a!=c: if a!=d: if b!=d: if c!=d: return False return True

**Q3.**A list is increasing if each element is strictly larger than the preceding one. For instance [], [7], [8,11] and [3,19,44,63,89] are increasing, while [4,18,3] and [3,14,14,23] are not. Here is a recursive function to check if a list is increasing. You have to fill in the missing argument for the recursive call.

**Code:-**l[0]

**Q4.**A positive integer n is a sum of cubes if n = i3 + j3 for integers i,j such that i ≥ 1 and j ≥ 1. For instance, 9 is a sum of cubes because 9 = 13 + 23, and so is 35 (23 + 33). On the other hand, 25 and 49 are not sums of cubes.

**Code:-**

def sumofcubes(n):

for i in range(1,n):

add = i**3 + (i+1)**3

if add == n: return True break else: return False

**Q5.**Given two lists of integers, l1 and l2, we want to identify those integers from each of the lists that are also present in the other list. For instance if l1 is [1,2,4,9,1,2] and l2 is [2,3,4,5,4,7,7], we identify [2,4,2] as the numbers from the first list that are present in the second list and [2,4,4] as the numbers from the second list that are present in the first list.

**Code:-**

def dif(l1, l2):

li_diff = [i for i in l1 if i in l2]

return(li_diff)

def listcommon(l1,l2):

return (dif(l1,l2),dif(l2,l1))

**Q6.**Define a Python function listdup(l) that takes a nonempty list of integers l and returns one copy of each number that appears with repetitions in l. These should be listed in the same order as their first appearance in l. For instance:

**Code:-**

def listdup(l): con = {} tup = list() for i in l: if i not in con: con[i] = 1 else:

con[i] = con.get(i, 0) + 1

for (key, value) in con.items():

if value > 1: tup.append(key) return tup

**Q7.**Write a Python program that reads input from the keyboard (standard input). The input will consist of some number of lines of text. The input will be terminated by a blank line. The first line will consist of a single word. Your program should count the number of times the letters in this word appear in the remaining text, from the second line onwards. For instance, if the first line contains the word banana, you should count the number of occurrences of letters from the set {‘b’,’a’,’n’}. This count is cumululative, so you should add the number of times ‘b’, ‘a’ and ‘n’ occur and report your answer. Letters are case-sensitive, so ‘b’ and ‘B’ are different, for instance.

**Code:-**

word = input() s = set(word) count = 0 while True:

## How was the proctored exam for the NPTEL 'Programming, Data Structures and Algorithms Using Python' course? What were the question types?

Answer: The proctored exam will be of moderate difficulty, provided you have revised the lectures a day before the exam (at least in my experience, this was the case). Total no. of questions = 40 Total marks = 100 (each question carries 2.5 marks) Pattern of Questions: 1. MCQ with single corr...

How was the proctored exam for the NPTEL "Programming, Data Structures and Algorithms Using Python" course? What were the question types?

Ad by FusionCharts

Get 25% off our Charting Library FusionCharts with code FUSION25.

Build beautiful web & mobile dashboards with enterprise-grade charting library.

Sort Disha

DST-INSPIRE Scholar 11mo

The proctored exam will be of moderate difficulty, provided you have revised the lectures a day before the exam (at least in my experience, this was the case).

Total no. of questions = 40

Total marks = 100 (each question carries 2.5 marks)

Pattern of Questions:

MCQ with single correct answer (23 questions)

Fill in the blanks (FIB)

Integer type questions

Categories of questions:

A few of the questions (around 2–3) were directly (word to word) given from the quizzes of the course.

Some of them (around 3–4) were similar in structure to the questions in quizzes with values changed.

Rest were based on concepts taught in the video lectures with more emphasis on your understanding of the algorithms and syntax of python.

Some set of questions were comprehension based, i.e., a certain code snippet was given and there were 2–3 questions asked based on it. (These questions could be MCQ, FIB or Integer type)

Questions were majorly asked from the following topics:

Stacks, Heaps and Queues

Binary search trees

List and string manipulation / dictionaries

Other topics which had comparatively lesser weightage:

Functions

Global and local scope

File handling (I/O)

Some questions that I remember from my exam (2021):

Category 1: [Questions from quiz which were given as it is]

Consider the following dictionary.

wickets = {"Tests":{"Ishant":[3,5,2,3],"Shami":[4,4,1,0],"Bumrah":[2,1,7,4]},"ODI":{"Ishant":[2,0],"Shami":[1,2]}}

Which of the following statements does not generate an error?

(a) wickets["ODI"]["Bumrah"][0:] = [4,4]

(b) wickets["ODI"]["Bumrah"].extend([4,4])

(c) wickets["ODI"]["Bumrah"] = [4,4]

(d) wickets["ODI"]["Bumrah"] = wickets["ODI"]["Bumrah"] + [4,4]

2. Assume that hundreds has been initialized as an empty dictionary:

hundreds = {}

Which of the following generates an error?

(a) hundreds["Tendulkar, international"] = 100

(b) hundreds["Tendulkar"] = {"international":100}

(c) hundreds[("Tendulkar","international")] = 100

(d) hundreds[["Tendulkar","international"]] = 100

3. Suppose we add this function foo()to the class Tree that implements search trees. For a name mytree with a value of type Tree, what would mytree.foo() compute?

def foo(self): if self.isempty(): return(0) elif self.isleaf(): return(1) else:

return(self.left.foo() + self.right.foo()))

Category 2: [Questions from quiz whose values were changed]

One of the following 10 statements generates an error. Which one? (Your answer should be a number between 1 and 10.) [Integer type]

x = ["slithy",[7,10,12],2,"tove",1] # Statement 1

y = x[0:50] # Statement 2

z = y # Statement 3

w = x # Statement 4

x[0] = x[0][:5] + 'ery' # Statement 5

y[2] = 4 # Statement 6

z[4] = 42 # Statement 7

w[0][:3] = 'fea' # Statement 8

x[1][0] = 5555 # Statement 9

a = (x[4][1] == 1) # Statement 10

2. What is the value of pairs after the following assignment?

pairs = [ (x,y) for x in range(5,1,-1) for y in range(4,1,-1) if (x+y)%3 == 0 ]

This question was rephrased as: [FIB type]

pairs = [ (x,y) for x in range(4) for y in range(3) if (x+y)%3 != 0 ]

3. 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 as a sequence of letters without quotes and without any blank spaces between letters.

eibjdhgfca

4. Inorder traversal of a binary tree has been defined in the lectures. A postorder traversal lists the vertices of a binary tree (not necessarily a search tree) as follows:

Print the left subtree in postorder.

Print the right subtree in postorder.

Print the root.

Suppose we have a binary tree with 10 nodes labelled a, b, c, d, e, f, g, h, i, j, with postorder traversal ehicbjfadg and inorder traversal ehbicgjafd.What is the left child of the root node? (Write your answer as a single letter, without quotes.)

The actual question had 8 nodes and the orders of letters were different obviously and they had asked for both left and right child of the root. (MCQ)

5. We want to add a function listmax() to the class Node that implements user defined lists such that listmax() computes the maximum value in a list where values are of type int. An incomplete implementation of listmax() given below. You have to provide expressions to put in place of AAA, BBB and CCC.

def listmax(self):

if self.value == None:

return(AAA)

elif self.next == None:

return(BBB) else: return(CCC)

This was rephrased as:

We want to add a function sum() to the class Node that implements user defined lists such that sum() computes the sum in a list where values are of type int. An incomplete implementation of sum() given below. You have to provide expressions to put in place of XXX and YYY.

Guys, does anyone know the answer?