To return the length of string s what command do we execute ?
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?
'%x %d' %(255, 255)
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
i[x].upper()
print (x)
What does 3 ^ 4 evaluate to?
What is the output of this expression, 3*1**3?
All keywords in Python are in
What is the output when following code is executed ?
>>>str1="helloworld"
>>>str1[::-1]
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.keys():
print(d[x])
Which one of the following have the highest precedence in the expression?
What is the output of the following expression if X=345?
print(“%06d”%X)
What is the output of the following code?
hex(255), int('FF', 16), 0xFF
What is the output of the following code if the system date is 21st June, 2017 (Wednesday)?
[ ] or {}
{} or [ ]
Which of the following is an invalid statement?
What is the output when following code is executed ?
>>>print("D", end = ' ')
>>>print("C", end = ' ')
>>>print("B", end = ' ')
>>>print("A", end = ' ')
Why are local variable names beginning with an underscore discouraged?
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 of the following?
d = {0, 1, 2}
for x in d:
print(d.add(x))
What is the output of the following?
print("abcdef".center(7, 1))
What is the output of the snippet of code shown below?
['hello', 'morning'][bool('')]
The output of the snippet of code shown below?
bool(‘False’)
bool()
What is the value of this expression?
bin(0x8)
Which one of the following have the same precedence?
Which of the following cannot be a variable?
What is the result of round(0.5) – round(-0.5)?
What is the output of the code shown?
'{a}, {0}, {abc}'.format(10, a=2.5, abc=[1, 2])
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'
Identify the decorator in the snippet of code shown below.
def sf():
pass
sf = mk(sf)
@f
def sf():
return
What is the two’s complement of -44?
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(i)
What is the output of the following?
for i in range(2.0):
print(i)
What does ~4 evaluate to?
What is the output of the following?
for i in [1, 2, 3, 4][::-1]:
print (i)
Which of the following expressions can be used to multiply a given number ‘a’ by 4?
The format function, when applied on a string returns :
The expression Int(x) implies that the variable x is converted to integer. State whether true or false.
What is the output of “hello”+1+2+3 ?
Which of the following Boolean expressions is not logically equivalent to the other three?
The output of the code shown below is:
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')
The two snippets of codes shown below are equivalent. State whether true or false.
CODE 1
@f
def f1():
print(“Hello”)
CODE 2
def f1():
print(“Hello”)
f1 = f(f1)