€
Total No. ofQuestions : Sl
P-t305
? sE,{T Nn. :
l-l'ntal
r---t
\a. of l)*gr: :J
[60ss]-307
ili:rh
. t.1.5.DC.
^
C.t)Mp, ER scIENCE
G. 58351$: Python Programming
(ffi n*tern) (CBCS) (Semester - v)
Hours"f:)t ''.
ftme: 2 {Nlax- iltnrk: : -1-i
lnstiltctiotrs te the candidates :
2) Figuyrs to the right indicate full nnrks.
3) Toint number of questions nre .five.
a) How arc comments written in.l then?
h ) Give the use of index() irt,sfiing-:. -
c) Explain ttre rnnge{)'f,g14btian+hd its palameters.
d) How to create a vcrid tuii'etion in P1,'thon?
e) What is the differencb ietween pop() anil del in iist.
t) Compare list and tuple (an-v trvo points).
g) What doss the follorving functions retrun - clocki; and gnrtirnc( 1.
h)Listthesyntaxforlrandlingexception..,".=
t'
i) List ary trvq functions in math moclule. ,.,-
j) Explain the function enunrerate$.
P.?',.4.
u
*
.*s
Q2) Atttwpt any Four of the following: [4x2=8]
a) Which rnethods ar e used to read from a file? Explain any tw,o rvith exarnple.
b) What are the usage ot'di5rionary copy(), Bets0, items(.i and keysO
nreiho,li')
l:) l:rpluin uniorr rrnd irrlcrsetti'tn u'ith erurnple.
(l I [,xDlain thc lb]lorvrr:e slaltrrnenl
i) if b) ,' il'else' c) break dl continue
e) I-ist leatur:rys,of Pyl on.
Q3J Attempt an.l;-'Iwo of the following : [2x4=31
a) Write,a prGgranr to get a single string fronr hvo given strings. separated
by-pace and srvap the tilst two characters of each string
Sam@rnput: 'abc'. 'pqr' 't
()rnpyl pqc abr
b) Writ+,a'program to displa-v pou,-e1of 2 ai.1b a given number using
ano11\/nious tillctioh
Exanrple .-io I
\')
2 rlised to 0 is I
2 raised to I is 2 :.'
2 raised to 2 is 4 'l ,.
c ) Write a prograim to riart a;r entire te xt l'ile
Q4l Attempt anv Two of the ftrllowing: [2x4=81
a) Write a pvthon program to Count Vowels and Conso*ar1ts h,q String.
tr) Wlite u Pytlron script to print a dictionary where tt.; ke.1,s are numbers
betn'ecn I and l5 (both included) and the valuors'#e the square of the
ke5.s. ,l;:..
Sanrple Dictionary
trl: 1.2:4,3:9,4: 16,5:25. 6:36, 7:49,8:64.9:81, I 0':r100, l1 , l2l , 12: 144,
13: 169. 14:196. 15:225\1 -- ,. :-i.i:..
c) Write a Python function that acLrepts a.*rirB.dnd counts the number of
uppcr urrd lower sase lclturs.
[60s5]-307
,/, /
*
p-! Attenrpt Auv one of the follorving:
a)
a - l-rLtc
b - Iralsc
r' fulsi
Ii I](]l,l ('r'lr:
llr'inl I i '
Clil ttot U r'l ll(,1 lr ill)(l !.
pr.ii;: (2)
clii-rr,rt lr ol ll or no1 h and a:
prirt (.1)
elsc:
I't.i,rl {.1,
b) dct I I (x^ l','[ ]t'
for i rit r.anqg(x):
l.append(i+i)
printl l )
1't (2)
il i3 f3.2.11)
1ti3)
coco
[60ss]-307