1.

Which of the following expressions results in an error?(a) int(1011)(b) int(‘1011’,23)(c) int(1011,2)(d) int(‘1011’)This question was addressed to me by my school principal while I was bunking the class.This interesting question is from Bitwise topic in division Precedence and Associativity, Bitwise & Boolean of Python

Answer»

Correct option is (c) int(1011,2)

Explanation: The EXPRESSION int(1011,2) results in an error. Had we written this expression as int(‘1011’,2), then there WOULD not be an error.



Discussion

No Comment Found

Related InterviewSolutions