0% found this document useful (0 votes)
11 views

Question Papers

The document outlines the examination structure for an Introduction to Python Programming course, detailing modules, questions, and marks distribution. It includes various programming tasks such as string manipulation, list operations, and file handling. Students are required to answer five full questions, choosing one from each module, with a focus on practical coding skills and theoretical understanding of Python concepts.

Uploaded by

Rana Manal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Question Papers

The document outlines the examination structure for an Introduction to Python Programming course, detailing modules, questions, and marks distribution. It includes various programming tasks such as string manipulation, list operations, and file handling. Students are required to answer five full questions, choosing one from each module, with a focus on practical coding skills and theoretical understanding of Python concepts.

Uploaded by

Rana Manal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

MAKE UP BXN

BPL.CKZ05B/BPLCKW05
Seeond Semester B.E/B,T'ech, Deuree Exmination. Nov/Dec. 2023
Tiae. 3 hs Introductlon to Python Programming
Max Marks 0
Vote: l. Iaswer any FIVE full questions, chuusing ONE Jul qustinn eaeh
2. M: arks, L: Bloom's level, C: Curse l:
vuteDmes.
.1al. Demonstrate with example print(Module-1
M 4
). input{ )anxl fonit ( .
. Expiann conditona branching statenents with syatax and wpe a sjtable 7 20i
program lor the sae.
C.Write a pvthon program lo clheck whether a given number is Armstrng o 8 1.3 C01
|ot. (HnI - An Armstrong number is eny number ofa dits wliicl: is equut
to the sum of n power of digits in lhe nunber For
esumple. 71 tl
Armstrong nunber since 3**3 + 7**34|**3 371|
OR
(.2 Write a pvthon program o guess the secret runber hetwecn 1 ie 2i wtata 8 3
|5 guess ifthe aumber is sme then it is right gucss else wrong gCs.

), What are user defired iunction? How can we pass ine aeui
functons? Explain with suitable exnplkes.
Wbit are copar:son ad Boolea: operatars in he oa17 d 6
Boelean operators n python.
Module -2
Q.3 a. Fsnlan tie inethods o! Iist data types in pvtlon lor the f 1kowee
operalio 1
with suitabie code snippets for each.
) Adding values toa list
) Remnoving vaities troma list
u) Finding a value in a ist
) Sortng the values in a list
b. Explain the concept of list slicing ana list traversrg wil: n eNp!.

charactets it a string and pri he count


OR
.4 .

nunbeestzngng lioan to n. There ane ne lupliH :ry


1246!78. output:)
b. I How is hipie diferent liom list()? Eplai winh cNaie ( oet 6 L t)?
to convert list ima triplc and trip!e into lst.
le. Explain itsertt ) aial renwve ) medods oftth exarple.
MAKE UP EXAM BPLCK105B/BPLCKB105
USN

First Semester B.E/B.Tech. Degree Examination, Nov./Dec. 2023


