Logo

Python Questions Set 125:

Quiz Mode

What will be the output of the following code?

1
2
3
4

Solution:

  Which of the following is the same as math.exp(p)? 

1
2
3
4

Solution:

Suppose t = (1, 2, 4, 3), which of the following is incorrect? 

1
2
3
4

Solution:

If a='cpp', b='buzz' then which of the following operation would show 'cppbuzz' as output?

1
2
3
4

Solution:

What will be the output of the following Python code?

True = False
while True:
   print(True)
   break

1
2
3

Solution:

Suppose we are using the IDLE or Python interpreter. We want to print the result that is three times the last stored value in the interpreter. What should we do?

1
2
3
4

Solution:

What will be the output of the following Python code?

x = 'abcd'
for i in range(len(x)):
   print(i)

1
2
3
4

Solution:

 

What type of inheritance is illustrated in the following Python code?

class A():
   pass
class B():
   pass
class C(A,B):
   pass

1
2
3
4

Solution:

 

What will be the output of the following Python statement?(python 3.xx)

>>>print(format("Welcome", "10s"), end = '#')

>>>print(format(111, "4d"), end = '#')

>>>print(format(924.656, "3.2f"))

1
2

Solution:

 

What will be the output of the following Python code?

import re
s = 'abc123 xyz666 lmn-11 def77'
re.sub(r'\b([a-z]+)(\d+)', r'\2\1:', s)

1
2
3
4

Solution: