pm
USN 1BPLC105B
First Semester B.E./[Link]. Degree Examination, Dec.2025/Jan.2026
9
:5
Python Programming
7
Time: 3 hrs. Max. Marks: 100
:1
Note: 1. Answer any FIVE full questions, choosing ONE full question from each module.
01
J
2. M : Marks , L: Bloom’s level , C: Course outcomes.
-T
6
Module – 1 M L C
02
Q.1 a. Explain the salient features of Python. 6 L2 CO1
TJ
b. Describe the Collatz 3n + 1sequence and explain how iteration and
-2 8 L2 CO1
-
conditional statements are used in its implementation.
02
TJ
c. Write a Python program to calculate factorial of a number. 6 L3 CO1
6-
OR
J-
-1
Q.2 a. Explain Syntax Error, Runtime Error, and Semantic error with an example. 6 L2 CO1
-T
U
b. Explain break and continue statements with example. 8 L2 CO1
VT
TJ
c. m
Write a Python program to print only even Fibonacci numbers up to n 6 L3 CO1
0p
terms.
-
TJ
TJ
:0
Module – 2
Q.3 a. Explain Python string handling method with example : 8 L2 CO2
32
-
J-
find ( ) , Upper ( ) , isupper ( ) , len ( ).
TJ
-T
b. Tuples are immutable. Explain with an example. And also differentiate 5 L2 CO2
01
between tuple and list.
J-
TJ
26
c. Write a Python program to count occurrences of characters in a string and 7 L3 CO2
-T
print the count.
20
J-
OR
TJ
-T
2-
Q.4 a. Explain the string operations in Python for slicing, concatenation, 8 L2 CO2
repetition and comparison with suitable example.
-0
TJ
b. What is a list? Explain append ( ), insert ( ), remove ( ), pop () with 5 L2 CO2
16
example.
J-
c. Develop a Python program to sort a given list of numbers using Bubble 7 L3 CO2
-T
sort from lowest to highest order.
Module – 3
TJ
Q.5 a. Explain dictionary methods like keys( ), values( ), items( ) with an 6 L2 CO2
example.
J-
b. What is Broadcasting in NumPy. Develop a program to illustrate 6 L3 CO3
-T
Broadcasting array elements.
1 of 2
TJ
1BPLC105B
pm
c. Develop a Python program to count the number of lines and words in the 8 L3 CO4
file.
9
OR
:5
Q.6 a. Explain the concept of aliasing and copying in dictionary with an example. 6 L2 CO2
7
:1
b. What is Masking in NumPy. Develop a program to illustrate masking to 6 L3 CO3
filter array elements.
01
J
-T
c. Develop a Python program to sort the contents of a text file in reverse 8 L3 CO4
order and write the sorted contents in to a separate file.
6
02
TJ
Module – 4
Q.7 a. Discuss the various methods of importing modules in python program.
-2 6 L2 CO3
-
02
b. Define class and object. Explain with syntax and an example how to define 8 L2 CO5
TJ
class in Python. How to initiate a class and how the class members are
6-
accessed.
J-
-1
c. Develop a Python program to illustrate how variable lookup follows 6 L3 CO3
-T
LEGB (Local, Enclosing, Global, Built-in) rule.
U
VT
OR
TJ
Q.8 m
a. Explain how to create user-defined modules in Python with an example. 6 L2 CO3
0p
Also discuss the uses of user-defined modules.
-
TJ
TJ
:0
b. Explain __init__( ) and __str__( ) methods with an example. 8 L2 CO5
32
c. Develop a program that simulates a simple stopwatch that records random 6 L3 CO3
-
J-
time intervals and calculates the average elapsed time.
TJ
-T
01
Module – 5
J-
Q.9 a. Briefly explain Assertion and raising an exception. 4 L2 CO5
TJ
26
-T
b. What is polymorphism? Develop a program to illustrate polymorphism by 8 L3 CO5
20
defining a common interface method in two different classes.
J-
TJ
c. Create a Python class Point with attributes x and y. Demonstrate sameness 8 L3 CO5
-T
2-
using ‘is’ operator, deep equality using ==, and show the effect of
-0
mutability when modifying one reference.
TJ
16
OR
Q.10 a. Explain the term objects are mutable with an example. 4 L2 CO5
J-
b. What is operator overloading? Define a Class Complex. Overload the 8 L3 CO5
-T
+ operator to add two complex numbers. Write a Python program to read
N (N ≥ 2) complex numbers and find their cumulative sum using operator
TJ
overloading.
c. Explain the need for exception handling in Python. Develop a program to 8 L3 CO5
J-
illustrate: try, except, else, finally blocks and also show how to raise an
exception.
-T
*****
2 of 2
TJ