Introduction to Python MQP
Introduction to Python MQP
USN BIPPB105/205
Note: Answer any FIVE full questions, choosing ONE full question from each module.
Bloom’s CO
Q. No. Questions Marks
Level No.
Module 1
Explain comparison and Boolean operators with example. 6 CL2 C01
a.
Describe various methods of importing modules in Python programs with 7 CL2 C01
b.
proper examples. Explain which method is best.
1 7 CL3 C01
Demonstrate the concept of exception. Develop a code which prompts the
c. user for Celsius temperature, convert the temperature to Fahrenheit and print
out the converted temperature by handling the exception.
OR
a. Describe the flow control statement with proper example? Discuss if and if else 6 CL2 C01
statements with flow chart.
2 b. Explain the local and global scope with local and global variables. 7 CL2 C01
Develop a program to read the name and year of birth of a person. Display 7 CL3 C01
c. whether the person is a senior citizen or not.
Module 2
a. Discuss list and tuple data structure with example for each. 6 CL2 C02
Develop a program to count the number of occurrences of each letter in a 7 CL3 C02
3 b.
string using a dictionary.
Develop a program to read N number from the console and create a list and 7 CL3 C02
c.
display mean, variance and standard Deviation with suitable message.
OR
a. Explain the following methods with example 6 CL2 C02
i. get()
Page 1 of 4
ii. item()
iii. key()
4
b. Develop a program to print 10 most frequently appearing words in a text file. 7 CL3 C02
c. Develop suitable Python programs with nested lists to explain copy.copy( ) and 7 CL3 C02
copy.deepcopy( ) methods.
Module 3
a. Explain the split(), join() and replace() methods on strings. 6 CL2 C03
Explain the following string methods: 6 CL2 C03
i) upper()
5 b. ii) lower()
iii) isupper()
iv) islower()
v) isalpha()
vi) isnum()
c. Develop a program to create password locker. 8 CL3 C03
OR
Explain the file reading and writing process. 6 CL2 C03
a.
b. Explain the importance of the os.path module in python. 6 CL2 C03
6
c. Develop a program to sort the contents of a text file and write the sorted 8 CL3 C03
contents into a separate text file. [Hint: Use string methods strip (), len (), list
methods sort(), append(), and file methods open(), readlines(), and write()]
Module 4
a. Explain the role of Assertions in Python with a suitable program. 6 CL2 C04
Explain permanent delete and safe delete with a suitable Python programming 6 CL2 C04
b.
7 example to each.
Develop a program for backing up a given folder (folder in a current working 8 CL3 C04
c.
directory) into a ZIP File by using relevant modules and suitable methods.
OR
Explain the functions with examples: 6 CL2 C04
i) shutil.copytree()
8 a. ii) shutil.move()
iii) shutil.rmtree()
b. Explain the support for logging with logging module in Python. 8 CL2 C04
Develop a Python program to traverse the current directory by listing sub 6 CL3 C04
c.
folders and files.
Module 5
Page 2 of 4
a. Explain the methods init and str with suitable code snippet. 6 CL2 C04
Explain the following with syntax and suitable code snippet: 6 CL2 C04
i) Class definition
b. ii) Instantiation
iii) passing an instance (or objects) as an argument.
9
Write a function which takes TWO objects representing complex numbers and 8 CL3 C04
returns new complex number with a addition of two complex numbers. Define
c. a suitable class ‘Complex’ to represent the complex number. Develop a
program to read N (N >=2) complex numbers and to compute the addition of N
complex numbers.
OR
Explain the terms with example: 6 CL2 C04
i) class
a. ii) objects
iii) instance variables
b. Develop a program that uses class Student which prompts the user to enter 6 CL3 C04
marks in three subjects and calculates total marks, percentage and displays the
10 score card details
Develop a program to create a class Matrix that represents a 2x2 matrix. 8 CL3 C04
c. Overload the * operator to perform matrix multiplication.
CO2 Analyze the methods to create and manipulate lists, tuples and dictionaries. CL3
CO3 Develop programs for string processing and file organization CL3
Page 3 of 4
Page 4 of 4