What is the result of the expression if x=15 and y=12:
x & y
What error occurs when you execute?
apple = mango
What is the output of the code shown below?
t = '%(a)s, %(b)s, %(c)s'
t % dict(a='hello', b='world', c='universe')
What is the output of the following code ?
class Count:
def __init__(self, count = 0):
self.__count = count
c1 = Count(2)
c2 = Count(2)
print(id(c1) == id(c2), end = " ")
s1 = "Good"
s2 = "Good"
print(id(s1) == id(s2))
What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
print('i', end = " ")
What is the output of the following?
x = "abcdef"
i = "i"
while i in x:
print(i, end=" ")
Which of the following is an invalid variable?
What is the output of the following?
print('*', "abcdef".center(7), '*')
To check whether string s1 contains another string s2, use
What is the output of the code shown below?
def f(x):
def f1(*args, **kwargs):
print("*", 5)
x(*args, **kwargs)
print("*", 5)
return f1
@f
def p(m):
p(m)
print("hello")
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for i in d:
print(i)
What is the output of the following?
for i in range(int(2.0)):
print(i)
What is the result of the expression:
int(1011)?
What is the output of the code show below if a=10 and b =20?
a=10
b=20
a=a^b
b=a^b
a=a^b
print(a,b)
What is the output of the following?
i = 1
while True:
if i%0O7 == 0:
break
print(i)
i += 1
-
-
-
-
What is the output of the code shown?
['f', 't'][bool('spam')]
What is the output of the code shown below?
class A:
@staticmethod
def a(x):
print(x)
A.a(100)
What is the output of the following code ?
class father:
def __init__(self, param):
self.o1 = param
class child(father):
def __init__(self, param):
self.o2 = param
>>>obj = child(22)
>>>print "%d %d" % (obj.o1, obj.o2)
Which one of the following have the highest precedence in the expression?
What is the output of the following?
string = "my name is x"
for i in string.split():
print (i, end=", ")
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d:
print(x, y)
Which of the following expressions involves coercion when evaluated in Python?
Which of the following will run without errors ?
What is the output of the following?
print("abcdef".center(7, 1))
Suppose x is 345.3546, what is format(x, “10.3f”) (_ indicates space)
What is the output of the code shown?
x=3.3456789
'%s' %x, str(x)
What is the output of the following?
x = 2
for i in range(x):
x -= 2
print (x)
What is the output of the following?
d = {0, 1, 2}
for x in d:
print(x)
What is the result of round(0.5) – round(-0.5)?
What is the output of the code shown?
l=list('HELLO')
'first={0[0]}, third={0[2]}'.format(l)
What is the output of the code shown below?
not(3>4)
not(1&1)
What is the output of the following?
for i in 'abcd'[::-1]:
print (i)
What are the output of the code shown below?
def f(x):
def f1(*args, **kwargs):
print("*"* 5)
x(*args, **kwargs)
print("*"* 5)
return f1
def a(x):
def f1(*args, **kwargs):
print("%"* 5)
x(*args, **kwargs)
print("%"* 5)
return f1
@f
@a
def p(m):
print(m)
p("hello")
To find the decimal value of 1111, that is 15, we can use the function:
What is the output of the code snippet shown below?
X=”hi”
print(“05d”%X)
What is the output when following statement is executed ?
>>>print('new' 'line')
What is the return value of trunc() ?
Which of the following statement prints hello\example\test.txt ?
What is the value of the following expression:
24//6%3, 24//4//2