What is the output of the following?
x = 'abcd'
for i in range(len(x)):
i.upper()
print (x)
What is the result of the expression:
0x35 | 0x75
All keywords in Python are in
If a class defines the __str__(self) method, for an object obj for the class, you can use which command to invoke the __str__ method.
What dataype is the object below ?
L = [1, 23, ‘hello’, 1].
What is the output of the code shown below?
'{0:.2f}'.format(1.234)
What does 3 ^ 4 evaluate to?
Which among the following list of operators has the highest precedence?
+, -, **, %, /, <<, >>, |
Say s=”hello” what will be the return value of type(s) ?
The output of the line of code shown below is:
not(10<20) and not(10>30)
What is the value of x if:
x = int(43.55+2/2)
What is the average value of the code that is executed below ?
>>>grade1 = 80
>>>grade2 = 90
>>>average = (grade1 + grade2) / 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?
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0])
What is the output of the code shown below?
def mk(x):
def mk1():
print("Decorated")
x()
return mk1
def mk2():
print("Ordinary")
p = mk(mk2)
p()
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)
What is answer of this expression, 22 % 3 is?
What is the output of the following?
d = {0, 1, 2}
for x in d.values():
print(x)
What is the output of the following?
x = "abcdef"
while i in x:
print(i, end=" ")
What is the return type of function id ?
What is the output of the following?
for i in range(float('inf')):
print (i)
What is the output of the following?
print("abcdef".center(0))
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")
What is the output of the following code ?
>>>example = "helle"
>>>example.find("e")
What is the value of the expression:
~100?
What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
x = x[:-1]
print(i, end = " ")
Which of the following is incorrect?
The output of the two codes shown below is the same. State whether this statement is true or false.
bin((2**16)-1)
'{}'.format(bin((2**16)-1))
Which is the correct operator for power(x^y)?
What is the output of the code shown below?
class A:
@staticmethod
def a(x):
print(x)
A.a(100)
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 code shown below?
'{a}{b}{a}'.format(a='hello', b='world')
What is the output of the code shown?
s='%s, %s & %s'
s%('mumbai', 'kolkata', 'delhi')
What is the output of the following code ?
>>>example = "snow world"
>>>example[3] = 's'
>>>print example
The output of the expression is:
bin(29)
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 code ?
>>>example = "snow world"
>>>print("%s" % example[4:7])
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
i[x].upper()
print (x)
Which of the following results in a SyntaxError ?
What is the output of the following?
d = {0, 1, 2}
for x in d:
print(d.add(x))