HomeComputer ScienceClass 11Data Representation and Boolean Logic

Chapter 2: Data Representation and Boolean Logic

Introduction to Data Representation

Data representation is the method used to encode information in a form that computers can understand and process. Computers work with binary data (0s and 1s), but we need different number systems to represent various types of data efficiently.

Why Data Representation Matters:

  • Allows computers to store and process numerical data
  • Enables efficient communication between systems
  • Facilitates memory management and optimization
  • Supports character and text encoding

Number Systems

1. Decimal Number System (Base 10)

The most common number system used in daily life. Uses digits 0-9. Each position represents a power of 10.

  • Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • Base: 10
  • Position weights: 10⁰, 10¹, 10², 10³...

Example: 5432 (Decimal)

5432 = 5×10³ + 4×10² + 3×10¹ + 2×10⁰
     = 5×1000 + 4×100 + 3×10 + 2×1
     = 5000 + 400 + 30 + 2

2. Binary Number System (Base 2)

Uses only two digits: 0 and 1. This is the fundamental language of computers as it directly corresponds to on/off states in digital circuits.

  • Digits: 0, 1
  • Base: 2
  • Position weights: 2⁰, 2¹, 2², 2³...

Example: 1011 (Binary) to Decimal

1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰
      = 1×8 + 0×4 + 1×2 + 1×1
      = 8 + 0 + 2 + 1
      = 11₁₀

3. Octal Number System (Base 8)

Uses digits 0-7. Often used as shorthand for binary as each octal digit represents 3 binary digits.

  • Digits: 0, 1, 2, 3, 4, 5, 6, 7
  • Base: 8
  • 1 octal digit = 3 binary digits

Example: 567 (Octal) to Decimal

567₈ = 5×8² + 6×8¹ + 7×8⁰
     = 5×64 + 6×8 + 7×1
     = 320 + 48 + 7
     = 375₁₀

4. Hexadecimal Number System (Base 16)

Uses digits 0-9 and letters A-F (where A=10, B=11, C=12, D=13, E=14, F=15). Widely used in programming and memory addressing.

  • Digits: 0-9, A, B, C, D, E, F
  • Base: 16
  • 1 hex digit = 4 binary digits

Example: 2AF (Hexadecimal) to Decimal

2AF₁₆ = 2×16² + 10×16¹ + 15×16⁰
      = 2×256 + 10×16 + 15×1
      = 512 + 160 + 15
      = 687₁₀

Comparison of Number Systems

DecimalBinaryOctalHexadecimal
0000
5010155
10101012A
15111117F
321000004020
25511111111377FF

Number System Conversions

1. Decimal to Other Bases (Division Method)

Process:

  1. Divide the number by the target base
  2. Record the remainder
  3. Divide the quotient by the base again
  4. Repeat until quotient becomes 0
  5. Read remainders from bottom to top

Example: Convert 25 to Binary

25 ÷ 2 = 12 remainder 1
12 ÷ 2 = 6 remainder 0
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1

Reading from bottom: 11001₂
Verification: 1×16 + 1×8 + 0×4 + 0×2 + 1×1 = 25 ✓

2. Other Bases to Decimal (Expansion Method)

Process:

  1. Multiply each digit by its base raised to its position
  2. Sum all the products

Example: Binary 1101 to Decimal

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

3. Binary to Octal and Hexadecimal

Binary to Octal:

Group binary digits in sets of 3 from right to left
Then convert each group to its octal equivalent

Example: 11010101₂
Group: 011 010 101
Octal:  3   2   5
Result: 325₈

Binary to Hexadecimal:

Group binary digits in sets of 4 from right to left
Then convert each group to its hex equivalent

Example: 11010101₂
Group: 1101 0101
Hex:    D    5
Result: D5₁₆

Character Representation

1. ASCII (American Standard Code for Information Interchange)

ASCII is a 7-bit character encoding standard that represents text in computers. It includes letters, digits, punctuation, and control characters.

ASCII Range:

  • 0-31: Control characters
  • 32-47: Special characters
  • 48-57: Digits (0-9)
  • 65-90: Uppercase letters (A-Z)
  • 97-122: Lowercase letters (a-z)

Common ASCII Codes:

  • Space = 32, A = 65, Z = 90
  • a = 97, z = 122
  • 0 = 48, 9 = 57

2. ISCII (Indian Script Code for Information Interchange)

ISCII is an 8-bit encoding standard that supports Indian scripts including Devanagari, Bengali, Gujarati, Punjabi, Tamil, Telugu, Kannada, and Malayalam.

  • Developed in India for Indian languages
  • 8-bit encoding (256 possible values)
  • Compatible with ASCII for English characters
  • Supports diacritical marks and ligatures

3. Unicode

Unicode is a universal character encoding standard that can represent virtually every written language in the world.

  • Supports 143,000+ characters from 154 scripts
  • UTF-8: Variable-width (1-4 bytes per character)
  • UTF-16: 2 or 4 bytes per character
  • UTF-32: Fixed 4 bytes per character

Boolean Logic

Boolean logic is a branch of algebra that deals with true and false values. It forms the foundation of digital circuits and computer programming.

Basic Boolean Operations

1. NOT (Negation/Complement)

Reverses the input value. Symbol: ¬, ~, or '

ANOT A
01
10

2. AND (Conjunction)

Output is 1 only when both inputs are 1. Symbol: ∧, · or &

ABA AND B
000
010
100
111

3. OR (Disjunction)

Output is 1 when at least one input is 1. Symbol: ∨, + or |

ABA OR B
000
011
101
111

4. NAND (NOT AND)

Output is 0 only when both inputs are 1. Opposite of AND.

ABA NAND B
001
011
101
110

5. NOR (NOT OR)

Output is 1 only when both inputs are 0. Opposite of OR.

ABA NOR B
001
010
100
110

6. XOR (Exclusive OR)

Output is 1 when inputs are different. Symbol: ⊕

ABA XOR B
000
011
101
110

Boolean Laws and Theorems

Basic Laws

  • Identity Law: A + 0 = A, A · 1 = A
  • Null Law: A + 1 = 1, A · 0 = 0
  • Complement Law: A + A' = 1, A · A' = 0
  • Idempotent Law: A + A = A, A · A = A
  • Involution Law: (A')' = A

Commutative Laws

  • A + B = B + A
  • A · B = B · A

Associative Laws

  • A + (B + C) = (A + B) + C
  • A · (B · C) = (A · B) · C

Distributive Laws

  • A · (B + C) = A·B + A·C
  • A + (B · C) = (A + B) · (A + C)

De Morgan's Theorems

  • First Theorem: (A + B)' = A' · B'
  • Second Theorem: (A · B)' = A' + B'

Absorption Laws

  • A + A·B = A
  • A · (A + B) = A

Logic Gates

Logic gates are the physical implementation of Boolean operations in electronic circuits. They are the building blocks of digital systems.

  • NOT Gate: Single input inverter, outputs opposite of input
  • AND Gate: Two or more inputs, output 1 only if all inputs are 1
  • OR Gate: Two or more inputs, output 1 if any input is 1
  • NAND Gate: Universal gate, outputs 0 only if all inputs are 1
  • NOR Gate: Universal gate, outputs 1 only if all inputs are 0
  • XOR Gate: Outputs 1 when inputs are different
  • XNOR Gate: Outputs 1 when inputs are same

Universal Gates: NAND and NOR gates are called universal gates because any Boolean function can be implemented using only NAND gates or only NOR gates.

Related Resources

Need Help?

Join our tuition classes for personalized guidance on data representation.

Register for Classes →