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)
It is not possible for the two’s complement value to be equal to the original value in any case. State whether this statement is true or false.
What is the output of the following?
a = [0, 1, 2, 3]
i = -2
for i not in a:
print(i)
i += 1
What is the output of the following?
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
Which one of these is floor division?
What is the output of the following?
x = 'abcd'
for i in x:
print(i.upper())
Which of the following is the truncation division operator?
What is the result of round(0.5) – round(-0.5)?
What is the result of the expression:
int(1011)?
What is the output of the code shown below?
x=3.3456789
'%-6.2f | %05.2f | %+06.1f' %(x, x, x)
What is the output of the following?
print('*', "abcde".center(6), '*', sep='')
What is the output of the code shown below?
class A:
@staticmethod
def a(x):
print(x)
A.a(100)
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(x)
To check whether string s1 contains another string s2, use
What does 3 ^ 4 evaluate to?
What is the output of the following expression if the value of x is 34?
print(“%f”%x)
What dataype is the object below ?
L = [1, 23, ‘hello’, 1].
What is the output of the following?
for i in 'abcd'[::-1]:
print (i)
What is the output of the code shown?
'%(qty)d more %(food)s' %{'qty':1, 'food': 'spam'}
The one’s complement of 110010101 is:
What is the output of the following?
print("abcdef".center(7, 1))
What is the output when following statement is executed ?
>>>"abcd"[2:]
Which of the following expressions is an example of type conversion?
The output of which of the codes shown below will be: “There are 4 blue birds.”?
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))
What is the output of “hello”+1+2+3 ?
What is the output of the following?
print("abc. DEF".capitalize())
Which of the following cannot be a variable?
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
print(x, y)
The output of the snippet of code shown below?
bool(‘False’)
bool()
Which of the following expressions results in an error?
What is the output of the following code ?
>>>example = "helle"
>>>example.rfind("e")
The ______ symbol along with the name of the decorator function can be placed above the definition of the function to be decorated works as an alternate way for decorating a function.
What arithmetic operators cannot be used with strings ?
What is the value of x if:
x>>2=2
The value of the expression:
4 + 3 % 5
The output of the line of code shown below is:
not(10<20) and not(10>30)
What is the output of the following?
i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2
Suppose i is 5 and j is 4, i + j is same as
What is the output of the following?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")