The output of the code shown below is:
'{0:f}, {1:2f}, {2:05.2f}'.format(1.23456, 1.23456, 1.23456)
The output of the snippet of code shown below?
bool(‘False’)
bool()
What is the value of the expression:
~100?
What is the output of the following?
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)
Which is the correct operator for power(x^y)?
Select all options that print
hello-how-are-you
What is the output of the following?
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
What is the output of the following?
a = [0, 1, 2, 3]
for a[-1] in a:
print(a[-1])
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 code shown below?
l=list('HELLO')
p=l[0], l[-1], l[1:3]
'a={0}, b={1}, c={2}'.format(*p)
What is the output of the code shown?
def ordi():
print("Ordinary")
ordi
ordi()
What is the result of cmp(3, 1)?
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 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 output of the following?
print("abc DEF".capitalize())
What will be displayed by print(ord(‘b’) – ord(‘a’)) ?
What is the output of the following code ?
class Count:
def __init__(self, count = 0):
self.__count = count
c1 = Count(2)
c2 = Count(2)
print(id(c1) == id(c2), end = " ")
s1 = "Good"
s2 = "Good"
print(id(s1) == id(s2))
What is the output when following statement is executed ?
>>>chr(ord('A'))
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 when following code is executed ?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
What is the value of this expression:
bin(10-2)+bin(12^4)
What is the output of the code snippet shown below?
X=”hi”
print(“05d”%X)
What is the output of the code shown?
x=3.3456789
'%s' %x, str(x)
To return the length of string s what command do we execute ?
Which of the following Boolean expressions is not logically equivalent to the other three?
What is the output of the following?
for i in ''.join(reversed(list('abcd'))):
print (i)
What is the output of the following?
for i in range(5):
if i == 5:
break
else:
print(i)
else:
print("Here")
Which of the following is not a complex number?
What is the output of the code shown below?
x=3.3456789
'%-6.2f | %05.2f | %+06.1f' %(x, x, x)
Which of the following expressions can be used to multiply a given number ‘a’ by 4?
What is the result of the expression:
0x35 | 0x75
What function do you use to read a string?
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?
for i in '':
print (i)
What is the result of the expression if x=15 and y=12:
x & y
What is the value of the expression:
float(4+int(2.39)%2)
In order to store values in terms of key and value we use what core datatype.
A function with parameters cannot be decorated. State whether true or false.
Consider the snippet of code shown below and predict the output.
X=”san-foundry”
print(“%56s”,X)