0% found this document useful (0 votes)
70 views

data representation notes final

The document explains data representation, detailing how data is encoded in binary form for computer processing, including various data types such as integers, floating-point numbers, and characters. It also covers units of data storage, conversion between units, and character encoding standards like ASCII and Unicode. Additionally, it introduces number systems used in computing, including binary, octal, decimal, and hexadecimal, emphasizing their importance in managing complex data.

Uploaded by

lijirar723
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

data representation notes final

The document explains data representation, detailing how data is encoded in binary form for computer processing, including various data types such as integers, floating-point numbers, and characters. It also covers units of data storage, conversion between units, and character encoding standards like ASCII and Unicode. Additionally, it introduces number systems used in computing, including binary, octal, decimal, and hexadecimal, emphasizing their importance in managing complex data.

Uploaded by

lijirar723
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Data representation

Data refers to the symbols that represent people, events, things, and ideas. Data can be a
name, a number, the colours in a photograph, or the notes in a musical composition.
Data and instructions cannot be entered and processed directly into computers using human
language. Any type of data must first be converted into machine-readable form, that is binary
form. Due to this reason, it is important to understand how a computer together with its
peripheral devices handles data in its electronic circuits, on magnetic media and in optical
devices.
Data representation refers to the methods and formats used to store and encode information in
a computer system.
Computers use binary, the digits 0 and 1, to store data. A binary digit, or bit, is the smallest
unit of data in computing.
Representing (or encoding) a number means to express it in binary form. Representing
numbers in a computer is necessary in order for it to be able to store and manipulate them. To
process real-world data in the computer, we need a way to represent the data in switches.
Computers do this representation using a binary coding system.
Binary digits are the foundation of all data representation in computers. apart from the binary
system, there are several commonly used methods for data representation:
1. Integer Representation
2. Floating-Point Representation
3. Character Representation
4. String Representation
5. Image Representation
6. Audio Representation
7. Video Representation
Data representation is crucial for computers to understand and process information in various
forms. Different data types and representations have different storage requirements, precision,
and computational properties, and understanding these representations is essential for
effective programming and data manipulation.
DATA TYPES AND REPRESENTATION
A data type is an attribute associated with a piece of data that tells a computer system how to
interpret its value. Understanding data types ensures that data is collected in the preferred
format and the value of each property is as expected.
For example, knowing the data type for “Kwaku, Appiah” will help a computer know:
whether the data is referring to someone’s full name (“Kwaku Appiah”) or a list of two names
(“Kwaku” and “Appiah”)
Understanding data types will help you ensure that: the data you collect is always in the right
format (“Kwaku, Appiah” vs. “Kwaku Appiah”) and the value is expected.
Common data types

Data Type Definition E


