All keywords in Python are in
Which of the following represents the bitwise XOR operator?
What dataype is the object below ?
L = [1, 23, ‘hello’, 1].
What is the output of the following code?
hex(255), int('FF', 16), 0xFF
What is the output of the code shown below?
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))
What is the output of the code shown below?
'{0:.2f}'.format(1.234)
What is answer of this expression, 22 % 3 is?
The output of which of the codes shown below will be: “There are 4 blue birds.”?
The format function, when applied on a string returns :
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 value of x if:
x>>2=2
What is the result of cmp(3, 1)?
What is the result of the expression shown below if x=56.236?
print("%.2f"%x)
What is the output of the following?
d = {0, 1, 2}
for x in d:
print(x)
What is the value of the expression:
4+2**5//10
What is the value of this expression:
bin(10-2)+bin(12^4)
What is the output of the following?
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
Which of the following expressions results in an error?
What is the output when following statement is executed ?
>>>"a"+"bc"
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(d[x])
Which of these in not a core datatype?
Which of the following cannot be a variable?
What is the output of the code shown?
['f', 't'][bool('spam')]
Carefully observe the code and give the answer.
def example(a):
a = a + '2'
a = a*2
return a
>>>example("hello")
What is the output of the following?
print("abc DEF".capitalize())
What is the output of the following?
for i in '':
print (i)
What does ~4 evaluate to?
What is the output of the code shown?
'%(qty)d more %(food)s' %{'qty':1, 'food': 'spam'}
What is the output of the following?
a = [0, 1, 2, 3]
for a[-1] in a:
print(a[-1])
What is the output of the code shown below?
def c(f):
def inner(*args, **kargs):
inner.co += 1
return f(*args, **kargs)
inner.co = 0
return inner
@c
def fnc():
pass
if __name__ == '__main__':
fnc()
fnc()
fnc()
print(fnc.co)
In python we do not specify types,it is directly interpreted by the compiler, so consider the following operation to be performed.
>>>x = 13 ? 2
objective is to make sure x has a integer value, select all that apply (python 3.xx)
What is the output of the following?
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)
The output of the two codes shown below is the same. State whether true or false.
'{0:.2f}'.format(1/3.0)
'%.2f'%(1/3.0)
What is the output when following code is executed ?
>>>print r"\nhello"
The output is
What is the output of the code shown?
def ordi():
print("Ordinary")
ordi
ordi()
What is the output of the following?
string = "my name is x"
for i in string.split():
print (i, end=", ")
What is the result of the expression if x=15 and y=12:
x & y
The output of the expression is:
bin(29)
What is the output of the code snippet shown below?
X=”hi”
print(“05d”%X)
What is the output of the following?
i = 1
while True:
if i%3 == 0:
break
print(i)
i + = 1