22PLC15B/25B
Model Question Paper-sem I/Il with effect from 2022-23 (CBCS
Scheme)
USN
First/Second Semester B.E. Degree Examination
Introduction to Python Programming
Max, Marks: 100
TIME: 03 Hours
Note: 01. Answer any FIVE full qucstions, choosing at least ONE qucstion from cach MODULE.
Bloom's
Module -1 Taxonomy Marks
Level
Q.01 What is an arithmetic expression?.What is the output of this statement!? CO2-L3
*hello world' + 100 + "hw are vou' explain the rcason if the statement
produccs an crror.
Discuss various methods of importing modules in Python programs. COI -LI
Which method is best?. Explain. 7
C What is the lambda function? Explain with an example of addition of two CO2 - LI
numbers.
OR
Q.02 a What is a flow control statement?. Discuss if and if else statements with COI - LI |7
flow chart.
b Write a python program to add n numbers accepted from the user. CO2-L3 7
How can you prevent a python program from crashing? discuss different CO2-L!
ways to avoid crashing.
Module-2
CO2-LI
Q. 03a | Discuss list and dictionarydata structure with cxample foreach.
wrile a python program to accept n numbers and store them in a list. Then CO2- L2
print the list without ODD numbers in it.
For a['hello', 'how. [1,2.3]. ([[10,20,30)]] what is thc output of followingCO2- L3
statement (i) print( al: :]) (ü) print(a[-3)[O) (ii) print(a[2)][ : -1])
(iv) print(a0][: :-1)
OR
Q.04 a write a python program to rcad dictionary data and dclcte any given key CO3 - L23
entry in the dictionary.
Explain different clipboard functions in python used in wiki markup CO2-L2
write pypyhon program to revcrse each word
Using string slicing operationwne C02-L3
in a given string (eg: input: "hello how are you'", output: "olleh woh era
uoy")
Module-3
Discuss different paths of file system. CO3 -L2
Q.05
Explain how to read specific lines from a file?. illustrate with python COS - L2
program
c What is logging? how this would be used to debug the python program? CO3 - L3
OR
Q.06 a What is the use of ZIP? how to createa ZIP folder explain. CO3 - LLL
Page 01 of 02
22PLCISB/25B
|b wite an algorithm for implement multi clipboard functionality
Discuss how lists would be written in the file and read from the file? CO3 - L3
Module-4
Q. 07 a Define the tems with example:(i) class (i) objects (ii) instance variables CO3 - LI
create a Time class with hour., min and sec as attributes. Demonstrate how CO3 - L3
two Time objects would be added.
Discuss str )and init methods used in class definition. CO3- L2
OR
Q. 08a What is Encapsulation? Discuss with an cxample in which access CO3 - L2
specifiers are uscd in class definition.
What is a class diagram? Create empty class and corresponding class CO3-L3
diagram for following statemcnts (i) class A derives from class B and
Class C (i) Class Dderived from Class Adefined in statement (i)
c discuss polymorphism and demonstrate with and python program. CO3-L2
Module-S
0. 09 awTite python program to read cell 2C from shect 2 of workbook C04- L2
bexplain how pdf pages wvould creatcd in a pdf document with example. CO4- 2 6
cWhat is JSON? discuss with example. Compare it with dictionary CO4 - L3
OR
Q. 10 a compare and contrast Excel and CSV files. CO4- 2
b Demonstrate how a Class would be converted into JSON objcct with an CO4 - L3
example.
Explain how a page from different PDFs files would be merged into a new CO4 - L3
PDF file?
GBGS SGHEMIE
BPLCK205B/BPLCKB205
June/July 2023
tcond Semester B.E./B.Tech. Degree Examingtion,
Introduction to Python Programming
Max. Marks: 100
Line. 3 hrs.
ONE full question from cach module.
Note: I. Answr any FIVE full questions, choosing
2M: Marks, L: Bloom's level, C: Course oulcomes
MLC
Module - 1 6 L3 CO1
0.[ Demonstrate with example print (), input () and string replicatian.
square of length (N), Read N 6 L3 COI
b. Develop a program to generate Fibonacca
from the console
L2 CO1
in pyhon with 8
c. Expla1n elif, for, while, brcak and continue stalements
examples for each.
OR
parameters in user5 LICO1
0.1 a. What are uscr defincd functions? How can we pass
defined functions? Explain with suitable éxample
L2 C01
b, Explaín Local and Global scope with variables for cach.
Develop a program to read the name and year
of birth of a person Print7 CO1
C.
whether the person is a senior citizen or not
Module -2
remove () mcthods with 8 L2 CO2
0.3 a. What is a List? Explain append ( ), insert (Ö and
examples.
exapple 12 L2 C0?
b. Explain the following methods withili)items () in a dictionary.
i) keys (0 ii) values ()
OR
is used to convert list 6 L2 C02
a. How is tuple different from alist and which function
o tuple? Explain.
L C02
b.List the merits of dicionary over list.
program to 10 L3 CO2
C.Read N numbers from the console and create a list. Develop a
with messages.
compute and prínt mean, varianceand standard deviation
Module-3
8 L2 CO3
Explain the following methods with suitable examples
i) upper () ii) lowef( ii) is_upper () iv) is lower ()
function, reading the 12 L2 CO3
b. llustrale with example opening ofa file with open () ().
contents of the file with read () and witing to files with write
Iof2
BPLCK20SB/BPLCKB205
OR
Wiki Markup. Support 10 L2 CO3
).6 Explain the steps involved in adding bullets to
with appropriate code
file and write the sorted10 L3 C03
b Develop a program to sort the contents of a text sort)
contents into a sepuate texI ile [Use strip ) len (). list methods
append and file methods open ( ). readl1nes () and write 0)
Module -4
Explaifí in detail. L2 CO3
Q.7 llow do you copy files and folders using Shutil module?
an assert statemént. Explain 8 L2 C03
b What are Assertions? Wrnte the contents of
them with examples
6 L2 C03
Illustrate the logg1ng levels in python
OR
up a Folder into a Zip file. Clearly 12 L2 CO3
0.8 With suitable code, explain Backing
mention the steps involved.
R CO3
of number program.
b. Expla1n the logging module and debug the factorial
Module -5 L2 C04
Python? How to initiate a class and
Q.9 What is a Class? How to define class in
how the class mnembers arc accessed?
program. L3 CO04
b Define Pure function. lustrate with an example Python
4 L1 C04
c. Explain Printing objects.
OR
Polymorphism? Demopstráte polymophism.
with functions to find 10 L3 CO4
Q.10 a. What is lettrs appears in a word and
histográm to count the numbefs of tines each
in sentence.
illustrating 10 L2 C04
remove shufMle and sort cards, with
b. Write Deck methods to add,
the problem.
-CR-C-CR
R CMRIT LIBRARY
BANGALORE-50 037
2 of 2