What is the return value of trunc() ?
Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
What is answer of this expression, 22 % 3 is?
What is the output of the following?
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
The one’s complement of 110010101 is:
Which of the following is invalid?
What is the output of the following?
i = 1
while True:
if i%3 == 0:
break
print(i)
i + = 1
Bitwise _________ gives 1 if either of the bits is 1 and 0 when both of the bits are 1.
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
i[x].upper()
print (x)
What is the output of the following?
print("abcdef".center())
What is the output of the following?
x = (i for i in range(3))
for i in x:
print(i)
What is the output of the following code ?
>>>example = "snow world"
>>>print("%s" % example[4:7])
What is the output of the following?
d = {0, 1, 2}
for x in d.values():
print(x)
What is the output of the following?
x = (i for i in range(3))
for i in x:
print(i)
for i in x:
print(i)
What is the result of the expression shown below if x=56.236?
print("%.2f"%x)
What is the output of the following?
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
What is the output of the following?
for i in ''.join(reversed(list('abcd'))):
print (i)
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)
What is the result of cmp(3, 1)?
What is the output of the code shown?
a='hello'
q=10
vars()
Which of the following expressions results in an error?
What is the output of the code shown below?
class Truth:
pass
x=Truth()
bool(x)
What is the output of the following?
i = 1
while False:
if i%2 == 0:
break
print(i)
i += 2
Which of the following Boolean expressions is not logically equivalent to the other three?
What is the output of the following expression if X=345?
print(“%06d”%X)
What is the value of x if:
x>>2=2
What is the output of the following?
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)
Which one of the following have the highest precedence in the expression?
Suppose i is 5 and j is 4, i + j is same as
What is the output of the following?
for i in range(2.0):
print(i)
Select all options that print
hello-how-are-you
What is the output of the following?
print('*', "abcdef".center(7), '*', sep='')
What is the result of round(0.5) – round(-0.5)?
What is the output of the following code ?
class Name:
def __init__(self, firstName, mi, lastName):
self.firstName = firstName
self.mi = mi
self.lastName = lastName
firstName = "John"
name = Name(firstName, 'F', "Smith")
firstName = "Peter"
name.lastName = "Pan"
print(name.firstName, name.lastName)
What is the output of the code shown below?
t = '%(a)s, %(b)s, %(c)s'
t % dict(a='hello', b='world', c='universe')
The output of the two codes shown below is the same. State whether this statement is true or false.
bin((2**16)-1)
'{}'.format(bin((2**16)-1))
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(x)
To find the decimal value of 1111, that is 15, we can use the function:
What is the output of “hello”+1+2+3 ?
The output of the expression is:
bin(29)