Data Representation and Multimedia: Question 1
Syllabus 1.1, 1.2, 1.3
A graphics program stores each colour channel of a pixel as an 8-bit binary value. One channel is stored as the binary value 10110110.
What is this value written in hexadecimal?
Show worked solution Hide worked solution
Worked solution
Grouping into nibbles
Hexadecimal digits map exactly onto 4-bit groups (nibbles), because 2^4 = 16, which is the number of hexadecimal digits (0-9, then A-F for 10-15). To convert a binary value to hexadecimal, split it into groups of 4 bits, starting from the right-hand end, and convert each group separately.
10110110 splits into two nibbles:
1011 0110
Converting each nibble
First nibble 1011: bit values (from left to right) are 8, 4, 2, 1.
1×8 + 0×4 + 1×2 + 1×1 = 8 + 0 + 2 + 1 = 11
In hexadecimal, the denary value 11 is written as the single digit B.
Second nibble 0110: bit values are 8, 4, 2, 1.
0×8 + 1×4 + 1×2 + 0×1 = 0 + 4 + 2 + 0 = 6
In hexadecimal, the denary value 6 is written as the digit 6.
Combining the digits
Writing the two hex digits in the same order as the nibbles gives B6.
Check using denary as an intermediate step: 10110110 = 128 + 32 + 16 + 4 + 2 = 182. Converting B6 back to denary: 11 × 16 + 6 = 176 + 6 = 182. Both routes agree, confirming the conversion is correct.
Final answer
- B6 (option A)