1.

The output of the functions len(“abc”) and sys.getsizeof(“abc”) will be the same.(a) True(b) FalseThis question was posed to me in an interview.The origin of the question is Sys Module topic in section Mapping Functions and Modules of Python

Answer» CORRECT choice is (B) False

Best explanation: The function len returns the length of the string passed, and hence it’s output will be 3. The function getsizeof, present under the sys module returns the SIZE of the object passed. It’s output will be a value much LARGER than 3. Hence the above statement is false.


Discussion

No Comment Found

Related InterviewSolutions