IB Computer Science: How Binary is Used to Store Data
Physical Foundations of Binary Data Storage
Physical Transistors and Logic Gates:
Microscopic silicon gates inside computer chips function as physical on/off switches.
High Voltage State is represented as .
Low Voltage State is represented as .
This fundamental physical reality dictates the architectural requirement and mandatory use of the base-2 binary system.
Fundamental Storage Units:
Bit: A single bit represents a single binary digit ( or ).
Byte: By universal computer science convention, individual bits are grouped into sequences known as Bytes.
Capacity of a Byte: A single Byte can represent () unique discrete values, ranging sequentially from to .
Scale of Data Storage:
Secondary Storage Media: Data is read from and written to storage media in massive, sequential blocks of Bytes.
Persistence: Secondary storage devices—including Solid-State Drives (SSDs), flash drives, and Hard Disk Drives (HDDs)—persistently preserve millions of electrical or magnetic states even when powered down.
Character Encoding Standards
ASCII Standard (American Standard Code for Information Interchange):
Historical Context: Developed during the 1960s to establish a unified standard for digital text transmission.
Encoding Architecture: ASCII maps exactly unique characters, corresponding to decimal values through .
Character Set Range: Encompasses uppercase English letters, lowercase English letters, numeric digits, and non-printable control characters.
Extended ASCII Variant: Utilizes an () architecture to expand total character capacity to distinct characters, incorporating accent marks and extra characters.
Major Structural Limitation: Extended ASCII remains fundamentally incapable of encoding non-English foreign languages, specialized mathematical symbols, or modern emojis.
Unicode Standard:
Global Integration Goal: Engineered to represent every written character, symbol, and writing script across all human languages within a single, unified character set.
Variable-Width Encoding: Utilizes bit allocations of , , or . UTF-8 represents the most widely implemented encoding variant, assigning byte lengths dynamically based on character requirements.
Backward Compatibility: The initial code points of Unicode are mapped identically to standard ASCII, ensuring that legacy text files open accurately without character corruption.
Enormous System Scale: Accommodates over distinct code points, easily supporting complex character sets like Chinese scripts as well as modern emojis.
Bitmap Graphics and Pixel Encoding
Mechanics of Bitmap Graphic Encoding:
Grid Abstraction: Visual images are divided into a dense grid of microscopic, discrete elements termed pixels (short for picture elements).
Pixel Coordinates and Binary Representation: In a basic monochrome (black-and-white) image grid, a single bit encodes each individual pixel:
Color Bit Depth: To encode color graphics, multiple bits are assigned to every single pixel:
: Provides colors (Monochrome).
: Provides distinct colors.
(True Color): Provides distinct colors, utilizing dedicated to Red, dedicated to Green, and dedicated to Blue.
Exemplar 8x8 Pixel Grid Data (Smiley Face Binary Matrix):
Row 1:
0 0 1 1 1 1 0 0Row 2:
0 1 0 0 0 0 1 0Row 3:
1 0 1 0 0 1 0 1Row 4:
1 0 0 0 0 0 0 1Row 5:
1 0 1 0 0 1 0 1Row 6:
1 0 0 1 1 0 0 1Row 7:
0 1 0 0 0 0 1 0Row 8:
0 0 1 1 1 1 0 0
Analog Sound Digitization Process
Capture and Convert (Analog-to-Digital Converter - ADC):
Physical sound waves exist in nature as continuous, smooth analog signals.
An audio input hardware device, such as a microphone, captures physical audio vibrations.
An Analog-to-Digital Converter (ADC) converts this continuous analog signal into discrete numeric values suitable for processing by a Central Processing Unit (CPU).
Sample and Quantize (Sampling Rate and Bit Resolution):
The ADC takes periodic amplitude snapshots at a specified Sampling Rate, measured in Hertz ().
Compact Disc (CD) Quality Standard: Uses a sampling rate of ( samples per second).
Bit Depth (Resolution): Refers to the binary bits allocated per sample measurement. Higher bit depth allows for a significantly more accurate measurement of amplitude.
Decode and Output (Digital-to-Analog Converter - DAC):
To play sound back, the computer reads stored binary numbers sequentially from secondary storage.
A Digital-to-Analog Converter (DAC) translates each sequential binary number into an electrical voltage state.
This process reconstructs a smooth waveform sent to speakers to generate physical sound.
File Size Formulas and Exemplar Calculations
Standard Formulas for Data File Calculations:
Text Document File Size Formula:
Bitmap Image File Size Formula:
Digital Audio File Size Formula:
Text Document Calculation Example:
Scenario: A text document contains characters stored using standard ASCII ( per character).
Calculation in Bits:
Calculation in Bytes:
Total Estimated File Size: Approximately .
Bitmap Image Calculation Example:
Scenario: A digital uncompressed photo has spatial dimensions of pixels with True Color.
Calculation in Bits:
Calculation in Bytes:
Total Estimated File Size: Approximately .
Digital Audio Calculation Example:
Scenario: A CD-quality audio file with a sampling rate of , depth, and Stereo audio (, ).
Calculation in Bits:
Calculation in Bytes:
Total Estimated File Size: Approximately .
Questions & Discussion
Question 1: Distinguishing Stored Data Types (2 Marks):
Prompt: Describe how a computer distinguishes between an integer and a character when both are stored as the exact same binary sequence (e.g.,
01000001) in memory.Explanation: Memory cells are context-blind. The CPU depends entirely on the current execution context and the instructions of the running compiler or interpreter program to decide how to parse and interpret the data.
Question 2: ASCII vs. Unicode Comparison (4 Marks):
Prompt: Compare ASCII and Unicode character sets, stating one advantage and one disadvantage of transitioning a global application to Unicode.
Advantage: Unicode maps characters from all world languages into a single set, avoiding translation and rendering errors across international boundaries.
Disadvantage: Unicode uses more storage space per character (variable length up to per character compared to ASCII's fixed or bits), which increases memory footprint and bandwidth requirements.
Question 3: Audio Digitization Steps (3 Marks):
Prompt: Explain how a continuous analog sound wave is converted into a binary format suitable for storage on secondary devices.
Explanation: The process requires three consecutive steps:
Sound wave capture: A microphone captures continuous physical sound waves.
Rapid sampling: An Analog-to-Digital Converter (ADC) takes rapid measurements at regular timed intervals ( sampling rate measured in Hz).
Quantization mapping: Measured amplitude levels are mapped (quantized) into discrete numeric values and assigned corresponding binary code sequences based on the set bit depth resolution.