Time:
20:00
1.
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d .values():
print(x, end = " ")
0 1 2
a b c
0a 1b 2c
none of the mentioned
2.
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d .values():
print( d[ x ] )
0 1 2
a b c
0a 1b 2c
none of the mentioned
3.
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d .values():
print( x )
0 1 2
None None None
error
none of the mentioned
4.
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d :
print( x )
0 1 2
{0, 1, 2} {o, 1, 2} {0, 1, 2}
error
none of the mentioned
5.
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d :
print( d.add( x ) )
0 1 2
0 1 2 0 1 2 0 1 2...
None None None
None of the mentioned
6.
What will be the output of the following Python code?
for i in range( 0 ) :
print( i )
0
no output
error
none of the mentioned
7.
What will be the output of the following Python code?
for i in range( 2.0 ) :
print( i )
0.0 0.1
0 1
error
none of the mentioned
8.
What will be the output of the following Python code?
for i in range( int( 2.0 )) :
print( i )
0.0 1.0
0 1
error
none of the mentioned
9.
What will be the output of the following Python code?
for i in range( float( 'inf' )) :
print( i )
0.0 0.1 0.2 0.3 ...
0 1 2 3 ...
0.0 1.0 2.0 3.0 ...
none of the mentioned
10.
What will be the output of the following Python code?
for i in range( int( float( 'inf' ))) :
print( i )
0.0 0.1 0.2 0.3 ...
0 1 2 3 ...
0.0 1.0 2.0 3.0 ...
none of the mentioned
11.
What will be the output of the following Python code?
for i in [1, 2, 3, 4] [ : : -1] :
print( i )
1 2 3 4
4 3 2 1
error
none of the mentioned
12.
What will be the output of the following Python code?
for i in ' ' .join( reversed( list( 'abcd' ))) :
print( i )
a b c d
d c b a
error
none of the mentioned
13.
What will be the output of the following Python code?
for i in 'abcd' [ : :-1] :
print( i )
a b c d
d c b a
error
none of the mentioned
14.
What will be the output of the following Python code?
for i in ' ' :
print( i )
None
(nothing is printed)
error
none of the mentioned
15.
What will be the output of the following Python code?
x = "abcd"
for i in range( len(x) ):
print(x, end = " ")
x = "a"
a
abcd abcd abcd abcd
a a a a
abcd a a a
16.
What will be the output of the following Python code?
x = 2
for i in range(x) :
x + = 1
print( x )
0 1 2 3 4 ...
3 4
0
error
17.
What will be the output of the following Python code?
x = 2
for i in range(x) :
x - = 2
print( x )
0 1 2 3 4 ...
0 -2
0
error
18.
What will be the output of the following Python code?
for i in range( 10 ) :
if i == 5 :
break
else :
print( i )
else :
print( "Here" )
0 1 2 3 4 Here
0 1 2 3 4 5 Here
0 1 2 3 4
1 2 3 4 5
19.
What will be the output of the following Python code?
for i in range( 5 ) :
if i == 5 :
break
else :
print( i )
else :
print( "Here" )
0 1 2 3 4 Here
0 1 2 3 4 5 Here
0 1 2 3 4
1 2 3 4 5
20.
What will be the output of the following Python code?
x = (0, 1, 2, 3)
for i in range( 3) :
if i in x:
print( i )
0 1 2
error
0 1 2 0 1 2
None of the mentioned
Submit