2. Data Representation
Higher Secondary · Computer Applications / Commerce

Data Representation

Computers understand only 0s and 1s. This chapter covers how numbers, negative integers, characters, and multimedia files all get reduced to binary — try the live converter below.

"There are 10 kinds of people in the world: those who understand binary numerals, and those who don't." — Ian Stewart
2.3 · Live Tool

Number System Converter

Type a value in any base and see it instantly converted to decimal, binary, octal and hexadecimal.

Base Converter

● live
Binary · base 2
—
Octal · base 8
—
Decimal · base 10
—
Hexadecimal · base 16
—
Only the digits valid for the chosen base are accepted (binary: 0–1, octal: 0–7, decimal: 0–9, hex: 0–9 & A–F). Negative decimal values are converted using their magnitude.
2.2

Number Systems

A number system expresses values using a fixed set of symbols. The count of symbols used is its base or radix.

Decimal10

Digits 0–9. The system we use daily.

Binary2

Digits 0–1. The native language of computers.

Octal8

Digits 0–7. Used for Unix file permissions.

Hexadecimal16

Digits 0–9, A–F. A compact, human-friendly view of binary.

Positional (place-value) system — example: 534 in decimal
= 5×10² + 3×10¹ + 4×10⁰ = 500 + 30 + 4 = 534

In any number, the rightmost digit is the Least Significant Digit/Bit (LSD/LSB) and the leftmost is the Most Significant Digit/Bit (MSD/MSB).

Conversion Rules

Decimal → Binary/Octal/Hex

Repeatedly divide by the target base, noting each remainder. Read remainders bottom-to-top.

Binary → Decimal

Multiply each bit by its positional power of 2, then sum.

Octal ⇄ Binary

Each octal digit ⇄ a 3-bit binary group (pad with leading zeros as needed).

Hexadecimal ⇄ Binary

Each hex digit ⇄ a 4-bit binary group (pad with leading zeros as needed).

2.4

Binary Addition

Binary addition follows its own rule table, since the base is 2, not 10.

ABSumCarry
0000
0110
1010
1101

Try it — add two binary numbers

Use only 0s and 1s.

+
10000
2.5

Numeric Representation

Numbers without a fractional part are integers; with one, they're floating point. A fixed-size group of bits handled as a unit is a word (word length: 8, 16, 32, 64 bits…).

Sign & Magnitude

MSB = sign (0 positive, 1 negative); remaining bits = magnitude.

10011001

= −25 (8-bit)

1's Complement

Take the true binary form, flip every 0→1 and 1→0.

10101000

= −87 (8-bit)

2's Complement

Find the 1's complement, then add 1. Most commonly used by computers.

11100111

= −25 (8-bit)

Floating Point Numbers

A floating point number has a Mantissa (the significant digits, normalised like 0.134) and an Exponent (how far to shift the point) — just like scientific notation, but computers use powers of 2 instead of 10.

13.4 = 0.134 × 10²   →   mantissa = 134, exponent = 2
2.6

Character Representation

Letters, digits and symbols also need a binary code so computers can store and exchange text.

EncodingBitsCharacter RangeUsed ForLimitation
ASCII72⁷ = 128English text, control codesLimited characters
Extended ASCII82⁸ = 256European charactersNot global
Unicode16–322⁸ – 2³²Global language supportRequires more storage

ASCII (1963) standardised English text but couldn't cover world scripts. Unicode, maintained by the Unicode Consortium, solves this — commonly encoded as UTF-8, UTF-16 or UTF-32, and defines over a million code points.

2.7

Multimedia File Formats

Images, audio and video are also just binary — pixels, sound samples, and frames encoded and compressed.

Images — built from pixels, each stored as 24-bit RGB

FormatCompressionTransparencyAnimationCommon Use
BMPUncompressedNoNoWindows apps, raw storage
JPEGLossyNoNoPhotos, web images
PNGLosslessYesNoLogos, transparent images
GIFLosslessYesYesWeb animations, memes
TIFFLossy/LosslessYesYesProfessional design

Audio — analog sound digitised into samples

FormatCompressionQualityCommon Uses
WAVUncompressedExcellentStudio recording, editing
MP3LossyGoodMusic, streaming
AACLossyBetter than MP3Streaming, Apple devices
FLACLosslessExcellentArchiving, audio editing
OGGLossyGoodGaming, open-source apps
WMALossy/LosslessGood–ExcellentWindows apps

Video — frames (24–60 fps) synced with audio

FormatDeveloperQualityCommon Uses
AVIMicrosoftExcellentEditing, archiving
MP4MPEGHighWeb, mobile, streaming
MKVOpen SourceVery HighMovies, HD videos
MOVAppleExcellentProfessional editing
WebMGoogleHighHTML5 streaming
Try Yourself

Quick Recap

Tap a question to reveal the answer.

What is the base (radix) of the hexadecimal system, and what symbols does it use?

Base 16 — digits 0–9 plus letters A–F, where A=10 through F=15.

How do you convert an octal number to binary?

Convert each octal digit to its 3-bit binary equivalent using the conversion table, then combine the groups.

What are MSB and LSB?

MSB (Most Significant Bit) is the leftmost bit, with the largest place value. LSB (Least Significant Bit) is the rightmost bit, with the smallest place value.

Which method is most commonly used by computers to represent negative integers, and why?

2's Complement — it is simple, efficient, and avoids problems (like two representations of zero) found in sign-magnitude and 1's complement methods.

What's the difference between lossy and lossless compression?

Lossy compression discards some data for a smaller file size (e.g. JPEG, MP3). Lossless compression removes only redundant data, so the original can be perfectly reconstructed (e.g. PNG, FLAC).

Why was Unicode introduced when ASCII already existed?

ASCII (7-bit, 128 characters) and Extended ASCII (8-bit, 256 characters) couldn't represent the characters and symbols of the world's many scripts. Unicode provides a universal, unambiguous encoding covering over a million code points.