Q. What does ~4 evaluate to?
Explanation: ~x is equivalent to -(x+1).
Dear candidates you will find MCQ questions of Problem Solving and Python Programming here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Explanation: ~x is equivalent to -(x+1).
Explanation: cmp(x, y) returns 1 if x > y, 0 if x == y and -1 if x < y.
Explanation: ‘+’ cannot be converted to a float.
Explanation: the behavior of the round()
Explanation: ^ is the binary xor operator.
Explanation: although the presence of parenthesis does affect the order of precedence, in the case shown above, it is not making a difference. the result of both of these expressions is 1.333333333. hence the statement is true.
Explanation: the order of precedence is: %,+. Hence the expression above, on
simplification results in 4 + 3 = 7.
Hence the result is 7.
Explanation: all of the operators shown above have associativity from left to right, except exponentiation operator (**) which has its associativity from right to left.
Explanation: The expression shown above is
an example of explicit conversion. It is
evaluated as int(43.55+1) = int(44.55) = 44.
Hence the result of this expression is 44.
Explanation: the result of the expression shown above is (6.0, 16.0). this is because the result is automatically rounded off to one decimal place.
Jump to