Vtu QP 1
Vtu QP 1
BPLCK105B/BPLCKB105
USN
Examination, Jan./Feb. 2023
First Semester B.E/B.Tech. Degree
Introduction to Python Programming
Max. Marks: 100
Time: 3 hrs.
Ne: . 4nswer any FWE Aullquestions, choosthg ONE full question fromeach module.
2. M: Marks, L: Bloom's level, C: Course ontcomes.
Module-I M LC
L2 CO1
Q.1 What is thc necd for role of preccdencc? llustrate therules of preçedence 6
in Python with example.
6 L2 CO1
b. Explain the local and global scope with suitable examples.
L3 C01
c. Devclop a program to generate Fibonacci sequence of length (N). Read N 8
fhom the console.
OR
Q.2 What are tunctións? Explain Python function with parameters and return L2 CO1
statenncnts.
b Detine exception handling. How exceptions are handled in python? Write a 7 L2 CO1
program to solve divide by zero exception.
C. Develop a python program to alculate the area of rectangle and triangle 6 L3 CO1
print the result.
Module -2
L2 C02
Q3 a. Explain negative indexing, slicing, index( ), append( ), remove( ). pop( ).
insert( ) and sort( ) with súitable example.
b. Explain the use of in and not in operators.in list with suitable examples. 6 L2 CO2
C02
C. Develop aprográm to find mean, variance and standard deviation. 6 L3
OR
8 L2 CO2
0.4 a. Explain the following methods in lists with an examples:
i) len()i) sum( ) i) max(0 iv) min( ). e
L2 C02
b. Explain set( )and setdefault( ) method in a dictionary. 6
6 L3 CO2
c. Develop a Python program to swap cases of a given string
Input: Java
output: jAVA
Module -3
a. Explain join( ) and split( ) method with examples. L2 CO3
Q.5
ii) isspace ). 6 L2 CO3
b. Explain with examples: i) isalpha( ) i) isalnum( )
L3 C03
C. Develop a python code to determine whether the given string is a 6
palindrome or not apalindrome.
1of 2
BPLCK105B/BPLCKB105
OR
Q.6 Explain the concept of ile hundling. Also explain reading and writing 8 L2 C03
process with suituble cxamplo.
b. Explain the concept of file path. Also liscuss absolute and rclativc file path. 6 L2 CO3
C.
Brietlyexplain saving variubles with shelve module. 6 L3 CO3
Module - 4
Q.7 Explain the following lile oporations in Python wilh suitable example: 6
Copying liles and folders L2 CO3
i1) Moving tiles and folders
iii) Permanently deleting files and folders.
b. List out the benefits of compressing file? Also explain reading of a zip
file 8 L2 CO3
with an example.
C. List out the differences between shutil.copy( ) and shutil.copytree( )6 L3 CO3
method.
OR
Q.8 a. Briefly explain assertions and raising a exception. L2 C03
b. List out the benefits of using logging module with an example. 6 L2 CO3
C Deyelop aprogram with a function named DivExp which takes two L3 CO3
parameters a, b and returns a value C(C ab). Write suitable assertion for
a >0 in function DivExp and raise an exception for, when b = 0. Develop a
suitable program which rads two values from the console and cals a
function DivExp.
Module-5
Define a class and object, construct the class called rectangle and initialize L2 C04
Q.9 a.
it with height 100, width = 200, starting point as (x = 0, y 0). Write a
program to display the center point co-ordinates of a rectangle.
L2 C04
b. Explain the concept of copying using copy module with an example.
6
6 L2 C04
C. Explain the concept of inheritance with an example.
OR
Define a function which takes two objects representing complex numbers L2 C04
Q.10a. numbers.
and returns new complex number with a addition of twO complex
Define a suitable class Complex' to represent the complex number.
Develop aprogram to read NN>=2) complex numberS and to compute
the addition of Ncomplex numbers.
6 L2 C04
b. Explain init ) and str()method with examples.
6 L2 C04
Brieflyexplain the printing of objects with anexamples.
2 of 2