Which of the following is incorrect?
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 expression if x=456?
print("%-06d"%x)
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d:
print(x, y)
Which of the following results in a SyntaxError ?
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()
Why are local variable names beginning with an underscore discouraged?
Which of the following Boolean expressions is not logically equivalent to the other three?
The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same. State whether true or false.
What is the output of the code shown below?
'%x %d' %(255, 255)
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 executing string.ascii_letters can also be achieved by:
What will be displayed by print(ord(‘b’) – ord(‘a’)) ?
What is the output of the following code ?
>>>example = "helle"
>>>example.find("e")
What is the output of the code shown?
s='%s, %s & %s'
s%('mumbai', 'kolkata', 'delhi')
What is the output of the code shown below?
class Truth:
pass
x=Truth()
bool(x)
The output of the expression is:
bin(29)
Which among the following list of operators has the highest precedence?
+, -, **, %, /, <<, >>, |
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 following?
x = (i for i in range(3))
for i in x:
print(i)
What is the two’s complement of -44?
Which of the following is not a keyword?
What is the output of the following?
print("abcdef".center(0))
Consider the snippet of code shown below and predict the output.
X=”san-foundry”
print(“%56s”,X)
What is the output of the following?
x = 'abcd'
for i in range(x):
print(i)
What is the output of the following?
True = False
while True:
print(True)
break
The output of which of the codes shown below will be: “There are 4 blue birds.”?
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'
What is the output of the snippet of code shown below?
['hello', 'morning'][bool('')]
What is the output of the following?
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0])
What is the output of the following?
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
Which of the following is incorrect?
What is the output of the following?
d = {0, 1, 2}
for x in d:
print(x)
The format function, when applied on a string returns :
What is the output of the following?
x = "abcdef"
i = "a"
while i in x[:-1]:
print(i, end = " ")
What is the value of x if:
x>>2=2
What function do you use to read a string?
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 is the output of the following code ?
>>>max("what are you")
What is the output of the code shown?
['f', 't'][bool('spam')]