Python Programming MCQ - Variables And Operators
9. Arrange this in order of Precedence.
3. Multiplication and Division
4. Addition and Subtraction
Explanation: Parentheses have the highest precedence then exponentiation and then Division and Multiplication and then Addition and Subtraction.
10. Which of this statment will give an error?
Explanation: a++ is invalid syntex in python.
11. Which operator is used to calculate power of x raise to y.
12. Operators with the same precedence are evaluated from?
Explanation: Operators with the same precedence are evaluated from left to right.
13. "in" is a operator in python?
Explanation: "in" is a python membership operator which evaluates to true if it finds a variable in the specified sequence and false otherwise. For eg a in b if a is member of sequence b then it will return 1.
14. What will be the output of statment 2**2**2**2
Explanation: The statment is equivalent to 2^16.
15. What will be the output of the following code
a = 1
b = ++a
print(b is a)
Explanation: The output of the above statment will be True. Since the id of both a and b will be same.
Also check :