Nov Dec Makeup 2023 - Compressed
Nov Dec Makeup 2023 - Compressed
,
'
.,,--~,'~-~ ~
•; 1; -l·••1.
•.
-
usN Q //////I I I • ·:~ ( :W.~c~~}B1 BPLCKB2os
Second s " t!~~~
eme ster B.E./B. Tech. Degree Exa,in1'i__a'm~ ~./Dec. 2023
Time· 3 hr Introduction to Python Pr:d!jra--mming
• s. 'a Max. Marks: 100
Note· l A 1'-'...
• • nswer any FIVE full questions, choosing ONE full question fro,n each module.
.
2 • M·Miarks, L
: Bloom's level, C: Course_,o?itcomes.
,.
M L C
Q.1 a. De Module l )
to the su f th .. ., •
m o n p~ep cff digits in the number=,.Fo'r example, 371 ts an
Armstrong numbe,4}J%e 3**3 + 7**3+1 ** 3 = 371]
(:"' \ ~
, ,.._ OR ~t ~,
Q.2 a. Write a ~Yjllo~~rogram to guess the secr1t rl~mber between 1 to 25 within ' 8 L3 cot
5 guess ~~umber is same then it~,dght guess else wron&_ guess.
,,("~ ~ •
b .• What are ~user defined function? 'How can we pass th~,.arguments to the 6 Lt COi
functions? Explain with suitableexamples. ·f I··
'Ti'
~'
c. What are compari~on an~dblean operators~? citr all the comparison and 6 Lt COi
Boolean operators m python.
, I ~
" .
,-~~ Module-~., l
~
Q.3 a. Explain the metMls'of list data typ~~ ~hon for the fol!owing operation 8 LI CO2
with suitable c~,ie~nippets for each. \ "{;J,1,-
i) Add~alues to a list -::", , , 1,
ii) R~DJO~g value_s fro~ a(I1t
iii) Fi~ng a value 1n ~h -
,
iv) Sbrtmg the values ~
~ ...
E.~lain the concept <!~\st slicing and list traversing with an example.
b ., ~ 6 Lt CO2
t .. ,. ,
c. ~0 Wri~e a pyJ~-program to count occurrences of
What is a die~· 6 L3 CO2
characters ~-{ g and pnnt th~ t.
- _ ¥ OR
Write a python program ~~d the missing nu1nber from the given a list 10 L3 CO2
Q.4 a.
n-1 numbers ranging f r ~ ton, There are no duplicates (Hint - eg : Input
= 1 2 4 6 3 7 8, output :))
...
~
How is triple di[{IJepffrom li~t( )?_ Expl_ain with example the function used 6 Lt CO2
b.
to convert list int~iple and tnple into hst.
c. What are thre: •"mode" arguments that can be pa~ssed• to open( ) function
5 it ~
with exa1np le.
OR •
....
y --
u,sing the shelve mod~an d 6 L21Coi'
Q.6 a. W_ith code snippet, explain saving variah~s
print pfonnat( ) functions.
L3-
b. Write a python program that accepts 'a sentence and find the~,...l!_umber of
7
~
words, digits, upper case letters and lciwer case letters.
c. Write a program to make a new string with all the cons~ah t eliminated
7 L3 ~
from the string read from the user [Hint_ For exampl~Im?ut: Hello, have a
good day. Output : HII, hv grudy] ~
,,
Module 4 ,
Q.7 a. What is meant by compressing Files? Exp~ reading, extracting and 10 LI C01
creating 21 P files with an example.
b. Define assertions. What does an assert st~nient in python consists of? 5 LI CO2
~
7
..
Q.8 a. Discuss the basicConfig( )~ethod to confi~,ille lagging w an L2 CO2
example. 'ti
~
Explain ---- init ---- and str --- methed(\vtth an example. 5 L2 C04
c.
OR
~
-
Write a program to imple1nent polymorp hism in python using method 7 L3 co4
Q.10 a.
overridin g.
Define pure function? Give an example program that returns square of a 7 L3 co~
b.
passed integer.
L2 co~
c. How class can be instantiated in python? Write a python program to 6
instances as return values to define a class RECTANGLE with member
width. Height cornerX cornerY and 1nember function to find center area
and perimeter of a rectangle. __,,
L .
*****
2 of2