GE - Computer Scien 81iXSLh
GE - Computer Scien 81iXSLh
(500) P.T.O.
.,
2393 2393 11
(iii) Number#List i (a) Write a function in Python that takes a digit (from
0 to 9) as an input parameter and returns the
(iv) Pass corresponding text in words. For example, on input
5, the function should return 'Five'. Use a
(v) ,N umber
dictionary for mapping digits to their string
(vi) Del (3) representation. (5)
P. T. O.
2393 10 2393 3
(iii) listl : 154,76,34, 'Hello', 421 segments else write no error. Justify your answer.
print(sum(list I ) )
(i) tlll : "Rinni"
(iv) strl = "Hi, wow are you?" print(t)
strl [4] : 'h'
(ii) tt2l[0] : 4s
(v) dictl : {'A':65, 'B':66, 'A':67} (3)
print(t)
print(dictl)
(6)
papers = {'GEl' : 'Python File', 'GE2': 'DBMS',
'GE3':'Computer Networks','GE4':'Information
(b) Identify the error(s) in the following: (4) Security')
(i) listl = ['Apple','Mango','Orange','Cherry'] What will be the output of the following function
listl [5] = 'PineaPPle' calls:
P. T. O.
2393 4 2393 9
(ii) print(papers.get('GE5','.No such paper 5. , (a) Write a function FnFactorQ that accepts a number
ist" ) )
ex as input parameter and print its factors. (4)
(h) Identify two exceptions that may be raised while (b) What will be the output of the following code
executing the following statement and justify your
segments: (6)
answer. (3)
(i) x : [1,2,3,4,s,6,7,8,9, I 0]
product = x/y
result:0
(i) Consider a string : (3) for i in x:
strl = "SEC, Front End Web Design and '
if i%oZ l= 0:
Development"
result += i
Find the output of the following statements : print(result)
(i) strl[7:]
(ii) series = [i for i in range(I, 50) if i%5 == 0]
(ii) strl[-len(strl) : len(srrl)] print(series)
O Consider the following: (3) (c) Identify the output/error (if any) for the following.
Justify your answer if it is an error. (5)
names = ["Abhinav", "Riya", "Kirti", "Divya"]
(i) setl : {"Word", "Excel", "PowerPoint"}
rollno = (101, 104, 106, 109)
print(set1[2])
subject : ["Maths", "English", "Chemistry",
"Economics"l
P.T.O.
2393 E 2393 5
ser2 : {4,5,6,2,3}
(c) Differentiate between copy( ) and deepcopy( ) set3: {4,5,7,8,9,2}
functions of the list, with the help of an example.
(s) What will be the output of the following:
P.T.O.
2393 6 2393 7
funct0
(c) Differentiate between extendQ and append0
functions of the list, with the help of an example Identify and describe 3 exceptions that can be
for each. (5) raised while executing the above function funct0.
3 (a) Write a function to print the following pattern: (c) What will be the output/error (if any) of the
(s) following code segment: (4)
55555 marks = 65
(i) print(func(57))
(b) Consider the following function: (6)
P. T. O.