Introduction to Python Programming
Max. Marks: 100
Time: 3 hrs.
Note: I. Answer any FIVE full questions, choosing ONE full question from euch module.
2, M: Marks, L: Bloom's level, C: Course ontcomes,
Module -1 MLC
.Explain string concatenation and string replication opcration with an 06 L1 |CO1
example, 08 L2 | CO1
b. lustrate the usc of break and continue with cxample. L1 CO1
Write a Python program to check whether the given number is positive, 06
negative or zero.
oR
Q.2 a. Whut are functions in Pyhon and how they are defined and uscd to 06 L1 C02
modularize code?
08 L1 C02
b. Explain the local and global scope with local and global variables.
C. Write a program to gencerate Fabonacei sequence of length (N). Read N 06| L1 CÓ2
from console.
Module -2
Q.3 a. What are lists in Python and how they used to store and manipulate 06| L2| Co3
collections of data.
b. Explain any four built-in methods available for working withlists. 08 L1 CO3
c. Read N numbers from console and create alist. Developa program to print 06 12| C02
the mean of numbers.
OR
Q.4 a. Differentiate between lists and dictionary. 06 L2C02
b. Explain with example keep( ), values( ) anditems() methods. 08 12 CO2
. Write aprogram to add elements into dictionary using while loop. 06 L2 CO2
Module-3
0.5 a. Explain any five built-in methods available for working with string along 10 L2 C03
with example.
b. Read a multi-digit number (as chars) from console. Develop a program to 10 L2 CO3
print the frequency of each digit with suitable example.
OR
Q.6 a.Explain the file readingand writing process with suitable
example. 10 L2 Co3
b. Ilustrate the role of shelvemodule in working with files. 10 L2C03
Module -4
Q.7 the lunctions of
a. Explain shutil module with examples |10 L2 co3
b. is meant by compressing filces? Explain reading, extracting and 10 L2 CO3
creatingZIP files with code snippet.,
OR
Q.8 a. Explain the buttons in the Debug control window. 10 L1 CO3
b. Write a note on raising exception. 10 L2CO3
Module-5
O.9 . What do you mean by class, objcct and attributcs? Explain with example. 08 L3 CO4Ë
b. llustratethe concept of inheritance and class diagrams with cxample. 12 L2 | CO4
OR
0.10a. lList and explain any four object oricnted characteristics possessed by 08 L2 C04
Python.
b.Briefly discuss the importance of init() and str()methods 12 L3 CO4
along with example.
BPI.CK205B/ BPI.CKB205
Moduie- 3
3.Wrs Pyilos program to count sber of lines in afle. 5 13CO1
b, Iyain the olks in lunetions witlh exaInple 10 1.1 COL
) tuikoen vdy) it elpattis ) iv) listclirt ) v) suby )
Wiat are thaee ode" argunnts that can be passed to opent ) function 5 1 CO:
wih exanple
"OR
.Wh code snippet. exnlan saving varables using the slhelve module and 612C02
rmt pomatt functons

b.Write a python progran that accepisasentence and ind the nunber of 7 LsC02
WOr ds, digts, upper cise etters and lower case letters.

c.Write a program to mike a new string with all the consonant elimnated 7'13 cO2
Iroa tle siring read liom the user {Hint - For exampleInput: Hello, have a
SUnt day. Output. Hli iv gd dy)
Module -4
).7
. * t ts eat by conmpressing Files? Explain reading, extracting and 10 1.1 CO1
P tiles with an exatnpie.

h. Detits tts Wha docs n aert statement in pvthonconsists of? 5 1.1 C02
tiow docs OS.vailkt )work n pvthon?
OR
a.cu- ti basiconlig ) mcthod to configure the lagging with an 7 L2 CO2

b. Wsptugun tc dept Raisg Exccplion.


