3.1.2 · D5Boolean Algebra & Logic Gates
Question bank — Hexadecimal and octal representation
Before we start, we need one symbol that every question below leans on.
The picture below shows this counting-from-the-right idea, and how grouping bits into s the correct way (from the right) versus the wrong way (from the left) changes which powers land in each group.

Three anchors every question below leans on:
Recall The three ideas everything here tests
- Place value grows from the right. In base , the rightmost digit is worth , the next , then … So the "-bit" and "-bit" grouping must start at the right edge. See Positional number systems and place value.
- The whole point of hex/octal is and . These are exact powers of two, so bits chop cleanly. is not a power of two, which is why decimal never gets this trick.
- Binary is the universal middle-man. Hex groups bits, octal groups bits; and don't line up with each other, but both line up with binary.
True or false — justify
The base name tells you the value; the digit string alone never does
True.
11 could be three (binary), nine (octal), eleven (decimal), or seventeen (hex). Without the base subscript or prefix, a digit string is ambiguous."" always means ten
False. In base , "" means itself: , , . "Ten" is just what happens to equal in base ten.
Adding a leading zero to a binary number's written form changes the value it represents
False — this item separates value from representation. Padding
110 to 0110 leaves the value unchanged ( either way), because the new digit sits in the place and contributes . Only the written width changes, which is precisely why left-padding is a legal step when filling out a -bit or -bit group.Every 8-bit byte fits in exactly two hex digits
True. bits, and each group of bits is one hex digit, so a byte is always exactly hex digits (from
00 to FF).Every 8-bit byte fits in exactly two octal digits
False. is not a multiple of . Grouping bits into s gives octal digits (e.g.
11111111 = ), with the top group padded.in hex is a variable standing for an unknown
False. In hex, – are fixed digits: .
0xF is simply the number fifteen, never an unknown.You can convert hex to octal by pairing up hex digits directly
False. A hex digit is bits and an octal digit is bits — they never line up. You must expand to binary first, then re-group into s.
Binary → hex and binary → octal group from the same side
True. Both group from the right, because place value () starts on the right. Only the group size differs ( vs ).
and are the same number
True. . They are two spellings of one value; the base changes the notation, not the quantity.
In repeated division, the first remainder becomes the leftmost digit
False. The first remainder is the place — the rightmost digit. That's why you read remainders bottom-to-top.
Octal is more compact than hex
False. Hex packs bits per symbol, octal only , so hex is more compact. That's why modern hardware/code favours hex.
Spot the error
"To convert 11010110 to hex, group from the left: 1101|0110." What's wrong (if anything)?
Nothing is wrong here by luck — this byte has exactly bits, so left-grouping and right-grouping coincide. But the method is wrong: for any bit-count that isn't a multiple of , grouping from the left misaligns the powers (see the figure above). Always group from the right.
"101 in binary is worth one hundred and one."
The digit string looks like decimal but isn't. . Reading a binary string as if it were decimal is a classic slip.
", so is worth and lives in the place — but wait, shouldn't be in the place since it's bigger?"
The place is fixed by position, not by size. is the rightmost digit, so it's in the place regardless of how large its value is. Place value depends only on where a digit sits.
"To pad 11 up to an octal group I write 110."
Padding must go on the left, giving
011, not the right. Right-padding multiplies the value (it appends a low bit); left-padding with zeros preserves the value. 011, but 110." so one hex digit equals four octal digits."
No. means one hex digit equals four binary digits (bits), not octal digits. Hex↔octal must route through binary.
"Since decimal is base 10 and , decimal groups binary into pairs of bits."
False reasoning. Grouping needs the base to be a pure power of two (), not merely even. is not for any , so no clean digit-by-digit binary↔decimal grouping exists.
"0b10 and 0o10 and 0x10 are all sixteen."
Only
0x10 is . The prefixes set the base: 0b10, 0o10, 0x10. In each, "" means the base itself.Why questions
Why do hex and octal exist at all, if decimal already works?
Because and align perfectly with bit boundaries, so binary↔hex/octal is pure regrouping — no arithmetic. Decimal (base , not a power of two) needs full division, and long binary strings are error-prone to read directly.
Why must we group binary from the right, not the left?
Place values start at on the right and grow leftward. A group of bits only equals a clean single hex digit (worth ) when its boundaries sit on multiples of counted from the right. Left-grouping cuts across those power boundaries — the second panel of the figure above shows the powers spilling across a boundary.
Why is padding with leading zeros always safe?
A leading zero sits in a higher place and contributes to the value. So it fills out a group to the required size ( or bits) without changing the number at all.
Why route hex↔octal through binary instead of converting directly? Show it.
Hex groups bits in s, octal in s; and share no common grouping, so there's no digit-to-digit map. Worked example: → expand each hex digit to bits → ; now re-group the same bits into s from the right → … pad to . The bits never changed — only where we drew the group boundaries. That's why binary is the middle-man.
Why does repeated division by the base peel off digits right-to-left?
Dividing by : every term with is divisible by , so the remainder is exactly (the digit). The quotient is "shifted right" one digit; repeating extracts in order — hence read bottom-to-top.
Why do hex digits need letters – but octal digits don't?
Hex needs distinct symbols but we only have numerals (–), so we borrow letters for –. Octal needs only symbols, and – already supply them.
Why is a hex digit "more information" than an octal digit?
A hex digit encodes bits ( possibilities); an octal digit encodes only bits (). More bits per symbol means hex carries more information per character — see Memory addresses and byte addressing, which use hex for exactly this compactness.
Edge cases
What is in hex and octal?
Zero in every base is just
0. There are no bits set, so no matter how you group, every group is 000... = 0.How many hex digits does a single bit 1 need?
One. You pad on the left to
0001, which is the hex digit . A shorter binary string just gets zero-padded up to a full group.What's the largest value in one hex digit, and in one octal digit?
One hex digit maxes at (all four bits set,
1111). One octal digit maxes at (111). Beyond these you need a second digit.If a binary number has a bit-count that's a common multiple of and (like ), do left- and right-grouping ever agree?
When the count is an exact multiple of the group size there's no padding, so the boundaries happen to fall in the same places — but the count must match the group size ( for hex, for octal). Right-grouping is never wrong; left-grouping is only accidentally right, so always group from the right.
Is 0xG a valid hex number?
No. Hex digits are – and – only. would represent , which is not a single digit in base — it needs two digits,
0x10.Does the byte 00000000 need padding to become hex?
No padding of content is needed since is a multiple of ; it splits as
0000 0000 = 00. The leading zeros are already part of the fixed-width byte. It's simply .How is (a negative value) written in hex on real hardware?
Hex itself has no minus sign in fixed-width storage; negatives use two's complement. In an 8-bit register is stored as
11111111 = 0xFF. So 0xFF reads as unsigned but signed — same bits, the interpretation is chosen by context.Is 0x80 positive or negative?
It depends on the interpretation, and that's the trap. The bits
10000000 are unsigned, but as a signed 8-bit two's-complement value they mean . Hex shows you the bit pattern, never the sign convention — you must know the width and signedness. See Two's complement and signed numbers.Why can't you tell a signed value from its hex digits alone?
Hex is a faithful copy of the bits, and the bits don't carry a "signed or unsigned" flag — that decision lives in how the program or CPU treats the register. The same
0xFF is or depending purely on context.Connections
- Positional number systems and place value — the "place value grows from the right" rule every trap here relies on.
- Binary number system — the universal middle-man.
- Two's complement and signed numbers — why the same hex bits can mean a positive or a negative number.
- Bitwise operations — where reading bits in hex groups pays off.
- Memory addresses and byte addressing — why hex compactness matters in practice.
- Boolean Algebra & Logic Gates — parent chapter.