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 of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
What error occurs when you execute?
apple = mango
Which of the following is an invalid variable?
What is the output of the following code if the system date is 21st June, 2017 (Wednesday)?
[ ] or {}
{} or [ ]
Which of the following is incorrect?
What is the output of the code shown below?
D=dict(p='san', q='foundry')
'{p}{q}'.format(**D)
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
x[i].upper()
print (x)
The output of executing string.ascii_letters can also be achieved by:
Which of the following Boolean expressions is not logically equivalent to the other three?
What is the order of precedence in python?
i) Parentheses
ii) Exponential
iii) Division
iv) Multiplication
v) Addition
vi) Subtraction
What is the output of the following?
print('*', "abcdef".center(7), '*', sep='')
What is the output of the following?
i = 5
while True:
if i%0O11 == 0:
break
print(i)
i += 1
What is the output of the following code ?
class tester:
def __init__(self, id):
self.id = str(id)
id="224"
>>>temp = tester(12)
>>>print(temp.id)
What is the output of the code shown below?
'%.2f%s' % (1.2345, 99)
What is the output when following code is executed ?
>>>str1="helloworld"
>>>str1[::-1]
What is the output of the code shown below?
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))
Which of the following is true for variable names in Python?
What is the result of the snippet of code shown below if x=1?
x<<2
Given a function that does not return any value, What value is thrown by default when executed in shell.
What is the output of the following code ?
>>>max("what are you")
The output of the expression is:
bin(29)
What are the values of the following expressions:
2**(3**2)
(2**3)**2
2**3**2
What is the output of this expression if X= -122?
print("-%06d"%x)
What is the output of the following?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
What is the output of the following?
i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2
What is the output of the snippet of code shown below?
['hello', 'morning'][bool('')]
What is the value of this expression?
bin(0x8)
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(x)
What is the output of the following?
string = "my name is x"
for i in string:
print (i, end=", ")
What is the output of the following expression if x=456?
print("%-06d"%x)
What is the output of the code shown?
l=list('HELLO')
'first={0[0]}, third={0[2]}'.format(l)
What is the output when following code is executed ?
>>>print r"\nhello"
The output is
What is answer of this expression, 22 % 3 is?
What is the output of the following?
True = False
while True:
print(True)
break
What is the output when following statement is executed ?
>>> print(‘x\97\x98’)
What is the output of the following code ?
>>>example = "snow world"
>>>print("%s" % example[4:7])
Say s=”hello” what will be the return value of type(s) ?
Suppose i is 5 and j is 4, i + j is same as