← 0xChallenge.com

Coding · Facts & stats

0x facts & stats

7 fact-checked facts about hexadecimal numbers and the 0x prefix, each with the reason behind it. 5 more are in today's round and join this page after it closes.

Play today's round

The basics

In programming, what does the prefix 0x on a number like 0x1F indicate?

AnswerHexadecimal (base 16)

Languages such as C, Java, JavaScript and Python read a leading 0x as the start of a base-16 number.

What decimal value does 0xA represent?

Answer10

In hexadecimal, the first letter digit stands for the value that comes right after 9.

Going deeper

How many bits does one hexadecimal digit represent?

Answer4

Sixteen values need exactly four binary digits, since 2^4 = 16.

Which prefix do Python and JavaScript use for binary number literals?

Answer0b

In both languages 0b starts a binary literal, 0o an octal one and 0x a hexadecimal one.

How many hex digits are needed to write every possible value of one byte (8 bits)?

Answer2

A byte's values run from 0x00 up to 0xFF, so two hex digits always suffice.

Expert level

What is decimal 4096 written in hexadecimal?

Answer0x1000

4096 is 16 to the power 3, which hex writes as a 1 followed by three zeros.

What is 0x2A in decimal?

Answer42

0x2A = 2 × 16 + 10 = 42.

Know these cold?Today's round is five questions like these, 20 seconds each. Your streak and level follow you to every arena.Play today's round