Computer Fundamental & Operating System

Chapter 2
Data Representation and Digital Logic

Bachelor of Business Administration
Computer Fundamental & Operating System   •   Under Graduate

Data Representation and Digital Logic

Introduction

Computers process information electronically, but electronic circuits fundamentally distinguish between two states: a low or high electrical signal. These states are represented digitally as 0 and 1. All computer data—including numbers, text, photographs, sound, video, and instructions—is therefore encoded as patterns of bits.

Understanding data representation is essential for business students because it explains how files are stored, why digital quality depends on resolution and sampling, how storage capacity is measured, and how processors make decisions. Digital logic provides the connection between data representation and computer processing: Boolean rules and logic gates transform input bits into useful outputs.

Learning Objectives

After studying this chapter, you should be able to:

  1. Explain binary, decimal, and hexadecimal number systems.
  2. Convert numbers among decimal, binary, and hexadecimal forms.
  3. Explain how characters, images, audio, and video are digitally encoded.
  4. Describe Boolean logic and the operation of common logic gates.
  5. Relate logic gates to arithmetic, decision-making, and computer processing.

1. Number Systems and Positional Notation

A number system uses symbols and rules to represent quantities. The base or radix of a system is the number of distinct symbols it uses.

In a positional number system, the value of a digit depends on both the digit and its position. For a base-b number with digits dₙdₙ₋₁...d₀, its value is:

(dₙdₙ₋₁...d₀)ᵦ = dₙ × bⁿ + dₙ₋₁ × bⁿ⁻¹ + ... + d₀ × b⁰

Here, b is the base, each d is a permitted digit, and the rightmost position has exponent 0. This formula applies to whole numbers; fractional positions use negative powers of the base.

Decimal system

The decimal system has base 10 and uses the digits 0 through 9. For example:

572₁₀ = 5 × 10² + 7 × 10¹ + 2 × 10⁰ = 500 + 70 + 2

Decimal notation is familiar to people, but electronic circuits do not naturally operate with ten stable states.

Binary system

The binary system has base 2 and uses only 0 and 1. Each binary digit is called a bit. Four bits form a nibble, and eight bits form a byte.

For example:

1101₂ = 1 × 2³ + 1 × 2² + 0 × 2¹ + 1 × 2⁰ = 8 + 4 + 0 + 1 = 13₁₀

A binary position represents a power of two. In an 8-bit unsigned number, the place values are 128, 64, 32, 16, 8, 4, 2, and 1. An unsigned 8-bit value can represent 0 through 255, because:

2⁸ − 1 = 255

More generally, n bits represent 2ⁿ distinct patterns. For unsigned integers, the range is 0 through 2ⁿ − 1.

Hexadecimal system

Hexadecimal, or hex, has base 16. It uses 0–9 and the letters A–F, where A=10, B=11, C=12, D=13, E=14, and F=15. Hexadecimal is compact and particularly useful because one hex digit represents exactly four binary bits.

For example:

2F₁₆ = 2 × 16¹ + 15 × 16⁰ = 32 + 15 = 47₁₀

The binary pattern 1010 1100 can be written AC₁₆. Hexadecimal is commonly used for memory addresses, machine instructions, colour codes, and debugging output.

2. Converting Between Number Systems

Binary to decimal

Multiply each bit by its positional power of two and add the results.

Example: Convert 101101₂ to decimal.

101101₂ = 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰
= 32 + 0 + 8 + 4 + 0 + 1
= 45₁₀

Decimal to binary

Repeatedly divide the decimal number by 2 and record the remainders. Reading the remainders from bottom to top gives the binary result.

Example: Convert 45₁₀ to binary.

DivisionQuotientRemainder
45 ÷ 2221
22 ÷ 2110
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

Reading upward gives 101101₂.

Binary and hexadecimal conversion

Because 16 = 2⁴, group binary digits in sets of four, beginning at the binary point and adding leading zeros if necessary.

1011 0110₂ = B6₁₆

Conversely, replace each hex digit with its four-bit equivalent:

3A₁₆ = 0011 1010₂

Fractions

For a binary fraction, positions to the right of the binary point represent 2⁻¹, 2⁻², and so on.

0.101₂ = 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 0.5 + 0.125 = 0.625₁₀

Not every decimal fraction has a finite binary representation. For example, 0.1₁₀ repeats in binary. This is one reason that some software calculations produce tiny rounding differences.

Signed integers and two’s complement

A computer must represent negative as well as positive numbers. A widely used method is two’s complement. For an n-bit pattern, the signed range is:

−2ⁿ⁻¹ through 2ⁿ⁻¹ − 1

Thus, an 8-bit two’s-complement number ranges from −128 to +127. To obtain the negative representation of a positive value, invert every bit and add 1. For example, +5 is 00000101; its negative is:

