NSSCAS Computer Science (8231) study materials
NSSCAS Computer Science (8231) study resources

NSSCAS Computer Science (8231): Data representation

NSSCAS Computer Science (8231) · Work through your exam, one topic at a time.

All guide sections

Data representation

The Data representation domain tests whether you can convert between binary, denary, hexadecimal and binary-coded decimal, explain how text, images and sound are encoded, and calculate file sizes. Marks hinge on showing working, not on describing what a bit is.

Number systems and negative integers

Hexadecimal is shorthand for binary: each hex digit maps to exactly four bits, so 2F is 0010 1111. BCD stores each denary digit in its own nibble, so 29 is 0010 1001; nibble values 1010–1111 are invalid in BCD. Two's complement represents negatives by inverting all bits of the positive value and adding 1. An n-bit two's complement number ranges from −2^(n−1) to 2^(n−1)−1, so 8 bits give −128 to +127. Sign-and-magnitude uses the leftmost bit as a sign, which creates two representations of zero.

Images, sound and compression

Bitmap size in bytes = width × height × colour depth ÷ 8. Sound size in bytes = sample rate × sample resolution × channels × duration ÷ 8. Lossless compression (for example run-length encoding or PNG) preserves every bit; lossy compression (JPEG, MP3) discards detail the user is unlikely to notice.

Worked example

Represent −45 in 8-bit two's complement. +45 = 0010 1101. Invert: 1101 0010. Add 1: 1101 0011. Check by place values: −128 + 64 + 16 + 2 + 1 = −45. The range is −128 to +127, so −45 fits.

Traps that cost marks

Forgetting to pad each hex digit to four bits; writing 1010 as a valid BCD digit; calculating image size in bits and forgetting to divide by 8; using sampling rate where sampling resolution belongs; claiming Unicode replaces ASCII rather than extending it.