2 Number Systems And Data Representation

Introduction to Information Technology · Unit 2

Number Systems and Data Representation

Exam-focused notes for Number Systems and Data Representation (Introduction to Information Technology, BIT101): what the TU syllabus asks and how it has actually been tested, with 9 solved past questions from this unit.

Number Systems and Data Representation in short

Computers store everything as binary digits. This unit explains how numbers are written in different bases, how to convert between them, and how negative numbers are stored.

Number Systems and Data Representation: notes

Face value and position value concepts

In a number system, every digit has two values.

  • Face value: the digit itself, no matter where it sits. In 3472, the face value of 4 is 4.
  • Position value (place value): the face value multiplied by the weight of its position. In 3472, the 4 is in the hundreds place, so its position value is 400.

The base (radix) of a system is the number of different digits it uses. Decimal has base 10 and uses digits 0 to 9. The weight of each position is a power of the base.

$$3472 = 3\times10^3 + 4\times10^2 + 7\times10^1 + 2\times10^0$$

Binary number system and encoding

The binary system has base 2 and uses only 0 and 1. Each digit is called a bit. Eight bits make one byte. Computers use binary because electronic circuits easily show two states: on and off.

Each position has a weight that is a power of 2.

$$1011_2 = 1\times2^3 + 0\times2^2 + 1\times2^1 + 1\times2^0 = 11_{10}$$

Encoding means giving a binary code to characters. Common codes are:

  • ASCII: 7 bit code for 128 characters. Example: A is 65, which is 1000001.
  • EBCDIC: 8 bit code used on old IBM mainframes.
  • Unicode: a large code that covers the letters of almost every language, including Nepali.

What this unit covers

  • Face value and position value concepts
  • Binary number system and encoding
  • Octal and hexadecimal number systems
  • Base conversion between decimal, binary, octal, hexadecimal
  • Binary arithmetic and operations
  • Two's complement method for signed numbers
  • Reasons for using hexadecimal and octal in computers

Two's complement method for signed numbers

2081 · 5 marks

Add number +7 and -17 using 2's complement method. [5]

  • First number: $+7$ - Second number: $-17$ - Method: 2's complement addition - Using 8-bit representation (needed since $17$ requires 5 bits, plus sign bit). $+7$: $$+7 = 0000\ 0111$$ $+17$ (magnitude of the negative number): $$+17 = 0001\ 0001$$ 1's complement of $0001\ 0001$ (invert all bits):...
Open this answer on its own page →

Reasons for using hexadecimal and octal in computers

2080 · 10 marks

Explain the reason of using hexadecimal and octal number system in computer? Add decimal number 23 and 12 using binary addition and verify the result with the help of decimal system.[10]

  • Task 1: Explain why hexadecimal (base-16) and octal (base-8) number systems are used in computers. - Task 2: Add decimal numbers $23$ and $12$ using binary addition and verify with the decimal system. - Numeric inputs: $23{10}$ and $12{10}$. All required data is present. --- Why not binary alon...
Open this answer on its own page →

Binary number system and encoding

2080 · 5 marks

What is Binary Encoding? Why computers use Binary Encoding? [5]

Show solved answer

Binary Encoding

Definition

Binary Encoding is a method of representing data, numbers, characters, and instructions using only two symbols: 0 and 1 (bits). Every piece of information stored or processed in a computer is ultimately converted into a sequence of these two binary digits.

For example:

  • The decimal number 9 is represented as 1001 in binary
  • The character 'A' is represented as 01000001 in ASCII binary encoding

Why Computers Use Binary Encoding

Computers use binary encoding for the following fundamental reasons:

1. Physical Feasibility (Two Stable States)

Electronic components such as transistors, capacitors, and logic gates naturally operate in two stable states:

  • ON (High Voltage) → represented as 1
  • OFF (Low Voltage) → represented as 0

It is much easier and more reliable to build circuits that distinguish between two states than ten (as in decimal).

2. Reliability and Noise Immunity

Binary signals are highly resistant to electrical noise. Even if a signal degrades slightly, it is easy to determine whether it is a 0 or a 1. This makes data transmission and storage more accurate.

3. Boolean Algebra and Logic Operations

Binary encoding directly maps to Boolean algebra (AND, OR, NOT operations), which forms the mathematical foundation of digital circuit design. All computations can be reduced to simple logical operations on 0s and 1s.

4. Simplicity of Arithmetic

Binary arithmetic (addition, subtraction, multiplication, division) is extremely simple with only two digits. This simplifies the design of the Arithmetic Logic Unit (ALU) inside the CPU.

5. Data Storage

Storage devices such as hard disks, SSDs, RAM, and CDs store data as binary:

  • Magnetic domains (North/South)
  • Electrical charges (charged/uncharged)
  • Optical pits and lands (reflective/non-reflective)

All of these naturally represent two states, making binary encoding ideal.

6. Universality

Binary encoding can represent any type of data -- numbers, text, images, audio, video, and program instructions -- by using appropriate encoding schemes (ASCII, Unicode, IEEE 754, etc.).


Summary Table