00000101 → 11111010 (invert) → 11111011 (add 1)

Two’s complement permits ordinary binary addition to handle positive and negative integers, although overflow must be detected when a result falls outside the permitted range.

3. Units of Digital Information

A bit is the smallest information unit. Common units are shown below. In storage specifications, manufacturers often use decimal prefixes, while operating systems may use binary multiples.

UnitMeaning
bitOne binary digit, 0 or 1
byte8 bits
kilobyte (kB)1,000 bytes in decimal usage
megabyte (MB)1,000,000 bytes in decimal usage
gibibyte (GiB)2³⁰ bytes
gigabyte (GB)1,000,000,000 bytes in decimal usage

A clear technical report should state which convention it uses. Confusing GB with GiB can make storage capacity appear inconsistent even when the hardware is functioning correctly.

4. Encoding Text and Characters

A character set defines the symbols available, while an encoding specifies how those symbols are represented as bits. These concepts should not be treated as identical.

ASCII originally used 7 bits and provided 128 codes, including English letters, digits, punctuation, and control characters. Extended 8-bit character schemes added symbols but were not universally consistent.

Unicode was developed to represent writing systems worldwide. UTF-8 is a variable-length Unicode encoding: common ASCII characters occupy one byte, while other characters require two to four bytes. UTF-8 is dominant on the web because it preserves ASCII compatibility and supports international languages.

For example, the capital letter A has Unicode code point U+0041 and is represented in UTF-8 by the byte 41₁₆. The code point is the assigned identity of the character; the encoded bytes are the storage or transmission representation.

Encoding is not encryption. Encoding allows systems to interpret data consistently; encryption intentionally transforms data to restrict access.

5. Image Representation

A digital raster image is a grid of pixels. Each pixel stores a colour value. Resolution describes the number of pixels, such as 1,920 × 1,080. Greater resolution can show finer detail, but it also requires more storage and processing.

Colour depth or bit depth is the number of bits used per pixel. With b bits, the number of possible codes is 2ᵇ. An 8-bit grayscale image can represent 256 intensity levels, from black to white. In a 24-bit RGB image, 8 bits are allocated to red, 8 to green, and 8 to blue, giving:

2²⁴ = 16,777,216

possible colour combinations, assuming all combinations are used.

Uncompressed image storage can be estimated by:

Storage bits = width × height × bits per pixel

The result assumes a raster image with no compression, metadata, or padding. For a 1,000 × 1,000 image at 24 bits per pixel:

1,000 × 1,000 × 24 = 24,000,000 bits = 3,000,000 bytes

Compression reduces storage. Lossless compression reconstructs the exact original, which is appropriate for business documents, diagrams, and technical images. Lossy compression discards information judged less noticeable; it can produce much smaller files but cannot restore the discarded detail. JPEG is commonly lossy, whereas PNG is commonly lossless.

Vector graphics represent shapes through mathematical descriptions rather than individual pixels. They scale effectively for logos and diagrams, while raster images are generally better for photographs.

6. Audio Representation

Sound is a continuous wave. To store it digitally, an analogue-to-digital converter samples the wave at regular time intervals and quantizes each sample to a numerical level.

Sampling rate is the number of samples per second, measured in hertz. Bit depth is the number of bits per sample and determines the number of amplitude levels. According to the Nyquist sampling principle, a sampling rate must be greater than twice the highest frequency to represent that frequency without aliasing:

fₛ > 2fₘₐₓ

Here, fₛ is the sampling rate and fₘₐₓ is the highest frequency of interest. An anti-aliasing filter is normally used before sampling to remove frequencies that would be misrepresented.

For uncompressed audio:

Data rate = sampling rate × bit depth × number of channels

For stereo audio sampled at 44,100 samples per second and 16 bits per sample:

44,100 × 16 × 2 = 1,411,200 bits/s

This is 1,411.2 kbit/s using decimal units. Audio codecs such as FLAC use lossless compression; MP3 and AAC generally use lossy compression. Higher sampling rate and bit depth may improve fidelity, but they also increase file size and do not automatically improve a recording made with poor microphones or noisy equipment.

7. Video Representation

Digital video is a sequence of images, or frames, displayed rapidly enough to create the perception of motion. Important properties include resolution, colour depth, frame rate, and compression.

Uncompressed video data rate can be estimated as:

Data rate = width × height × bits per pixel × frames per second

For 1,920 × 1,080 video, 24 bits per pixel, and 30 frames per second:

1,920 × 1,080 × 24 × 30 = 1,492,992,000 bits/s

This is approximately 1.493 Gbit/s before audio, headers, and compression. Such a rate explains why practical video systems use compression. Video codecs exploit spatial redundancy within a frame and temporal redundancy between frames. A key frame may be stored substantially, while other frames store changes relative to nearby frames.