eFtin the iuctos of Shutil module with exanple. 6 12 C02
Module -5
(ograre he oliflerence between cass, statie and instance method. 6 L.2 CO4
It. 13efine citsses and objects in python. Create a class called Employee and 9 12 (O4
initaize t with enloyce id aaxl nne Destgn method to :
i Set Age to assgn age te the enployce
lw asgn salary to the employee
in) pl to dsplay allinlorination of the employee.
ant str- method with an example. 5 L2 CO4

ANrite poram t plenent olyYorplhism n pyth using nethod 7 L3 (O4

, Deihe pulte utcto? oiNe an csample program that relurns square ofa7L3 CO4
Dsscd 1tegen

an be slantaicd n pytlhon? Write a py1hon program to 6 L2CO4


istates y vtas to leline a class RECTANGI E With member
wuth 1tcclu ctht ier and tuember functiken to find center area

2 of2
GBGS SGHEME BPLCK105B/BPLCKB105

Examination, Jan/Fcb. 2023


First Semester B.E/B.Tech. Degree
Introductlon to Python Programming
Max. Marks: 100
Time: 3 hrs.
Note: 1. Answer any FIUE full questions, choosing QNE full question from each module.
2 M: Marks, L: Bloom's leve, C: Cowrse eutcomes.
Modulc 1 | MLC_
the rules of precedence 6 L2 CO1
Q.1 What is the need for role of precedence? 1llustrate
| in Python with example.
6L2 COI
b. Explain the local and global soope with suitable examples
L3 CO1
Develop a program to generate Fibonacci sequence of length (N). Read N8
C.
from the console.

OR
Q2 What are functious? Explain Python function with parameters and return 7 L2 CO1
statements.
are handled in python? Write a7 L2 C01
b. Detine exccption handling. How exceptions
program to solve divide by zerO exception.
rectangle and triangle6 L3COI
C.Develop a python program to calculate the area of
print the result.
Module -2
slicing. index( ), append( ), remove ), popl ).8 L2 CO2
Q3 a. Explain negative indexing
suitable example.
insert( ) and sort( ) with
suitable examples 6 L2 CO2
b. Explain the use of in and not in operators in list with
standard deviation, 6 L3 CO2
C. Develop a program to find mean, variance and
OR 8 L2CO2
Q.4 a. Explain the following methods in lists with an examples:
i) len() ii) sum() ii) max( ) iV) min(0.
6 L2 | C02
b. Explain set( ) and setdefault( )method in a dictionary.
string 6L3CO2
c. Develop a Python program lo swap cases of a given
input: Java
output: jAVA
Module -3
examples. 8 L2 | CO3
0.5 a. Explain join( ) and splits) method with
) 1) isalnum( ii) isspace( ). 6L2 CO3
b. Explain with examples: i) isalpha(
whether the given string is a 6 L3 CO3
c.Develop a pytbon code lo determine
palindrome or not apalindrome.
Iof 2
GBGS SGHEME
BPLCKI05B/BPLCKBI05

First Semester B.E./B.Tech. Degree Examination, Dec.2023/Jan.2024


Introductlon to Python Programming
Time: 3 hrs. Max. Marks: 100
Note:2 1.Answer uny FlVE fullquestions, chousing ONE full question fram euch modute.
M:Murks, L: Blopm's levet, C: Coueoutcomes.

Q.1 Module-1 ML C
List and explain the use of comparison gperutor in python. Writc the stepby 6
step execution of the folkowing expression in pulin.
CO1

324+3+ (104)"3
b. Explain the control statements. if. else, elit with proper syntaX a 6 Co1
Cxamples.

Develop a python program to calculate the area and circumference of a 8 L3 CO!


circle input the value of radius and prinit the results. hoduny 2
ata -ny

Q2 Explain the string concaenation and string ruplicat'on operator with an6 1.2 CO1
exampe

b. Explain local and global scope of variable with suitable example 6 CO1

cDevelop a program to read the student details L.ike Nane, SN und Marks 8 L3 CO1
in three subjects. Display the student details, total marks and percentage
wih suitable messages

a.
Module-2
What is list? Explain the concept of list indexing ard sicing with exanples
0.3 6 L2 CO2
b. With suitable examples, explain the list methods append( ). extendi ). 8 L2 CO2
sort( ). count( )and pop( ).

e. Read N numbers from the conyle and ereste a list. Develop a program to
L3 CO2
print mean. variance and standard deviation with suitable nessuge

Q.4 a. Define tuple data type? List out the dillerence between tuple and list.
6 L2 CO2
b. ldentify and explain the dictionary methods like getl . item( ). keys ) and 8 L2 C0
values ()in python with examples.
c. Develop a python progrum to swap two numbers without using 6 L2 CO3
Intermediute variables. Prompt the user lor inpu.

Iof?
BPL.CK105B/BPIÇKBI05
OR
Q.6 Explain the concept of file handling Also expluin reading and writing L2 c03
pnocess with suitable example.
b. Explain tlhe concept of file path. Also discuss nbsolute tnd relative fle patlh.6 L2 CO3
c. Betly explain saving variables with slaelve module. 613 CO3)
Module-4
0. Explain the following file operations in Python with suitable example: 6 L2CO3
i) Copying tiles and folders
i) Moving files and folders
iii) Pernanently deleting files and folders.
List out the benefits of compressing fie? Aliso explain reading of azip file8 L2 co3
with an example,
List out he d1fferences between shutil.copy ) and shutil.copytrec( ) |L3 C03
method.

OR
Q.8 a. Brietly explain assertions and raising u exception. 6 L2 CO3

b. List out the benefits of using logging module with an example. |6 L2 co3
c. Develkop a program with a function named DivExp which takes two8 L3CO3
parameters a, b and returns a value C(C= ab). Write suitable assertion for
a >0 in function DËvExp and raise an enception fos wien h0 Developa
suitable program which reads two values from the console and cals a
funetion DivExp.

Module-S
0.9 a. Detine
a class and object, construct the class called rectangle and0),initialize8
with
L2 Co4
bepht 100, wIdth 200, starting pout as ( Write a
program 1o displav the center point co-ord1nates ofa
b. Explain the concept of copying using copy module with an example. 6L2 COM

c. Explain the concept of inheritance wih an example. 6L2 CO4


OR
Q.10 a. Define a function which takes twO objects representing complex numbers 8 L2 C04
and returns new complex number with a addition of two complex numbers.
Define a suitable class 'Complex' to represent the complex mumber
Develop a progranm to tead NN2) complex numbers and to compute
the addition of Ncomplex numbers.
b. Explain nit0 and str () mcthod with examples. 6L2 C04

