Chapter: Operators
1.

Which is the correct operator for power(xy)?

A. x^y
B. x**y
C. x^^y
D. none of the mentioned
Answer» B. x**y
Explanation: in python, power operator is x**y i.e. 2**3=8.
2.

Which one of these is floor division?

A. /
B. //
C. %
D. none of the mentioned
Answer» B. //
Explanation: when both of the operands are integer then python chops out the fraction part and gives you the round off value, to get the accurate answer use floor division. this is floor division. for ex, 5/2 = 2.5 but both of the operands are integer so answer of this expression in python is 2. to get the 2.5 answer, use floor division.
3.

What is the answer to this expression, 22 % 3 is?

A. 7
B. 1
C. 0
D. 5
Answer» B. 1
Explanation: modulus operator gives the remainder. so, 22%3 gives the remainder, that is, 1.
4.

Mathematical operations can be performed on a string.

A. true
B. false
Answer» B. false
Explanation: you can’t perform mathematical operation on string even if the string is in the form: ‘1234…’.
5.

What is the output of this expression, 3*1**3?

A. 27
B. 9
C. 3
D. 1
Answer» C. 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.
6.

Which one of the following has the same precedence level?

A. addition and subtraction
B. multiplication, division and addition
C. multiplication, division, addition and subtraction
D. addition and multiplication
Answer» A. 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.
7.

Which one of the following has the highest precedence in the expression?

A. exponential
B. addition
C. multiplication
D. parentheses
Answer» D. parentheses
Explanation: just remember: pemdas, that is, parenthesis, exponentiation, division, multiplication, addition, subtraction. note that the precedence order of division and multiplication is the same. likewise, the order of addition and subtraction is also the same.
Tags
Question and answers in Operators, Operators multiple choice questions and answers, Operators Important MCQs, Solved MCQs for Operators, Operators MCQs with answers PDF download