Resolution and frame rate are not the same. Resolution affects spatial detail; frame rate affects temporal smoothness. Compression involves trade-offs among quality, file size, processing demand, and transmission bandwidth.

8. Boolean Logic

Boolean algebra is a mathematical system in which variables have two values: true or false, commonly represented as 1 and 0. It models conditions such as “customer authenticated” or “payment approved.”

The principal operations are:

  • NOT: reverses a value. If A=1, NOT A=0.
  • AND: produces 1 only when every input is 1.
  • OR: produces 1 when at least one input is 1.

A truth table lists every possible input combination and its output.

ABA AND BA OR B
0000
0101
1001
1111

Boolean expressions often use · for AND, + for OR, and an overbar or apostrophe for NOT. Thus, Q = A·B means Q is true only when both A and B are true.

Important identities include the complement laws A + A′ = 1 and A·A′ = 0, the identity laws A + 0 = A and A·1 = A, and De Morgan’s laws:

(A·B)′ = A′ + B′
(A+B)′ = A′·B′

These laws allow designers to simplify circuits while preserving their behaviour.

9. Logic Gates and Computer Processing

A logic gate is an electronic circuit that implements a Boolean operation. The AND, OR, and NOT gates are fundamental. NAND is NOT-AND, NOR is NOT-OR, XOR is exclusive OR, and XNOR is exclusive NOR.

GateOutput condition
NOT1 when input is 0
AND1 when all inputs are 1
OR1 when at least one input is 1
NAND0 only when all inputs are 1
NOR1 only when all inputs are 0
XOR1 when inputs are different
XNOR1 when inputs are the same

NAND and NOR are called universal gates because any Boolean function can be constructed using only NAND gates or only NOR gates.

Logic gates are combined into circuits. A half-adder adds two one-bit inputs. It produces a sum and a carry:

Sum = A XOR B
Carry = A AND B

For A=1 and B=1, the sum is 0 and the carry is 1, representing binary 10. Full adders include a carry input and can be linked to add multi-bit numbers. Similar circuits implement comparison, selection, memory control, and arithmetic in the central processing unit.

In a business information system, a rule such as “approve access if the employee is active AND the password is valid” can be represented as Access = Active AND Valid. A more complex rule—“allow a manager OR an authorised administrator, but NOT a suspended account”—can be expressed by combining OR, AND, and NOT operations. Software evaluates such conditions symbolically, while hardware implements equivalent operations through circuits.

Applied Case: Digital Media for an Online Training Service

Background. An illustrative online training company plans to deliver product demonstrations to employees using web browsers and mobile devices.

Problem. The initial videos are recorded at high resolution with uncompressed audio and video. Files are too large for reliable delivery, and some captions display incorrectly for non-English users.

Analysis. The team calculates that raw video data rates are extremely high because resolution, colour depth, and frame rate multiply together. It also discovers that the caption system uses an inconsistent character encoding, causing corrupted characters.

Approach. The company encodes captions in UTF-8, retains lossless originals for archival purposes, and distributes compressed video using a modern codec. It chooses a resolution and frame rate appropriate to employee devices, uses adaptive streaming for different network speeds, and tests colour, sound, and captions on multiple platforms.

Outcome. Distribution bandwidth and storage requirements fall substantially while perceived quality remains acceptable. Unicode consistency improves accessibility for international employees. The company also documents whether each size uses decimal GB or binary GiB.

Learning points. Digital quality is multidimensional: more pixels, samples, bits, or frames can improve fidelity but increase resource requirements. Encoding standards are essential for interoperability. Compression decisions should reflect purpose, accessibility, device capability, and network conditions rather than maximum technical specifications alone.

Limitations, Governance, and Best Practice

Digital representation is always a model of a physical or conceptual reality. Sampling can omit information, quantization introduces approximation, lossy compression removes detail, and finite integer formats can overflow. Systems should therefore specify precision, range, encoding, and compression assumptions.

Organisations should use standard, documented encodings; preserve master files where appropriate; validate files after conversion; record metadata; and test interoperability. They should also respect copyright, licensing, privacy, and accessibility obligations. Image, audio, and video files may contain personal information or hidden metadata. Captions, alternative text, and suitable contrast support inclusive access.

Artificial-intelligence systems intensify these issues because training and generated media depend on large collections of encoded text, images, audio, and video. Organisations should govern data provenance, consent, copyright, authenticity, and potential manipulation. Digital encoding itself does not establish that media is truthful; it only specifies how information is represented.

Chapter Summary