c. Briely esplain the printing of objects with an examples. L2 C04

2 of2
Wrile the output of the
Module -J BPLCKI05B/BPLLCKB105
I) following: 612 CO
it) 1lel.Louppert
HelLo'uppert
) isupper) ()
) kwert
iii)-Jain There can be only one'-split( ) )
b.Wih examples, explain any five string methods. 6 L2 C03
Develop a python prugram to count the total
in a siring number of vowels, consonants CO3

O.6 OR
Make use of the concept of file handling
process with suitable python programs. and explain Reading and writing 7L2 CO3
b Explain the concept of file path, also discuss
absolute nnd relative puths. 7|L2 CO3
C. Brielly. explain saving variables with shelve
module. 6 L2 CO3
Q.7 a. Explain the following file
Module - 4
i) Co
opyng liles and folders
operations in python with suitable examples. 6 L2 CO3
i) Moy files and fokders
iii) Permanently deleting liles and folders
b. List out the benefits of
concepts ofwalking acompressing
the file with zip file module, also explain8 L2 CO3
director tree.
c. Lis out the difference between shutil.cops ) and
methods shutil.coptreet )6 13 CO3
OR
0.8 a. Brietly explain Asscrtion and raising a
exception.
b. Develop a
L2CO3
python program with
function a
pararneters a, h and returns a value C. (C named DivExP s hich takes two
ab), Write suitable assertion for
8 L3 CO3
a 0 in tunction
DivENP and
has to read two values from the raisc
on eNCeption for when b
0.
console and cail a function DivExP. Program
c. Brietly explain the ditference logging levcs
6 L2 CO3
Q.9 Module
Define classes and objects in Pthon.
and initialize it with height Construct the class called rectangle8 12 CO4
100, witth 200. starting point as ( 0,
0) and wrie the method to
display the center pont coordinates of a
rectangle.
b. Briefly explain the concept of prototyping and planning.
L2 C04
c.Explain Clearly init( and str( ) method with examples
6 L2 CO4
OR
0.J0 a. Explain the term objects are nmutable with an exampie.
6 L2 |C04
b. Explain the concept ofpolymorphistn with examples.
8 L2 CO4
c. Esplain brietly pure functions and moditiers with examples.
612 CO4
2 of2
GBGS SGHEME
USN BPLCK205B/ BPLCKB205

Second Semester B.EJB.Tech. Degree Examination, Dec.2023/Jan. 2024


Introduction to Python Programming
Time: 3hs3
Max. Marks: 100
Noe: .Answer any FlVE ull quetions, choosing ONE fMll qwestlon frum each module.
Marks, : Bloom's level, C: Couse outcomes
Module-1
Q.1.Explain Local and global variable and cope of variable in pyhon. MLC
7 LICo1
b. List and cxplain with example different comparison and Boolean operators. LICO1
|Write a python program to generate Fibonalli sequence of length n. L3COl

0.2a. List and explain with smtax ad example the flow control statement in 10 LICO1
python.
b. Demonstrate with example printt ) ipu ) and string replication
function6 L2 COI
in python.
c. Devekop a program to read the name and year of birth of aperson. Display
4 L3CO1
weather person is senior citizen or not?

Module -2
0.3 What is a list? Explain append( ), insert( ), and remove mcthods wth 10
cxample.
LI CO2

b. Explain the methods of list data types in python for the


operations with suitable code snippet following 10 LI CO2
i) Adding value to list
) Ranaining value from list
i) Finding a value in a list
iN) Surting the value in a list
v) Reversing a value in l'st

OR
Q4 a Explain get( ). item keys( )and values ) methods of dictionary in 8 L2C02
python.
bHow is tuple different from list? Which function is used to convert list to9
tuple? LICO2

c. Differentiate between list and dictionary.