Integer (int) Numeric data type for numbers without fractions -
Floating Point (float) Numeric data type for numbers with fractions 7
Character (char) Single letter, digit, punctuation mark, symbol, or blank space a
String (str or text) Sequence of characters, digits, or symbols—always treated as text h
Boolean (bool) True or false values 0
Enumerated type Small set of predefined unique values (elements or enumerators) that can be text-
r
(enum) based or numerical
r
Array List with a number of elements in a specific order—typically of the same type
p
Date Date in the YYYY-MM-DD format (ISO 8601 syntax) 2
Time in the hh:mm:ss format for the time of day, time since an event, or time
Time 1
interval between events
Datetime Date and time together in the YYYY-MM-DD hh:mm:ss format 2
Integer (int)
It is the most common numeric data type used to store numbers without a fractional
component (-707, 0, 707).
Floating Point (float)
It is also a numeric data type used to store numbers that may have a fractional component like
monetary values do (707.07, 0.7, 707.00).
Please note that number is often used as a data type that includes both int and float types.
Character (char)
It is used to store a single letter, digit, punctuation mark, symbol, or blank space.
String (str or text)
It is a sequence of characters and the most commonly used data type to store text.
Additionally, a string can also include digits and symbols, however, it is always treated as text
and not used in calculations. A phone number is usually stored as a string (+1-999-666-3333)
but can also be stored as an integer (9996663333).
Boolean (bool)
It represents the values true and false. When working with the Boolean data type, it is helpful
to keep in mind that sometimes a Boolean value is also represented as 0 (for false) and 1 (for
true).
Array
Also known as a list, an array is a data type that stores a number of elements in a specific
order, typically all of the same type
Date
Needs no explanation; typically stores a date in the YYYY-MM-DD format (ISO 8601
syntax).
Time
Stores a time in the hh:mm:ss format. Besides the time of the day, it can also be used to store
the time elapsed or the time interval between two events which could be more than 24 hours.
For example, the time elapsed since an event took place could be 72+ hours (72:00:59).
Datetime
Stores a value containing both date and time together in the YYYY-MM-DD hh:mm:ss
format.
UNIT OF DATA STORAGE
We know that all data in a computer is represented by 1s and 0s. Computers store information
in the form of "1" and "0"s in different types of storages such as memory, hard disk, USB
drives etc. The most common digital data storage unit is byte which is 8 bits.
Bits, bytes, nibble and word
The terms bits, bytes, nibble and word are used widely in reference to computer memory and
data size.
Bits: can be defined as a binary, which can be 0, or 1. It is the basic unit of data or
information in digital computers.
Byte: a group of bits (8 bits) used to represent a character. A byte is considered as the basic
unit of measuring memory size in computer.
A nibble: is half a byte, which is usually a grouping of 4 bits.
Word: two or more bits make a word. The term word length is used as the measure of the
number of bits in each word. For example, a word can have a length of 16 bits, 32 bits, 64
bits etc.
Units of storage

UNIT / SYMBOL BINARY EQUALS


NAME
MEASUREMENT

Bit b 1 or 0

Nibble - 4 bits

Byte B 8 bits

Kilobyte KB 210 1024 bytes

Megabyte MB 220 1024 KB

Gigabyte GB 230 1024 MB

Terabyte TB 240 1024 GB

Petabyte PB 250 1024 TB

Exabyte EB 260 1024 PB

Changing From One Unit to Another


As well as knowing the order of the units (bits, bytes, KB, MB, GB, Tb), it is important when
doing calculations in computing, to be able to change from one unit to another.
To convert a smaller unit to larger units (eg. KB to MB or MB to GB) you simply divide the
original number by 1024 for each Unit size along the way to the final desired unit.
To convert larger units to smaller units (eg. GB to MB or GB to KB) you simply multiply the
original number by 1024 for each unit size along the way to the final desired unit.
Example:
Example 1: Convert 4Mb into bytes
4 x 1024 x 1024 = 4,194,304 bytes
Example 2: Convert 4096Gb in Tb
4096 / 1024 = 4Tb
Example 3: Convert 3.5Mb into bits
3.5 x 1024 x 1024 x 8 = 29,360,128 bits
Example 4: Convert 68,719,476,736 bits into Gb
We are moving four steps to the right68,719,476,736 / 8 / 1024 / 1024 / 1024=8Gb
CHARACTER REPRESENTATION
A character is any letter, number, space, punctuation mark or symbol that can be typed on a
computer
Computers work in binary. As a result, all characters, whether they are letters, punctuation or
digits, are stored as binary numbers. All of the characters that a computer can use are called
a character set.
Two standards are in common use:
 American Standard Code for Information Interchange (ASCII)
 Unicode
ASCII uses seven bits, giving a character set of 128 characters. The characters are
represented in a table called the ASCII table. The 128 characters include:
 32 control codes (mainly to do with printing)
 32 punctuation codes, symbols, and space
 26 upper-case letters
 26 lower-case letters
 numeric digits 0-9
We tend to say that the letter ‘A’ is the first letter of the alphabet, ‘B’ is the second and so on,
all the way up to ‘Z’, which is the 26th letter. In ASCII, each character has its own assigned
number.

The table below shows part of ASCII- 8 code


