What is the output of the code shown below?
D=dict(p='san', q='foundry')
'{p}{q}'.format(**D)
Which of the following expressions is an example of type conversion?
Which one of the following have the same precedence?
What is the value of x if:
x = int(43.55+2/2)
What is the output of the following expression if X=345?
print(“%06d”%X)
What is the output of the following?
x = (i for i in range(3))
for i in x:
print(i)
What is the output when following statement is executed ?
>>>chr(ord('A'))
What is the output of the following?
for i in 'abcd'[::-1]:
print (i)
What is the output of the following?
for i in ''.join(reversed(list('abcd'))):
print (i)
What is the output of the following?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
The output of the code shown below is:
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')
Which one of these is floor division?
What is the output when following statement is executed ?
>>>"a"+"bc"
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.
Which of the following cannot be a variable?
The code shown above can work with ____ parameters.
def f(x):
def f1(*args, **kwargs):
print("Sanfoundry")
return x(*args, **kwargs)
return f1
What is the output when following statement is executed ?
>>>print('new' 'line')
Which of the following operators has its associativity from right to left?
Which of the following is true for variable names in Python?
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)
Fill in the blanks:
The formatting method {1:<10} represents the ___________ positional argument, _________ justified in a 10 character wide field.
What is the output of the following?
x = "abcdef"
i = "i"
while i in x:
print(i, end=" ")
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 “hello”+1+2+3 ?
What is the output of the following?
for i in range(int(2.0)):
print(i)
What is the output of the following?
d = {0, 1, 2}
for x in d:
print(x)
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 result of the expression:
0x35 | 0x75
What does ~4 evaluate to?
The output of the code shown below is:
'{0:f}, {1:2f}, {2:05.2f}'.format(1.23456, 1.23456, 1.23456)
What is the value of the expression:
~100?
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 when following code is executed ?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
Which of the following is the truncation division operator?
What is the output of the following?
for i in range(0):
print(i)
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 following?
print("abcdef".center(7, 1))
What is the output of this expression if x=22.19?
print("%5.2f"%x)
Operators with the same precedence are evaluated in which manner?