5 Data Representation

Introduction to Information Technology · Unit 5 · 6 hrs

Data Representation

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

Data Representation in short

Inside a computer, every kind of data, numbers, text, images and instructions alike, is ultimately stored and processed as patterns of binary digits. This chapter builds up that representation: the number systems computing relies on, how to convert between them, how binary arithmetic and signed numbers work, how characters are coded, and the logic gates that carry out these operations in hardware.

Data Representation: notes

Introduction

A computer's circuitry is built from switches that are either on or off, so it naturally works in base 2 rather than the base 10 people use by hand. Every value a computer stores is reduced to a sequence of bits and interpreted according to an agreed scheme, which is what the rest of this chapter sets out.

Number System

A number system represents a quantity using a fixed set of digits and a base (or radix), the count of distinct digits available at each position. Computing relies mainly on four number systems:

SystemBaseDigits used
Decimal100 to 9
Binary20, 1
Octal80 to 7
Hexadecimal160 to 9, then A to F (A = 10 ... F = 15)

In each system, a digit's contribution to the number's value depends on its position: the digit in position $i$, counting from 0 at the rightmost digit, contributes digit $\times \text{base}^i$. A familiar decimal number illustrates the principle: $253_{10} = 2\times10^2 + 5\times10^1 + 3\times10^0$. Binary, octal and hexadecimal numbers are built up the same way, only with base 2, 8 or 16 in place of 10.

Conversion from Decimal to Binary, Octal, Hexadecimal

A decimal number is converted to another base by repeated division: divide the number by the target base, record the remainder, then keep dividing the quotient by the base until it reaches 0. Reading the remainders from bottom to top gives the converted number.

Converting $25_{10}$ to binary:

DivisionQuotientRemainder
25 / 2121
12 / 260
6 / 230
3 / 211
1 / 201

Reading the remainders bottom to top gives $25_{10} = 11001_2$.

The same method applies with base 8 or base 16. Dividing 25 repeatedly by 8 gives quotient 3 with remainder 1, then quotient 0 with remainder 3, so $25_{10} = 31_8$. Dividing 25 repeatedly by 16 gives quotient 1 with remainder 9, then quotient 0 with remainder 1, so $25_{10} = 19_{16}$.

What this unit covers

  • Introduction
  • Number System
  • Conversion from Decimal to Binary, Octal, Hexadecimal
  • Conversion of Binary, Octal, Hexadecimal to Decimal
  • Conversion of Binary to Octal, Hexadecimal
  • Conversion of Octal, Hexadecimal to Binary
  • Binary Arithmetic
  • Signed and Unsigned Numbers
  • Binary Data Representation
  • Binary Coding Schemes
  • Logic Gates

Conversion from Decimal to Binary, Octal, Hexadecimal

2081 · 5 marks

What is Unicode? Convert 0.865 from Base 10 to Base 16. [5]

Show solved answer

Unicode and Base 10 to Base 16 Conversion


Part 1: What is Unicode? [2 marks]

Unicode is a universal character encoding standard that assigns a unique number, called a code point, to every character, symbol, and script used in the writing systems of the world.

Key points:

  • Developed to overcome the limits of older schemes like ASCII (only 128 characters) and Extended ASCII (256 characters).
  • Can represent over 1 million (1,114,112) possible code points, covering nearly all languages (Latin, Devanagari, Chinese, Arabic, etc.), symbols, and emojis.
  • Each character has a code point written as U+XXXX, e.g. U+0041 = 'A'.
  • Encoding forms include UTF-8, UTF-16, and UTF-32.
  • Guarantees consistent text representation across platforms, devices, and applications.

Part 2: Convert $0.865_{10}$ to Base 16 [3 marks]

Method: Repeatedly multiply the fraction by 16; the integer part of each product forms the hex digits (top to bottom).

StepMultiplicationProductInteger part (hex digit)New fraction
1$0.865 \times 16$$13.840$$13 = D$$0.840$
2$0.840 \times 16$$13.440$$13 = D$$0.440$
3$0.440 \times 16$$7.040$$7$$0.040$
4$0.040 \times 16$$0.640$$0$$0.640$
5$0.640 \times 16$$10.240$$10 = A$$0.240$

Verification of each product:

  • $0.865 \times 16 = 13.84$ → digit D, remainder $0.84$
  • $0.84 \times 16 = 13.44$ → digit D, remainder $0.44$
  • $0.44 \times 16 = 7.04$ → digit 7, remainder $0.04$
  • $0.04 \times 16 = 0.64$ → digit 0, remainder $0.64$
  • $0.64 \times 16 = 10.24$ → digit A, remainder $0.24$

Reading digits top to bottom:

$$0.865_{10} \approx 0.\text{DD70A}_{16}$$

Answer:

$$\boxed{0.865_{10} \approx 0.DD70A_{16}}$$

(The conversion is non-terminating; five hex digits give a close approximation.)

