What is the output of the code snippet above?
Anonymous Quiz
4%
0
22%
2.0
38%
2
7%
x
29%
SyntaxError
Code snippet:
from numbers import Number
from decimal import Decimal
from fractions import Fraction
print(isinstance(2.0, Number), end = ' ')
print(isinstance(Decimal('2.0'), Number), end = ' ')
print(isinstance(Fraction(2, 1), Number), end = ' ')
print(isinstance("2", Number), end = ' ')
What is the output of the code snippet above?
Anonymous Quiz
11%
True False True True
18%
True True True True
26%
True False True False
25%
True True True False
11%
False False False False
9%
False True False True
🔥2
What will be the output of the Python code above?
Anonymous Quiz
31%
[‘ab’, ‘cd’]
61%
[‘AB’, ‘CD’]
5%
[None, None]
4%
none of the mentioned
What happens if a class does not implement __str__()?
Anonymous Quiz
24%
Instances of that class will use __repr__() method of the class
29%
Instances of that class will output the name of the class when printed
26%
Instances of that class cannot be printed
21%
Instances of that class will output the dictionary with all instance attributes when printed
👍2
Code snippet:
from functools import reduce
numbers = [1, 2, 3]
reduce(lambda x, y: x + y, numbers)
Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))?
Anonymous Quiz
39%
[x**-1 for x in [(1, 2, 3)]]
22%
[1/x for x in [(1, 2, 3)]]
18%
[1/x for x in (1, 2, 3)]
21%
error
Which of the following lines of code will not show a match?
Anonymous Quiz
26%
>>> re.match(‘ab*’, ‘a’)
20%
>>> re.match(‘ab*’, ‘ab’)
23%
>>> re.match(‘ab*’, ‘abb’)
31%
>>> re.match(‘ab*’, ‘ba’)
😐1
What will be the output of the Python code above?
Anonymous Quiz
63%
[0]
16%
[1]
13%
[1, 0]
7%
[0, 1]
What will be the output of the code above?
Anonymous Quiz
7%
abc def
58%
ABC DEF
17%
Abc def
19%
Abc Def
👍1
Code snippet:
class A:
@staticmethod
def a(x):
print(x)
A.a(100)
What will be the output of the code snippet?
Anonymous Quiz
14%
Error
15%
Warning
58%
100
13%
No output