BPLCK105B/BPLCKB105
pm
USN
First Semester B.E./B.Tech. Degree Examination, Dec.2023/Jan.2024
5
Introduction to Python Programming
:5
Time: 3 hrs. Max. Marks: 100
1
:2
Note: 1. Answer any FIVE full questions, choosing ONE full question from each module.
2. M : Marks , L: Bloom’s level , C: Course outcomes.
H
01
-M
Module – 1 M L C
Q.1 a. List and explain the use of comparison operator in python. Write the step by 6 L1 CO1
4
step execution of the following expression in python.
H
02
3/2 * 4 + 3 + (10/4)**3 – 2
-M
-2
b. Explain the control statements, if, else, elif with proper syntax and 6 L2 CO1
examples.
H
02
-M
c. Develop a python program to calculate the area and circumference of a 8 L3 CO1
2-
circle input the value of radius and print the results.
H
-1
-M
U
OR
Q.2 a. Explain the string concatenation and string replication operator with an 6 L2 CO1
VT
example.
m
-M
4p
b. Explain local and global scope of variable with suitable example. 6 L2 CO1
H
H
:5
c. -M
Develop a program to read the student details Like Name, USN and Marks 8 L3 CO1
-M
in three subjects. Display the student details, total marks and percentage
34
with suitable messages.
H
H
-M
:
01
-M
Module – 2
Q.3 a. What is list? Explain the concept of list indexing and slicing with examples. 6 L2 CO2
H
24
H
-M
b. With suitable examples, explain the list methods append( ), extend( ), 8 L2 CO2
-M
sort( ), count( ) and pop( ).
20
H
H
c. Read N numbers from the console and create a list. Develop a program to 6 L3 CO2
-M
2-
print mean, variance and standard deviation with suitable message.
M
-0
H
12
OR
-M
Q.4 a. Define tuple data type? List out the difference between tuple and list. 6 L2 CO2
H
b. Identify and explain the dictionary methods like get( ), item( ), keys( ) and 8 L2 CO2
-M
values ( ) in python with examples.
c. Develop a python program to swap two numbers without using 6 L2 CO3
H
Intermediate variables. Prompt the user for input.
-M
1 of 2
H
-M
H
M
BPLCK105B/BPLCKB105
Module – 3
Q.5 a. Write the output of the following : 6 L2 CO3
pm
i) ‘HeLLo’ upper( ) isupper ( )
ii) ‘HeLLo’ upper( ) lower( )
iii) ‘__’ Join(‘There can be only one’ split( ) )
5
:5
b. With examples, explain any five string methods. 6 L2 CO3
1
c. Develop a python program to count the total number of vowels, consonants 8 L3 CO3
:2
in a string.
H
01
OR
-M
Q.6 a. Make use of the concept of file handling and explain Reading and writing 7 L2 CO3
process with suitable python programs.
H
02
b. Explain the concept of file path, also discuss absolute and relative paths. 7 L2 CO3
-M
c. -2
Briefly, explain saving variables with shelve module. 6 L2 CO3
H
Module – 4
02
a. Explain the following file operations in python with suitable examples.
-M
Q.7 6 L2 CO3
i) Copying files and folders
2-
ii) Moving files and folders
iii) Permanently deleting files and foldersH
-1
-M
U
b. List out the benefits of compressing file with zip file module, also explain 8 L2 CO3
the concepts of walking a directory tree.
VT
m
-M
c. List out the difference between shutil.copy( ) and shutil.copytree( ) 6 L3 CO3
4p
methods.
H
OR
H
:5
Q.8 a. Briefly explain Assertion and raising a exception. -M 6 L2 CO3
-M
34
b. Develop a python program with a function named DivExP which takes two 8 L3 CO3
H
H
parameters a, b and returns a value C. (C = a/b). Write suitable assertion for
-M
:
a > 0 in function DivExP and raise on exception for when b = 0. Program
01
-M
has to read two values from the console and call a function DivExP.
H
24
H
c. Briefly explain the difference logging levels. 6 L2 CO3
-M
-M
Module – 5
20
Q.9 a. Define classes and objects in Python. Construct the class called rectangle 8 L2 CO4
H
and initialize it with height = 100, width= 200, starting point as (x = 0,
H
-M
2-
y = 0) and write the method to display the center point coordinates of a
M
rectangle.
-0
b. Briefly explain the concept of prototyping and planning. 6 L2 CO4
12
-M
c. Explain Clearly _ _init( )_ _ and _ _str( )_ _ method with examples. 6 L2 CO4
H
OR
-M
Q.10 a. Explain the term objects are mutable with an example. 6 L2 CO4
b. Explain the concept of polymorphism with examples. 8 L2 CO4
H
c. Explain briefly pure functions and modifiers with examples. 6 L2 CO4
-M
*****
2 of 2
H
-M
H
M