Xiicomp SC Pt1458
Xiicomp SC Pt1458
5 Which of the following statement(s) would give an error after executing the following 1
code?
D={'rno':32,'name':'Ms Archana','subject':['hindi','english','cs'],'marks':(85,75,89)} #S1
print(D) #S2
D['subject'][2]='IP' #S3
D['marks'][2]=80 #S4
print(D) #S5
(A) S1 (B) S3
(C) S4 (D) S3 and S4
6 Select the correct output of the following python code: 1
str="My program is program for you"
t = str.partition("program")
print(t)
a) ('My ', 'program', ' is ', 'program', ' for you')
b) ('My ', 'program', ' is program for you')
c) ('My ', ' is program for you')
d) ('My ', ' is ', ' for you')
7 Which of the following statement(s) would give an error after executing the following 1
code?
S="Welcome to my python program" # Statement 1
print(S) # Statement 2
S="Python is Object Oriented programming" # Statement 3
S= S * “5” # Statement 4
S=S+"Thank you" # Statement 5
(a) Statement 3
(b) Statement 4
(c) Statement 5
(d) Statement 4 and 5
8 Select the correct output of the code: 1
for i in "QUITE":
print([i.lower()], end= "#")
(a) q#u#i#t#e#
(b) [‘quite#’]
(c) ['q']#['u']#['i']#['t']#['e']#
(d) [‘quite’] #
9 What will the following expression be evaluated to in Python? 1
print(2**3 + (5 + 6)**(1 + 1))
(a) 129 (b)8 (c) 121 (d) None
10 What will be the Output for the following code – 1
Language=["C", "C++", "JAVA", "Python", "VB", "BASIC", "FORTRAN"]
del Language[4]
Language.remove("JAVA")
Language.pop(3)
print(Language)
(a) ['C', 'C++', 'VB', 'FORTRAN']
(b) ['C', 'C++', 'Python', 'FORTRAN']
(c) ['C', 'C++', 'BASIC', 'FORTRAN']
(d) ['C', 'C++', 'Python', 'BASIC']
11 What will be the value of y when following expression be evaluated in Python? 1
x=10.0
y=(x<100.0) and x>=10
(a)110 (b) False (c)Error (d)True
12 Which of the following is valid arithmetic operator in Python: 1
(a) // (b) ? (c ) < (d) and
13 string= "it goes as - ringa ringa roses" 1
sub="ringa"
string.find(sub,15,22)
(a) 13 (b)-13 (c) -1 (d) 19
14 Assertion (A):- key word arguments are related to the function calls. 1
Reasoning (R):- when you use keyword arguments in a function call, the caller
identifies the arguments by parameter name
15 Assertion (A):- If the arguments in a function call statement match the number and 1
order of arguments as defined in the function definition, such arguments are called
positional arguments.
Reasoning (R):- During a function call, the argument list first contains default
argument(s) followed by positional argument(s).
16 1.What will be the output of the following python statement? 1
L=[3,6,9,12]
L=L+15
print(L)
(a)[3,6,9,12,15] (b) [18,21,24,27] (c) [5,3,6,9,12,15] (d) error
SECTION-B
17 Observe the following Python code very carefully and rewrite it after 2
removing all syntactical errors with each correction underlined.
DEF execmain():
x = input("Enter a number:")
if (abs(x)== x)
print("You entered a positive number")
else:
x=*1
print("Number made positive:" x )
18 (a) Given is a Python string declaration: 2
str="CBSE Examination@2022"
Write the output of: print(str[-1:-15:-2])
(b)Writetheoutputofthe codegivenbelow:
D1 ={"sname":"Aman","age":26}
D1['age']=27
D1['address']=
"Delhi"
print(D1.items())