ReasonExplanation
Physical feasibilityTransistors have two stable states (ON/OFF)
ReliabilityEasy to distinguish 0 from 1 despite noise
Boolean logicDirectly supports AND, OR, NOT operations
Simple arithmeticOnly 4 basic addition rules needed
Storage compatibilityAll storage media naturally support two states
UniversalityCan encode any type of data

Conclusion: Binary encoding is the foundation of all modern computing because it perfectly matches the physical nature of electronic components, ensures reliability, and simplifies both circuit design and mathematical operations.

Open this answer on its own page →

Binary arithmetic and operations

2079 · 5 marks

Subtract 10010 from 10101. Verify answer with the help of decimal substraction. [5]

Binary Decimal Equivalent ---------------------------- $10101$ $16+0+4+0+1 = 21$ $10010$ $16+0+0+2+0 = 18$ We must compute $10101 - 10010$. --- Working right to left (bit 0 = LSB): Bit Minuend Subtrahend Operation Result -------------------------------------------- 0 1 0 $1 - 0$ 1 1 0 1 need borr...

Open this answer on its own page →

Base conversion between decimal, binary, octal, hexadecimal

2078 · 5 marks

Convert 3748.658 decimal to Binay, Octal and Hexadecimal. [5]

  • Decimal number: $3748.658$ - Integer part: $3748$ - Fractional part: $0.658$ - Convert to: Binary (base 2), Octal (base 8), Hexadecimal (base 16) --- Division Quotient Remainder ------------------------------- 3748 ÷ 2 1874 0 1874 ÷ 2 937 0 937 ÷ 2 468 1 468 ÷ 2 234 0 234 ÷ 2 117 0 117 ÷ 2 58 1...
Open this answer on its own page →

2077 · 5 marks

Convert 44.467 from Base 10 to Base 16. [5]

  • Number to convert: $44.467{10}$ - Target base: 16 Division Quotient Remainder Hex ------------------------------------ $44 \div 16$ 2 12 C $2 \div 16$ 0 2 2 Reading remainders bottom to top: $$44{10} = 2C{16}$$ Multiplication Product Integer part Hex --------------------------------------------...
Open this answer on its own page →

2081.2 · 5 marks

Convert $(366)_8$ to hexadecimal. Subtract $(1001111)_2$ from $(1110111)_2$. [2+3]

Show solved answer

Answer

Given Data

  • Octal number to convert: $(366)_8$
  • Binary subtraction: $(1110111)_2 - (1001111)_2$

(a) Convert $(366)_8$ to Hexadecimal

Method: Octal → Binary → Hexadecimal

Step 1: Each octal digit to 3-bit binary

OctalBinary
3011
6110
6110

$$(366)_8 = (011,110,110)_2 = (011110110)_2$$

Step 2: Group into 4 bits from the right

The nine bit string is padded on the left to a whole number of four bit groups before grouping, so the leading group is $0000$ and not $0001$:

$$011110110 \rightarrow 0000\ 1111\ 0110$$

Step 3: Convert each group to hex

BinaryHex
00000
1111F
01106

$$\boxed{(366)8 = (F6){16}}$$

Verify: $(366)8 = 3\cdot64 + 6\cdot8 + 6 = 192 + 48 + 6 = 246$ and $(F6){16} = 15\cdot16 + 6 = 240 + 6 = 246$, so the two agree. ✓


(b) Subtract $(1001111)_2$ from $(1110111)_2$

Compute $(1110111)_2 - (1001111)_2$.

Method: 2's Complement Subtraction

Step 1: 2's complement of $(1001111)_2$

  • 1's complement: $0110000$
  • Add 1: $0110000 + 1 = 0110001$

Step 2: Add minuend and 2's complement

$$ \begin{array}{r} 1110111 \ +\ 0110001 \ \hline 10101000 \end{array} $$

Step 3: Discard the carry (leftmost 1)

$$\text{Result} = (0101000)_2$$

Verification (decimal):

  • $(1110111)_2 = 64+32+16+4+2+1 = 119$
  • $(1001111)_2 = 64+8+4+2+1 = 79$
  • $119 - 79 = 40$
  • $(0101000)_2 = 32 + 8 = 40$ ✓

$$\boxed{(1110111)_2 - (1001111)_2 = (0101000)_2 = 40}$$


Summary

  • $(366)8 = (F6){16}$
  • $(1110111)_2 - (1001111)_2 = (0101000)_2$
Open this answer on its own page →

0 · 5 marks

Convert 34.4674 from Base 10 to Base 16 [5]

  • Decimal number: $34.4674$ - Target base: $16$ (hexadecimal) --- Divide repeatedly by 16, record remainders: Division Quotient Remainder ------------------------------- $34 \div 16$ $2$ $2$ $2 \div 16$ $0$ $2$ Reading remainders bottom to top: $$34{10} = 22{16}$$ --- Multiply repeatedly by 16, r...
Open this answer on its own page →

Face value and position value concepts

0 · 5 marks

Explain the significance of the face value and position value of a number with an example. Convert the decimal number 47 into binary, octal and hexadecimal. [5]

  • Number to convert: decimal $47$ - Target bases: binary (2), octal (8), hexadecimal (16) The face value of a digit is the intrinsic value of the digit itself, independent of where it appears in the number. It remains constant. Example: In the number $523$ - Face value of $5$ = $5$ - Face value o...
Open this answer on its own page →