Open this answer on its own page →

2080 · 5 marks

What is ASCII? Convert 0.2345 from Base 10 to Base 2. [5]

Show solved answer

ASCII and Base 10 to Base 2 Conversion

Given data

  • Number to convert: $0.2345$ (Base 10)
  • Target base: Base 2
  • Concept asked: ASCII

Part 1: What is ASCII? (2 marks)

ASCII stands for American Standard Code for Information Interchange.

  • It is a character encoding standard that assigns a unique numeric code to each character so that text can be represented, stored, and processed in computers.
  • Standard ASCII uses 7 bits, giving $2^7 = 128$ possible codes (0 to 127).
  • It encodes:
    • Uppercase letters A-Z (65-90)
    • Lowercase letters a-z (97-122)
    • Digits 0-9 (48-57)
    • Special/punctuation characters
    • Control characters (e.g., newline, tab, carriage return)
  • Example: 'A' = 65, 'a' = 97, '0' = 48.
  • Extended ASCII uses 8 bits to represent 256 characters.

Part 2: Convert 0.2345 to Base 2 (3 marks)

Method: Repeatedly multiply the fractional part by 2; the integer part of each product gives the next binary bit (read top to bottom).

StepFraction×2ProductBit
10.2345×20.46900
20.4690×20.93800
30.9380×21.87601
40.8760×21.75201
50.7520×21.50401
60.5040×21.00801
70.0080×20.01600
80.0160×20.03200

Reading the integer bits from top to bottom:

$$(0.2345)_{10} \approx (0.00111100)_2$$

Verification: $$0\cdot2^{-1}+0\cdot2^{-2}+1\cdot2^{-3}+1\cdot2^{-4}+1\cdot2^{-5}+1\cdot2^{-6}$$ $$= 0.125 + 0.0625 + 0.03125 + 0.015625 = 0.234375 \approx 0.2345 \checkmark$$

Note: This is a non-terminating binary fraction, so the answer is an approximation to 8 binary places.

$$\boxed{(0.2345)_{10} \approx (0.00111100)_2}$$

Open this answer on its own page →

2079 · 5 marks

Define decimal to binary conversion. Convert decimal 12.15 to binary. [5]

Decimal to binary conversion is the process of representing a number given in the decimal (base-10) system, which uses digits 0 through 9, into its equivalent form in the binary (base-2) system, which uses only the digits 0 and 1. A decimal number having both an integer and fractional component i...

Open this answer on its own page →

2074 · 5 marks

Convert $(10.4)_{10}$ to binary. Add $(10111)_2$ with $(01111)_2$. [5]

  • Decimal number to convert: $(10.4){10}$ - Binary numbers to add: $(10111)2$ and $(01111)2$ --- Divide by 2 repeatedly: Division Quotient Remainder ------------------------------- 10 ÷ 2 5 0 5 ÷ 2 2 1 2 ÷ 2 1 0 1 ÷ 2 0 1 Reading bottom to top: $(10){10} = (1010)2$ Multiply by 2 repeatedly, recor...
Open this answer on its own page →

Binary Arithmetic

2078 · 5 marks

How binary addition is done? Show binary addition of (11001) with (11011). [5]

  • First number: $A = 110012$ - Second number: $B = 110112$ - Operation: binary addition $A + B$ Binary addition works bit by bit from the least significant bit (rightmost), following these rules: A B Sum Carry ------------------ 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 When a carry from a previous stage i...
Open this answer on its own page →

Conversion of Binary, Octal, Hexadecimal to Decimal

2077 · 5 marks

Convert (110101.101) binary to decimal. [5]

  • Binary number: $110101.101$ - Integer part: $110101$ - Fractional part: $101$ Assign powers of 2 by position (integer part starts at $2^0$ going left; fractional part starts at $2^{-1}$ going right). Digit 1 1 0 1 0 1 . 1 0 1 ------------------------------------- Power $2^5$ $2^4$ $2^3$ $2^2$
Open this answer on its own page →

Signed and Unsigned Numbers

2075 · 10 marks

Discuss the concept behind the fixed point number representation. What can be the fixed point representation of a signed number 8? Convert (14.14) decimal into binary and octal.[10]

  • Concept required: fixed point number representation - Signed number to represent: 8 - Number to convert: $(14.14){10}$ into binary and octal --- Fixed point representation is a scheme for storing real numbers in which the position of the radix (binary) point is fixed at a predetermined location...
Open this answer on its own page →

0 · 10 marks

Discuss the concept behind the fixed point number representation. What can be the fixed point representation of a signed number 8? Convert (14.14) decimal into binary and octal.[10]

  • Signed number to represent: $8$ (i.e. $+8$) - Decimal number to convert: $(14.14){10}$ - Target bases: binary and octal --- Fixed point representation is a scheme for storing real numbers where the radix (binary) point is fixed at a predetermined position in the register/word. The point itself ...
Open this answer on its own page →