All keywords in Python are in
Is Python case sensitive when dealing with identifiers?
What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
print('i', end = " ")
Which of the following expressions can be used to multiply a given number ‘a’ by 4?
What is the output when following statement is executed ?
>>>chr(ord('A'))
Which of the following is not a keyword?
What is the result of the expression:
0x35 | 0x75
What is the output of the following?
for i in 'abcd'[::-1]:
print (i)
What is the value of the expression:
float(4+int(2.39)%2)
What is the output of the following?
print('*', "abcde".center(6), '*', sep='')
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?
print('*', "abcdef".center(7), '*')
What is the result of the expression:
int(1011)?
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?
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0])
What is the output of the following?
x = 'abcd'
for i in x:
print(i)
x.upper()
What is the output of the following code ?
>>>example = "snow world"
>>>example[3] = 's'
>>>print example
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?
x = "abcdef"
i = "a"
while i in x[:-1]:
print(i, end = " ")
Why are local variable names beginning with an underscore discouraged?
What is the result of the expression shown below if x=56.236?
print("%.2f"%x)
What is the output of the following function?
def f(p, q):
return p%q
f(0, 2)
f(2, 0)
What is the result of the expression if x=15 and y=12:
x & y
Which of the following is true for variable names in Python?
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
print(x, y)
Which of the following will run without errors ?
What is the output of the code shown below?
'{0:.2f}'.format(1.234)
What is the output of the following?
print('*', "abcdef".center(7), '*', sep='')
What is the output of the following?
d = {0, 1, 2}
for x in d:
print(x)
To concatenate two strings to a third what statements are applicable ?
What is the output of the code shown?
s='%s, %s & %s'
s%('mumbai', 'kolkata', 'delhi')
The output of executing string.ascii_letters can also be achieved by:
What is the output of the code shown below?
not(3>4)
not(1&1)
What is the value of the expression:
~100?
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 expression if X=345?
print(“%06d”%X)
What is the output of the code shown?
['f', 't'][bool('spam')]
What is the output when following code is executed ?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
Consider the snippet of code shown below and predict the output.
X=”san-foundry”
print(“%56s”,X)
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(d[x])