## Python Questions and Answers Part-2

1. Which one of the following has the same precedence level?
d) Multiplication, Division, Addition and Subtraction

Explanation: “Addition and Subtraction” are at the same precedence level. Similarly, “Multiplication and Division” are at the same precedence level. However, Multiplication and Division operators are at a higher precedence level than Addition and Subtraction operators.

2. Operators with the same precedence are evaluated in which manner?
a) Right to Left
b) Left to Right
c) Can’t say
d) None of the above

Explanation: Left to Right

3. Which of the following cannot be a variable?
a) on
b) in
c) __init__
d) it

Explanation: in is a keyword.

4. Which is the correct operator for power(xy)?
a) X^^y
b) X^y
c) X**y
d) None of the above

Explanation: In python, power operator is x**y i.e. 2**3=8

5. What is the order of precedence in python?
i) Parentheses
ii) Exponential
iii) Multiplication
iv) Division
vi) Subtraction
a) i,ii,iii,iv,v,vi
b) ii,i,iv,iii,v,vi
c) ii,i,iii,iv,v,vi
d) i,ii,iii,iv,vi,v

Explanation: For order of precedence, just always remember this PEMDAS (similar to BODMAS).

6. What is the output of this expression, 3*1**3?
a) 27
b) 1
c) 9
d) 3

Explanation: First this expression will solve 1**3 because exponential has higher precedence than multiplication, so 1**3 = 1 and 3*1 = 3. Final answer is 3.

7. What is the maximum possible length of an identifier?
a) 63 characters
b) 79 characters
c) 31 characters
d) none of the above

Explanation: Identifiers can be of any length.

8. The expression Int(x) implies that the variable x is converted to integer.
a) True
b) False

Explanation: The expression Int(x) implies that the variable x is converted to integer.

9. Which one of these is floor division?
a) %
b) //
c) /
d) none of the above