Which one of the following have the same precedence?
What is answer of this expression, 22 % 3 is?
The output of the snippet of code shown below is:
'%d %s %g you' %(1, 'hello', 4.0)
What is the output of the code shown below?
D=dict(p='san', q='foundry')
'{p}{q}'.format(**D)
In the code shown below, which function is the decorator?
def mk(x):
def mk1():
print("Decorated")
x()
return mk1
def mk2():
print("Ordinary")
p = mk(mk2)
p()
What is the output of the following?
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)
What is the output when following statement is executed ?
>>>chr(ord('A'))
Fill in the blanks:
The formatting method {1:<10} represents the ___________ positional argument, _________ justified in a 10 character wide field.
What are the values of the following expressions:
2**(3**2)
(2**3)**2
2**3**2
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?
x = "abcdef"
i = "a"
while i in x:
x = x[1:]
print(i, end = " ")
Consider the snippet of code shown below and predict the output.
X=”san-foundry”
print(“%56s”,X)
What is the two’s complement of -44?
What is the output of the following?
print("abcdef".center(0))
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(d[x])
What is the output of the snippet of code shown below?
['hello', 'morning'][bool('')]
The value of the expression:
4 + 3 % 5
What is the output of the following?
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
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))
Suppose i is 5 and j is 4, i + j is same as
The output of the line of code shown below is:
not(10<20) and not(10>30)
Which of the following expressions results in an error?
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'
The format function, when applied on a string returns :
What is the output of the code shown below?
def f(x):
def f1(a, b):
print("hello")
if b==0:
print("NO")
return
return f(a, b)
return f1
@f
def f(a, b):
return a%b
f(4,0)
What is the output of the following?
i = 5
while True:
if i%0O9 == 0:
break
print(i)
i += 1
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 code shown below?
if (9 < 0) and (0 < -9):
print("hello")
elif (9 > 0) or False:
print("good")
else:
print("bad")
What is the output of the code shown below?
def d(f):
def n(*args):
return '$' + str(f(*args))
return n
@d
def p(a, t):
return a + a*t
print(p(100,0))
Which of the following is not a complex number?
What is the output of the code shown?
['f', 't'][bool('spam')]
What is the value of x if:
x = int(43.55+2/2)
What is the output of “hello”+1+2+3 ?
What is the output when following statement is executed ?(python 3.xx)
>>>print(format("Welcome", "10s"), end = '#')
>>>print(format(111, "4d"), end = '#')
>>>print(format(924.656, "3.2f"))
What is the output of the following?
x = 123
for i in x:
print(i)
What is the output of the following?
x = "abcdef"
i = "i"
while i in x:
print(i, end=" ")
Which of these in not a core datatype?
The expression shown below results in an error. State whether this statement is true or false.
print("-%5d0",989)
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d:
print(x, y)
What is the output of the following?
x = (i for i in range(3))
for i in x:
print(i)
for i in x:
print(i)