5 L2COZ
Module -3
Explain the syntax ahd example various string methods. 7 LICO3
b. Discuss the following methods of OS module
) chdir( ) i) rmdir( ) ii) walk( ) iv) list dire( Y LI CO3

I of?
USN
GBGS SCHEME
BPLCK105B/BPLCKD105
Pirst Semester B.E/B.Tech. Degree Examination,
Dec.2023/Jan.2024
Introduction to Python Programmning
Time: 3hrs.
Note: 1.
Answer any FIVE full questions, Max. Marks: 100
2. choosing
M:Merks, L: Blaom's level. C: Couse ONE full question fromn each module.
outcomes.
Q.1 a. List and explain the use of
step cxccution of the
Module-1
compurison onerutor in python. Write the step by MLLC
32.4+3+(10D/4 03-2
following expression in python. CO1

b. Explain the control


Cxamples statemerts. if else, elif witlh proper
syntax and L2 CO1
c.
Dvclop a
circle innut python
the prop
v u
risdus t e he hrea and circumferenee
and print the results. cf 813 COL

|0.2 OR
Explain the string
example concatenation and string renlicat ion
operator with an 6 L2 COI
b.
Explain local and global seope of
variable with suitable
e. De
evelop a example L2 CO1
three prugran read the student details
n to
subjects,
with suitable Displas
messages the student Like Name,
details, total marks USN an
Marks8 L3 CO1
and
percentage
A. What is list? Eplain the Module
concept of list -2
b. With suitahle indexing and slicing with exainples
Sort( ). count )exanples explain the list

C.
and popi .
Read N numbers from the
metlaods append, extendi ).
612CO2
12 C02
print niean, consle and
variance and standard ereate a list.
devjation Develon aprogram
with suitable a
to6 13
messag (00
0.4
Defing tuple data type? Liss OR
out ihe
Identity Oand dillerence between tuple and lit.
in explain
the
values dictionary tmethods like get(). ,
pvthan with examples |6 L2CO2
item kevs() and
Develop a python 8 L2 C02
Intermediate variables,program to
Prompt the uscrswaplor input.
two
numbers without usi1y 6 12 CO3

Iof2
eRead multidigit number from cunsole. Develop a progran lo print LSCO3
frequencyof occurrence ofcach digit with suitable messsge,
OR
0.6. Explain File reading and writing process with suitable python program. 7|L3CO3
b. Wah code snipippet, explain saving variables using shelve module and 6 |12 CO3
print() ad print format( ) functions.
eWrite a python code to implement multiclip board project in python. L3CO3

Module-4
0.7 Explain the functions of shutil module with example. 10 LICO3
What is meant by compressing files? Explain reading extracting and 10 LI CO3
crating zip files with code snippet.

OR
Q.8 1.Explain the following file operation in python with example. 6 LI CO3
i) Copying files and folders
ii) Moving files and folders
ii) Permanently deleting files and folders
b. Detine assertions. What does an assert statement in python consists of? |LIC03
Give an cxample.

cDevclop a progran to sort contents of a text file and write the foned |L3 CO3
content into a separate file.

Module -
0.9 Explain operator overloading and polymorphism with example. 7LIC04
b. Explain the cocept of pure functions and modifiers with python code. LICO4
Write a function called print time that takes a time object and print it in the6 L3 C04
form of hour: minutet second?

OR
O.10a.What is class? How do we define class? How class members are sccessed, 6 L1 CO4
explain with examples.
b. Expain init( ) and-str ) method with an example. |LIC04
.Discuss type bascd dispatch in python. 6 LI Co4

2 or2
BPLCKI0SB/BPLCKB105
Module - L2cOJ1
Wrile th output of the follkwing
i) lel io unpert ) Isuper ()
Hello uppert ) lowert
) Joinc There can be only one splitO)
612COs
b. With esamples. explain any live string melhods.
vowcls, cotisonants 813CO3
Develop a pythn program to count the total numher of
in a string
OR
esplain Reading and writing 7 2C03
0.62 Make use of the concept of file handling ard
process With suitahle python prograns
b. Explain the concept of ile nath also discuss absolute
and relative paths. 7L2 CO3
6 L2 Co3
Briclly. explain sving variahles with shelve nodule.
Module-4
sutable examples 6 L2 | CO3
Q.7 a. Explain the following file operations in python with
) Copving iles and folders
ii) Mev ing files and folders
iii) Pentanently deleting iles and folders
zip ile module, also explain 8
b. List out the benefits of compressing file with
the concepts of walking a directory tree.
and shutil.copstreet )
c. List out the difference between shutil.cops
methods
OR 12 C03
a. Briellv esplain Assertien and raising a cNception
Q.8
which takes two L3 CO3
b. Devckop a psthon program with a funtion named DivEXP suitable assertion for
parameters a, b and returns a value C.(C- ab) Write
a0 in function DivExP and raise on exception function for when b=D. Program
fron the console and call a Dis
has to read two vaiues
12 CO3
C. #rielly esplain the difference lkogging levels
Module -5
the class called rcctangle 8 L2 C04
Detine classes and obiets in Pthon. CoHIstruct
100, width 200, starting point as (N= 0,
0.9
itialize it with height
point coordinates of a
0) and write the method to display the center
rectangle
6 L2 C04
b. Brietly esplain the concept of prototyping and planning
Explain Ckarly initt str) method with examples. 6 L2 cO4
OR
cxape. 6 L2 co4
0.10 a Explain the term objects are utable withh an
8 L2| CO4
Explain the concept of polymorphism with examples.
Eplain hrietly pure functiens and moditiers with
examples. L2 C04
c.

