Logo

Python Questions Set 11:

Quiz Mode

Suppose list1=[1,2,3] ,then list*2 is

1
2
3
4

Solution:

What is the output of the following code?

import math

a = 10.3

b = math.ceil(a)

print(b)

1
2
3
4

Solution:

What is the output of the following code?

>>> a = 83.

>>> b = 6

>>> a // b

1
2
3
4
5

Solution:

>>> x = 2

>>> y = x * 2

>>> x = 3

>>> x = y + 1

>>> z = 2 ** y

>>> z

What is the value of 'z'?

1
2
3
4

Solution:

 Which of the following is correct? 

1
2
3
4

Solution:

 

What will be the output of the following Python code?


 >>> a={1:"A",2:"B",3:"C"}

 >>> a.items() 

1
2
3
4

Solution:

Fill in the blank in the following Python code to calculate the factorial of a number.

def fact(num):
   if num == 0:
       return 1
   else:
       return num*fact(num-1)

1
2
3
4

Solution:

import re

text="avrhj@rjgn.irg to jngrj@ioer.njvk"

pattern=re.compile("[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z]+")

result=pattern.findall(text)

print(type(result))


What does the above code prints?

1
2
3
4

Solution:

What is the purpose of the 'send_message()' method in the Mail class?

1
2
3
4

Solution:

 Which of the following statements is false about recursion? 

1
2
3
4

Solution: