What error occurs when you execute?
apple = mango
The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same. State whether true or false.
The output of the code shown below is:
'{0:f}, {1:2f}, {2:05.2f}'.format(1.23456, 1.23456, 1.23456)
Operators with the same precedence are evaluated in which manner?
What is the value of the following expression:
24//6%3, 24//4//2
What is the output of the following?
print('*', "abcdef".center(7), '*')
The output of the expression is:
bin(29)
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?
for i in range(float('inf')):
print (i)
Following set of commands are executed in shell, what will be the output?
1.>>>str="hello"
2.>>>str[:2]
3.>>>
Which of the following expressions involves coercion when evaluated in Python?
What is the output of the code shown below?
x=3.3456789
'%-6.2f | %05.2f | %+06.1f' %(x, x, x)
In the code shown below, which function is the decorator?
def mk(x):
def mk1():
print("Decorated")
x()
return mk1
def mk2():
print("Ordinary")
p = mk(mk2)
p()
What is the output of the following?
x = 'abcd'
for i in x:
print(i)
x.upper()
Identify the decorator in the snippet of code shown below.
def sf():
pass
sf = mk(sf)
@f
def sf():
return
What is the output of the code shown?
['f', 't'][bool('spam')]
What is the value of the following expression?
2+4.00, 2**4.0
What is the output when following code is executed ?
>>>str1="helloworld"
>>>str1[::-1]
What is the result of the expression shown below if x=56.236?
print("%.2f"%x)
What is the output of this expression, 3*1**3?
What is the output when following code is executed ?
>>>print("D", end = ' ')
>>>print("C", end = ' ')
>>>print("B", end = ' ')
>>>print("A", end = ' ')
The output of the line of code shown below is:
not(10<20) and not(10>30)
What is the output of the code shown?
x=3.3456789
'%f | %e | %g' %(x, x, x)
What is the output of the following function?
def f(p, q):
return p%q
f(0, 2)
f(2, 0)
Which of the following is the truncation division operator?
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)
What is the output of the code shown below?
'%.2f%s' % (1.2345, 99)
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for i in d:
print(i)
What is the value of the following expression:
float(22//3+3/3)
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
i.upper()
print (x)
What is the output of the following expression if X=345?
print(“%06d”%X)
What is the output of the following?
i = 1
while True:
if i%3 == 0:
break
print(i)
i + = 1
What is the output of the following?
print("abcdef".center())
What is the output of the following?
for i in range(5):
if i == 5:
break
else:
print(i)
else:
print("Here")
What is the output of the following?
print('*', "abcdef".center(7), '*', sep='')
What is the output of the following?
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
What is the output when following statement is executed ?
>>>"a"+"bc"
What is the output of the code shown below?
'%x %d' %(255, 255)
What is the output of the following?
x = 'abcd'
for i in range(x):
print(i)