2ef2
GBGS SCHEME
L'SN BPLCKIOSB/BPLCKB105

First Semester B.E./B.Tech. Degree Examinution, Dec.2023/Jan.2024


Introduction to Python Programming
Time: 3 hrs.
Max. Marks: 100
Note: I.Answer e
2. M. & swer anyL: FlVE fullquestons, chosing ONE full questlon frum euch module.
:Murks, Blaom's level,C: Course outcomes,

Q.1 Module -1 |MLC


a. List and explain the use of comparison opcrutor in python. Write the step by 6 |LI|COT
step execution of the following expresskon in
3/24 +3+(|04)3-2 python.
b. ENplain the control statements, if. else, elif with proper syntax and 6 L2 COI
examples.

Develop a python program to calculate the arca and circumference of a 8


circle input
the L3 COI
value of radius and print the results.

|O.2 . OR
Explain the string concatenation and string replication
exaimple. operator with an L2 CO1
b. Explain local and gkobal scope of variable with suitable example.
L2 COI
Devekop proram to read the student
a
in three subjects. Display the student details
Like Name. USN and NMarks 8
details, total marks and percentage L3 CO1
with suitable messages

03 What is list?
Module -3
.
Lxplain the concept of list indexing and slicing
withexamples,6 L2 |CO2
With suitable examples. explain the list methods
sort( ). count )and pop() append), extendi ). 8 L2 CO2

C. Read N numbers from the console and createa list.


print mean, variance and standard Develop aprogram to6 L3 C02
devtation with suitable messaue

OR
Q.4 Define tuple data type? List out the dillerence between tuple and list.
L2 CO2
hldeutily and explain the dietionary imethods like ge( ). item(). keys( ) and
8 L2C02
valtues () in python with examples.
eDevelop a pytton program t0 s ap t0 numbers without usine6
Intermediate variahles, Prompt the user or input. L3C0M
BPLCKI05B/BPLCKBI0S
Module
05a, Write the outyut of the kollowing |6 L2CO3
Tlelle pper sipper )
) HelLo uppert kowcrt
inJoint"T here can be only onespli( )
b. Withexamples, explain any five string methods. 6L2 CO3

C. Develop a pyhun progran to count the total numbet of sowels, consonants 8L3 O3
in a string

Q.6 a, Make use of the concept of le handling end esplain Reading and writing 112 CO3
pcess with suitable python programs.
b. Explain the concept of file path, also discu5s absolute and relative paths. 1 2 CO3
c. Brielly, evplin saving variables with shelve module. 6 L2CO3
Module-4
a. Explain the following file operations in python with suitable eamples. 6 12 CO3
) Copying files and folders
ng iles and folders
i1) Permanently deleting fies and folders
b. Lit out the benefits of compressing file with zip
Iile module. also explain8 L2 CO3
the concepts of walking a directory tree

List out the difterence between shutil.copyt ) and


