GIAC Python Coder (GPYC) — Question 2

What is the output of the following line of code typed into a Python interactive session?
>>> print (int(`1111`,2))

Answer options

Correct answer: D

Explanation

The code converts the binary string '1111' to its decimal equivalent, which is 15. Option A is incorrect because it does not convert the binary to decimal. Option B is incorrect as it suggests the decimal value of 16, which is not the case. Option C is also incorrect as it shows an incorrect representation of the string.