Are you ready?
1 questions to solve.
Instructions
- This quiz goes to full-screen once you press the Start button.
- At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
What does the number
0xff
represent?0xff
is a Python integer represented in hexadecimal format. It denotes the integer 255
.What does the number
0b101
represent?0b101
denotes the integer 5
, in binary format. This goes with choice (D).Are the two numbers
0B111
and 0b111
equivalent?The prefix
b
, used to denote binary numbers in Python, is case-insensitive. That is, it doesn't matter if we use it as b
or as B
. This means that 0B111
and 0b111
are both indeed equivalent.What does
int('0b1111', 2)
return?The
int()
function converts a given numeric string into an integer based on the base denoted by its second parameter. In this case, int('0b1111', 2)
converts the string '0b1111'
into an integer based on the binary expansion, yielding 15
. Hence, the correct choice is (A). For more details, refer to Python Base n Representation — converting from string to decimal.What does
bin(10)
return?The
bin()
function converts a given integer into a binary string. Hence, bin(10)
converts 10
into '0b1010'
.What does
hex(15)
return?The
hex()
function converts a given integer into a hexadecimal string. Hence, hex(15)
converts 15
into '0xf'
.Which of the following number systems does the number
0o17
denote?The
o
prefix in Python integers denotes octal numbers. Hence, the correct choice is (B).