Question: 6 -
What is the value of the following Python Expressionprint(36 / 4)
-
0.9
-
9.0
-
9
-
0.09
Answer:
9.0
Solution not available.
Question: 7 -
What is the output of the following addition (+) operatora = [10, 20]
b = a
b += [30, 40]
print(a)
print(b)
-
[10, 20, 30, 40]
[10, 20, 30, 40] -
[30, 40]
[10, 20, 30, 40] -
[10, 20]
[10, 20, 30, 40] -
- [10, 30]
[10, 20, 30, 40]
Answer:
- [10, 30]
[10, 20, 30, 40]
[10, 20, 30, 40]
Solution not available.
Question: 8 -
What is the output of the following assignment operatory = 10
x = y += 2
print(x)
-
10
-
2
-
Error
-
12
Answer:
Error
Solution:
x = y += 2 expression is Invalid
x = y += 2 expression is Invalid
Question: 9 -
What is the output of print(2 * 3 ** 3 * 4)
-
816
-
216
-
864
-
256
Answer:
216
Solution:
The exponent (**) operator has higher precedence than multiplication (*). Therefore the statement print(2 * 3 ** 3 * 4) evaluates to print(2 * 27 * 4)
The exponent (**) operator has higher precedence than multiplication (*). Therefore the statement print(2 * 3 ** 3 * 4) evaluates to print(2 * 27 * 4)
Question: 10 -
What is the output of print(2%6)
-
1
-
ValueError
-
0.33
-
2
Answer:
2
Solution:
The first number is the numerator, and the second is the denominator. here, 2 is divided by 6. So the remainder is 2. Therefore the result is 2
The first number is the numerator, and the second is the denominator. here, 2 is divided by 6. So the remainder is 2. Therefore the result is 2