Chapter 2: Number System and Logic Functions

Computer Science – Class 11

This note delves into chapter 2: number system and logic functions, offering clear explanations and practical insights. It is designed to help students grasp core ideas through structured content. Whether preparing for exams or seeking conceptual clarity, this resource provides valuable support. Enhance your understanding with simplified notes and organized materials tailored to learners.

No MCQ questions available for this chapter.

Chapter 2: Number System and Logic Functions

2.1 Number System and Conversion

2.1.1 Decimal, Binary, Octal, Hexadecimal Number System & Conversion

Number Systems:

  1. Decimal (Base 10):

    • Uses digits 0-9.
    • Each position represents a power of 10 (e.g., 345=3×102+4×101+5×100345 = 3 \times 10^2 + 4 \times 10^1 + 5 \times 10^0).
    • Conversion: To convert from decimal to binary, octal, or hexadecimal, divide the number by the base and record the remainders.
  2. Binary (Base 2):

    • Uses digits 0 and 1.
    • Each position represents a power of 2 (e.g., 1011=1×23+0×22+1×21+1×20=11101011 = 1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0 = 11_{10}).
    • Conversion: Decimal to binary involves dividing by 2 and noting remainders.
  3. Octal (Base 8):

    • Uses digits 0-7.
    • Each position represents a power of 8 (e.g., 27=2×81+7×80=231027 = 2 \times 8^1 + 7 \times 8^0 = 23_{10}).
    • Conversion: Decimal to octal is similar to binary but with base 8.
  4. Hexadecimal (Base 16):

    • Uses digits 0-9 and letters A-F (A=10, B=11, C=12, D=13, E=14, F=15).
    • Each position represents a power of 16 (e.g., 1A3=1×162+10×161+3×160=419101A3 = 1 \times 16^2 + 10 \times 16^1 + 3 \times 16^0 = 419_{10}).
    • Conversion: Decimal to hexadecimal involves dividing by 16.

2.1.2 Calculation in Binary: Addition and Subtraction

  • Binary Addition:

    • Rules:

      • 0+0=00 + 0 = 0
      • 0+1=10 + 1 = 1
      • 1+0=11 + 0 = 1
      • 1+1=01 + 1 = 0 (carry 1 to the next higher bit)
      • 1+1+1=11 + 1 + 1 = 1 (carry 1 to the next higher bit)
    • Example: 1011+11011011 + 1101

      sql
      1011 + 1101 ------ 11000 (binary) = 24 (decimal)
  • Binary Subtraction:

    • Rules:
      • 00=00 - 0 = 0
      • 10=11 - 0 = 1
      • 11=01 - 1 = 0
      • 010 - 1: requires borrowing.
    • Example: 110010101100 - 1010
      sql
      1100 - 1010 ------- 0100 (binary) = 4 (decimal)

2.1.3 One’s and Two’s Complement Methods of Binary Subtraction

  • One’s Complement:

    • Involves flipping all bits (0s become 1s and vice versa).
    • Example: One’s complement of 10101010 is 01010101.
  • Two’s Complement:

    • One’s complement plus one.
    • Used for binary subtraction.
    • Example: Two’s complement of 10101010:
      • One’s complement: 01010101
      • Adding one: 0101+0001=01100101 + 0001 = 0110 (Two’s complement = 01100110).
  • Subtraction Example:

    • To subtract ABA - B, convert BB to its two’s complement and add it to AA.
    • If there's a carry, discard it.

2.2 Logic Function and Boolean Algebra

2.2.1 Introduction to Boolean Algebra

  • Boolean Algebra:
    • A branch of algebra that involves binary variables and logical operations.
    • Fundamental to digital circuits and computer logic.
    • Uses two values: True (1) and False (0).

2.2.2 Introduction to Boolean Values, Truth Table, Boolean Expression, and Boolean Function

  • Boolean Values: Represent logical statements as either true (1) or false (0).

  • Truth Table: A table that lists all possible values of variables and the corresponding output of a Boolean expression.

    • Example: Truth table for AA AND BB:
      ABA AND B
      000
      010
      100
      111
  • Boolean Expression: Represents a logical relationship using variables and operators (AND, OR, NOT).

    • Example: A+BA + B represents AA OR BB.
  • Boolean Function: A function that takes Boolean inputs and produces a Boolean output.

2.2.3 Logic Gates

  • AND Gate:

    • Definition: Outputs true only if all inputs are true.
    • Truth Table:
      ABA AND B
      000
      010
      100
      111
    • Logic Symbol:
  • OR Gate:

    • Definition: Outputs true if at least one input is true.
    • Truth Table:
      ABA OR B
      000
      011
      101
      111
    • Logic Symbol:
  • NOT Gate:

    • Definition: Outputs the opposite of the input.
    • Truth Table:
      ANOT A
      01
      10
    • Logic Symbol:
  • NAND Gate:

    • Definition: Outputs false only if all inputs are true.
    • Truth Table:
      ABA NAND B
      001
      011
      101
      110
    • Logic Symbol:
  • NOR Gate:

    • Definition: Outputs true only if all inputs are false.
    • Truth Table:
      ABA NOR B
      001
      010
      100
      110
    • Logic Symbol:
  • XOR Gate:

    • Definition: Outputs true if the inputs are different.
    • Truth Table:
      ABA XOR B
      000
      011
      101
      110
    • Logic Symbol:
  • XNOR Gate:

    • Definition: Outputs true if the inputs are the same.
    • Truth Table:
      ABA XNOR B
      001
      010
      100
      111
    • Logic Symbol:

2.2.4 Laws of Boolean Algebra

  • Boolean Identities:
    • Complement Laws:
      • A+A=1A + \overline{A} = 1
      • AA=0A \cdot \overline{A} = 0
    • Identity Laws:
      • A+0=AA + 0 = A
      • A1=AA \cdot 1 = A
    • Commutative Laws:
      • A+B=B+AA + B = B + A
      • AB=BAA \cdot B = B \cdot A
    • Associative Laws:
      • A+(B+C)=(A+B)+CA + (B + C) = (A + B) + C
      • A(BC)=(AB)CA \cdot (B \cdot C) = (A \cdot B) \cdot C
    • Distributive Law:
      • A(B+C)=AB+ACA \cdot (B + C) = A \cdot B + A \cdot C

2.2.5 Statement and Verification of Laws of Boolean Algebra Using Truth Table

  • Verification:

    • Truth tables can be constructed for both sides of the equation for each law to confirm their validity.

    Example: Verification of the Commutative Law:

    • For A+BA + B and B+AB + A:

      ABA + BB + A
      0000
      0111
      1011
      1111
  • Both outputs match, proving A+B=B+AA + B = B + A.