QSN 1
QSN 1
3. What will be the output of the following Python code snippet if x=1?
x<<2
a) 4
b) 2
c) 1
d) 8
6. What will be the output of the following Python expression if x=56.236? print("%.2f"%x)
a) 56.236
b) 56.23
c) 56.0000
d) 56.24
7. What will be the output of the following Python function? print(len(["hello",2, 4, 6]))
a) Error
b) 6
c) 4
d) 3
8. What will be the output of the following Python program?
def foo(x):
x[0] = ['def']
x[1] = ['abc']
return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))
a) Error
b) None
c) False
d) True
a) Error
b)
0
1
2
3
0
c)
0
1
2
d) none of the mentioned