Computers represent information as bits because digital circuits operate with two distinguishable states. Decimal uses base 10, binary uses base 2, and hexadecimal uses base 16; positional notation and repeated division provide reliable conversion methods. Bits, bytes, signed representations, and two’s complement explain how numerical data is stored.

Characters require standard encodings such as Unicode and UTF-8. Images are represented by pixels, resolution, colour depth, and compression. Audio is represented through sampling and quantization, while video combines frames, colour, resolution, frame rate, and compression. These representations involve trade-offs between quality, storage, processing, and bandwidth.

Boolean algebra models true/false conditions, and logic gates implement Boolean operations electronically. Gate combinations perform arithmetic and decision-making inside processors. Sound technical practice requires explicit standards, careful validation, awareness of limitations, and responsible handling of digital media.

Key Terms

Bit: A binary digit with a value of 0 or 1.

Byte: A group of eight bits.

Base: The number of distinct symbols in a positional number system.

Binary: A base-2 number system.

Decimal: A base-10 number system.

Hexadecimal: A base-16 number system.

Two’s complement: A representation commonly used for signed binary integers.

Character encoding: A rule mapping characters to stored byte sequences.

Unicode: A worldwide character repertoire and coding framework.

Pixel: The smallest addressable element of a raster image.

Resolution: The number of pixels or samples describing spatial detail.

Colour depth: The number of bits used to represent a pixel’s colour.

Sampling rate: The number of audio samples taken per second.

Quantization: Mapping measured values to discrete digital levels.

Codec: A method or system for encoding and decoding digital media.

Boolean algebra: Algebra involving true/false or 1/0 values.

Logic gate: An electronic circuit implementing a Boolean operation.

Truth table: A table showing outputs for all input combinations.

XOR: A gate producing 1 when its inputs differ.

Compression: Reduction of digital data size, either losslessly or lossily.

Review Questions

Short Answer Questions

  1. What is the difference between a bit, nibble, and byte?
  2. Why is hexadecimal convenient for representing binary data?
  3. What is the purpose of Unicode and UTF-8?
  4. Distinguish sampling rate from audio bit depth.
  5. What output does an AND gate produce when either input is 0?

Long Answer Questions

  1. Explain positional notation and show how 101101₂ converts to decimal.
  2. Compare raster and vector image representation, including their practical uses.
  3. Explain sampling, quantization, and the Nyquist condition in digital audio.
  4. Discuss how resolution, frame rate, and compression affect digital video.
  5. Explain Boolean algebra and the role of logic gates in computer processors.

Analytical / Application Questions

  1. A company must store a 2,000 × 1,000 RGB image at 24 bits per pixel without compression. Calculate its storage requirement in bytes and explain two factors that could change the actual file size.
  2. Design a Boolean rule for approving a transaction only when the customer is authenticated and either a one-time password or biometric check is valid, while the account is not suspended. Express the rule in words and Boolean notation.
  3. An organisation reports a 500 GB drive as approximately 465 GiB. Explain why the two values differ and identify the unit convention involved.

Multiple Choice Questions with Answers

Question 1

What is the decimal value of 101101₂?

A. 35

B. 45

C. fifty-five

D. 61

Correct Answer: B. 45

Question 2

Which hexadecimal digit represents decimal 14?

A. C

B. D

C. E

D. F

Correct Answer: C. E

Question 3

How many distinct patterns can be represented by 8 bits?

A. 8

B. 16

C. 128

D. 256

Correct Answer: D. 256

Question 4

Which encoding is designed to represent characters from writing systems worldwide?

A. ASCII only

B. Unicode

C. RGB

D. JPEG

Correct Answer: B. Unicode

Question 5

A 24-bit RGB pixel can represent how many colour combinations, assuming all codes are used?

A. 256

B. 65,536

C. 16,777,216

D. 24,000,000

Correct Answer: C. 16,777,216

Question 6

According to the Nyquist condition, the sampling rate should be greater than:

A. the highest frequency of interest

B. twice the highest frequency of interest

C. half the highest frequency of interest

D. the bit depth

Correct Answer: B. twice the highest frequency of interest

Question 7

For two inputs, an XOR gate produces 1 when:

A. both inputs are 0

B. both inputs are 1

C. the inputs are different

D. at least one input is 0

Correct Answer: C. the inputs are different

Question 8

What is the output of an AND gate for inputs 1 and 0?

A. 0

B. 1

C. 10

D. Undefined

Correct Answer: A. 0

Question 9

Which compression type reconstructs the exact original data?

A. Lossy

B. Lossless

C. Temporal only

D. Analogue

Correct Answer: B. Lossless

Question 10

In a half-adder, the carry output is produced by which gate?

A. OR

B. XOR

C. NOT

D. AND

Correct Answer: D. AND

Computer Fundamental & Operating System
Chapter 2 of 15