BPLCK205B/ BPLCKB205
pm
USN
Second Semester B.E./B.Tech. Degree Examination, Dec.2023/Jan.2024
8
Introduction to Python Programming
:2
Time: 3 hrs. Max. Marks: 100
2
Note: 1. Answer any FIVE full questions, choosing ONE full question from each module.
:1
2. M : Marks , L: Bloom’s level , C: Course outcomes.
01
N
Module – 1 M L C
Q.1 a. Explain Local and global variable and scope of variable in python. 7 L1 CO1
-G
4
b. List and explain with example different comparison and Boolean operators. 8 L1 CO1
02
N
-G
c. Write a python program to generate Fibonalli sequence of length ‘n’. 5 L3 CO1
-2
OR
N
02
Q.2 a. List and explain with syntax and example the flow control statement in 10 L1 CO1
-G
python.
3-
b. Demonstrate with example print( ), input( ) and string replication function 6
N L2 CO1
-1
in python.
-G
U
c. Develop a program to read the name and year of birth of a person. Display 4 L3 CO1
VT
weather person is senior citizen or not?
m
-G
8p
Module – 2
Q.3 a. What is a list? Explain append( ), insert( ), and remove methods with 10 L1 CO2
N
N
example.
:2
-G
-G
31
b. Explain the methods of list data types in python for the following 10 L1 CO2
operations with suitable code snippet for each.
N
N
i) Adding value to list
-G
01
-G
ii) Remaining value from list
iii) Finding a value in a list
N
iv) Sorting the value in a list
N
24
v) Reversing a value in list
-G
-G
20
OR
N
Q.4 a. Explain get( ), item( ), keys( ) and values( ) methods of dictionary in 8 L2 CO2
GN
2-
-G
python.
-0
b. How is tuple different from list? Which function is used to convert list to 7 L1 CO2
N
tuple?
13
-G
c. Differentiate between list and dictionary. 5 L2 CO2
N
Module – 3
-G
Q.5 a. Explain the syntax and example various string methods. 7 L1 CO3
N
b. Discuss the following methods of OS module 8 L1 CO3
i) chdir( ) ii) rmdir( ) iii) walk( ) iv) list dire( )
-G
1 of 2
N
-G
GN
pm
c. Read multidigit number from console. Develop a program to print 5 L3 CO3
frequency of occurrence of each digit with suitable message.
8
OR
:2
Q.6 a. Explain File reading and writing process with suitable python program. 7 L3 CO3
2
b. With code snippet, explain saving variables using shelve module and 6 L2 CO3
:1
print( ) and print format( ) functions.
01
N
c. Write a python code to implement multiclip board project in python. 7 L3 CO3
-G
4
02
N
Module – 4
Q.7 a. Explain the functions of shutil module with example. 10 L1 CO3
-G
-2
b. What is meant by compressing files? Explain reading, extracting and 10 L1 CO3
N
02
crating zip files with code snippet.
-G
3-
OR
N
-1
Q.8 a. Explain the following file operation in python with example. 6 L1 CO3
-G
i) Copying files and folders
U
ii) Moving files and folders
VT
iii) Permanently deleting files and folders
N
m
-G
b. Define assertions. What does an assert statement in python consists of? 7 L1 CO3
8p
Give an example.
N
N
:2
c.
-G
Develop a program to sort contents of a text file and write the forted 7 L3 CO3
-G
content into a separate file.
31
N
N
-G
01
-G
Module – 5
Q.9 a. Explain operator overloading and polymorphism with example. 7 L1 CO4
N
N
24
b. Explain the concept of pure functions and modifiers with python code. 7 L1 CO4
-G
-G
20
c. Write a function called print time that takes a time object and print it in the 6 L3 CO4
N
form of hour: minute: second?
GN
2-
-G
-0
OR
N
Q.10 a. What is class? How do we define class? How class members are accessed, 6 L1 CO4
13
-G
explain with examples.
b. Explain – init( ) and – str( ) method with an example. 8 L1 CO4
N
-G
c. Discuss type based dispatch in python. 6 L1 CO4
N
*****
-G
2 of 2
N
-G
GN