methods. shutil.copytree 16 L3 CO3
OR
Brieily esnlain Assertion and raising a
evception. 6 L2 CO8
b. Develep a python prugram with a
functien
parameters a, band returnsa value C. (C named DisExP which takes two8 L3CO3
a in furction DivEPand r a l e r i e Suitable assertion for
exce
has to read two values fron the console and call
Pona or Whien b0. Irogram
function DivfP.
6. Brietls eyplain the
ditference logging levels
|6 L2 CO3
a. Module -
Define classes and ob ects in
P'ython. Construct the class called
and initialize it with hcight D0, width 200, starting point asrectangle 8 L21 CO4
y-0) and write the method to display the 0, (x =
rectungle. center point coordinates ofa
b. Briefly explain the
concept of prototyping and planning
c Explain Clearty init
6L2 C04
nd str ) methed with examples
OR
6 12 CO4
0.10 a, Explain the term objects are mutable with an
cxample.
1 Explain the 6 12 cO4
concept of polsmorphism wih exanples
C.
8 L2 (04
ExDlain brietls pure functions and modifiers with
examples,
612CO4
2of2
GBGS SCHEME BPLCK105B/BPLCKBI05
USN

First Senester B.E/B.Tech. Degree Examinatton, Jan/Feb. 2023


Introduction to Python Programming
Time: 3 hrs. Max. Marks: 100

Note: 1. Answer any FlVEfallquestions, choasing ONEfullquestion frumeuch moduie


2 M: Marks, L: Bloom's level, C: Course outeomes.
MIL C
Modul-l
Q.1 a.What is the need or role of precederce? liustrate the rules of precedence 6 COL
in Python with example.
b. Explain the local and global scope with suitable examples. 6 L2 CO1
c. Develop a program to generate Fibonacei sequence of length (N). Read N8 L3COI
from the console.
OR
0.2 What are functions? Explain Python function with parameters and return 7L2 COi
statemcnts.

b. Deine exception handling, How exceptions are handled in python?Write a7 L2 Co1


program to solve divide by zero cvception.
Develop apthon program to cakulatethe area of rectangle and triangle6L3 COI
print the result.
Module - 2
0.3 a. Explain negative indexing, slicing. index ). append( , remove ). pop( ). 8 L2 CO2
insert( ) and sort() with suitable example.
b. Explain the use of in and not in operators in list with suitable exanples. L2 C02

c. Develop a program to find mean, variance and standard deviation. 6L3CO2

OR
0.4 a. Explain the following methods in lists with an examples: L2 CO2
i) len() i) sum() ii) mas( ) iv) min ),
b. Lplain sett ) ald etuefaul( ) ciho na ctionary, CO2

.Develop a Python program to swap cases of a given string C02


input: Java
output: jAVA.
Module- 3
Explain ain ) and split( ) mctod with examples, 8L2 CO3
Explain with examples: i) isalpha ) i) isalnum( ) iii) isspace ) 6 L2CO3
Devclop a python code to deterinine whether the given string is al 6 L3CO3
palintroc or bot a palindrome.
Iof 2
BPLCKI05B/BPLCKBI03
Explain the concept of file handling. Also eplain reading and writing| 2 CO3
process with suitable evample.

Explain the concepl of file path. Also discuss absoluie and relative file path.62COJ
Brictly explain saving variables with shelve moduie. 6 L3COJ
Module-4
0.7 a.Explain the lollowing file operations in Python with suitable example: 6L2 CO3
Copying files and folders
i) Moving files and folders
li) Permanently deleting files and folders.
b. List out the benefits of compressing file? Also explain reading of a zip file 8L2 co3
with an cxample.
c List out the differences between shutil.copy ) and shutil.copytrect )6 L3 CO3
method.

Q.3 . Briefly explain assertions and raising a cxception. 612 CO3

List out the bene fits of using logging module with an cxample. 6 L2 CO3

c Devclop a prograi with function iamed DivEap which takes two8L3 CO3
parameters a, b and returns a value C (C ab). Write suitable assertion for
a>0 in function DivEvp and raise an exception for when b =0. Devclop a
suitable progran which reads two values from the console and calls a
function DivExp.
Module - 5
0.S A. Define aclass and object, construct the class calied rectangleand initialize 8 L2 CO4
it with height 100, width 200, starting 3pont
p as (x=0, y= 0). Write
progrum to display the center point co-ordinates ofa rectangle.
b. Explain the concept of copying using copy module with an example. 6L2 CO4
Explain the concept of inheritance with an cxample. 6 L2 CO4

OR
Q.J0a. Define a function which takes two objects representing complex numbers|8 L2 CO4
and returns new complex number with aaddition of two complex Numbers.
Define a suitable class Complex' to represent the complex numbet.
Develop aprogram to read N(N>=2) complex numbers and to compute
the addition of Ncomplex numbers.
b. Explain_init )and__str_() method with exnamples. 6 12 CO4

C.Brielly cxplzin the printing of objectswith an examples. 6


CO4

2of?

You might also like