CHAR AS BINA CHAR AS BINA
ACT C RY ACT C RY
ER II ER II
A 09 011000 A 65 01000
7 01 001
B 09 011000 B 66 01000
8 10 010
C 09 011000 C 67 01000
9 11 011
D 10 011001 > 60 001111
0 00 00
1 49 001100 ‘’ 14 10010
01 7 011
2 50 001100 € 12 10000
01 8 000
8 56 001110 © 16 10101
00 9 001
@ 64 01000 ₵ 16 10100
000 2 010
? 63 001111 % 37 00100
11 101

‘A’ is assigned by the denary number 65 (binary 1000001, hexadecimal 41), ‘B’ by 66 (binary
1000010, hexadecimal 42) and so on up to ‘Z’, which is represented by the denary number 90
(binary 1011010, hexadecimal 5A). Similarly, lower-case letters start at denary 97 (binary
1100001, hexadecimal 61) and end at denary 122 (binary 1111010, hexadecimal 7A).
When data is stored or transmitted, code number is used, not the character itself.
Extended ASCII
Extended ASCII uses eight bits, giving a character set of 256 characters. This allows for
special characters such as those with accents in languages such as French and Spanish.
Unicode
While suitable for representing English characters, 256 characters is far too small to hold
every character in other languages, such as Chinese or Arabic. Unicode uses 16 bits, giving a
range of 65,536 characters. It is more suitable for languages with a large number of
characters, but it requires more memory.
Coding Information using a Bit Pattern
With the knowledge on encoding schemes, we can now code using a bit pattern.
Bit patterns can consist of any number of bits. Digital computers, however, are designed to
think of bits as coming in fixed length groups. The fundamental number of bits in a group
varies from computer to computer. There have been computers built using at least the
following numbers of bits in their basic group, which is usually called a word 4, 8, 12, 16, 24,
36, 39, 40, 48, 64
Most current computers come in either 8-bit, 16-bit, or 32-bit lengths. The major exceptions
are some very tiny computers used in, for example, thermostats or toasters, which only have a
4-bit word. Such a small bit pattern, only half of a byte, is often called a nibble.
Using the encoding schemes discussed above, you will note that every character or text has
been assigned a unique bit pattern. The text is then represented as a long string of bits in
which the successive patterns represent the successive symbols in the original script
For example, the word "Computer" would be represented as:
1000011 1101111 1101101 1110000 1110101 1110100 1100101 1110010

Question
What would this message say?
1001000 1100101 1101100 1101100 1101111 0100001
NUMBER SYSTEMS AND THEIR REPRESENTATION
Computers do not only process numbers, letters and special symbols but also complex types
of data such as sound and pictures. However, these complex types of data take a lot of
memory and processor time when coded in binary form. This limitation necessitates the need
to develop better ways of handling long streams of binary digits. Higher number systems are
used in computing to reduce these streams of binary digits into manageable form. Computer
architecture supports the following number systems so we need to study them and also need
to know the conversion technique between them. Binary number system, octal number
system, Decimal number system, Hexadecimal (Hex) number system
Binary Number System
A Binary number system has only two digits that are 0 and 1. Every number (value)
represents
with 0 and 1 in this number system. The base of binary number system is 2, because it has
only two digits.

Octal number system

Octal number system has only eight (8) digits from 0 to 7. Every number (value) represents
with 0,1,2,3,4,5,6 and 7 in this number system. The base of octal number system is 8, because
it has only 8 digits.

Decimal number system

Decimal number system has only ten (10) digits from 0 to 9. Every number (value) represents
with 0,1,2,3,4,5,6, 7,8 and 9 in this number system. The base of decimal number system is 10,
because it has only 10 digits

Hexadecimal number system

A Hexadecimal number system has sixteen (16) alphanumeric values from 0 to 9 and A to F.
Every number (value) represents with 0,1,2,3,4,5,6, 7, 8, 9, A, B, C, D, E and F in this
number system. The base of hexadecimal number system is 16, because it has 16
alphanumeric values. Here A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.

Note:
Write your own notes on how to convert from one base to the other by referring to your
classroom practice.

You might also like