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

Data Representation

This document discusses data representation in computing. It covers different numeric and character representation formats like binary, decimal, hexadecimal, ASCII, Unicode. It also discusses different data types used by CPUs like integer, real number, character, and Boolean. Additionally, it discusses factors that influence data representation like data size, accuracy, and standardization. Finally, it introduces several common data structures like arrays, linked lists, records, and classes/objects.

Uploaded by

Percival Riego
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Data Representation

This document discusses data representation in computing. It covers different numeric and character representation formats like binary, decimal, hexadecimal, ASCII, Unicode. It also discusses different data types used by CPUs like integer, real number, character, and Boolean. Additionally, it discusses factors that influence data representation like data size, accuracy, and standardization. Finally, it introduces several common data structures like arrays, linked lists, records, and classes/objects.

Uploaded by

Percival Riego
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

3.

0 Data Representation
Binary to Decimal

Binary to Decimal with fraction

Decimal to Binary

3.0 Data Representation 1


Decimal to Binary with fraction

Binary to Hexadecimal ←→ Hexadecimal to Binary

3.0 Data Representation 2


Factors for Representation
Data Size and Range

—> data size represents number of bits used to represent numeric values
—> smaller size = smaller range

Accuracy —> larger data = larger storage = less error


Ease of Manipulation —> refers to executing processor operations like arithmetic and
logical

Standardization —> data must be communicated between devices in a single


computer to other computers via network

CPU Data Types


Integer

—> whole number


—> Unsigned - treated as positive number

To find range: 0 to 2^n-1

—> Signed - uses 1 bit to represent the value if either positive or negative

0 = positive

1 = negative

To find range: -2^n-1 to 2^n-1-1

2’s Complement

3.0 Data Representation 3


—> Range and Overflow

most modern CPU’s use 64-bit to represent 2’s complement value

overflow condition produces illogical results

3.0 Data Representation 4


longer format = less chance of overflow but could be more space wasted

shorter format = high chance of overflow but more compact

to avoid overflow, some CPU designers use double precision == long integer

Real Number

3.0 Data Representation 5


3.0 Data Representation 6
3.0 Data Representation 7
3.0 Data Representation 8
—> values of all 1’s is a special signal NaN (Not a Number)

Character
—> EBCDIC (Extended Binary Coded Decimal Interchange Code)

developed by IBM in 2000’s

encoded in string of 8-bits

old and not used anymore

—> ASCII (American Standard Code for Information Interchange)

7-bit encoding format with 1 bit parity

table has at least 128 characters

3.0 Data Representation 9


suported by majority of OS

a subset of unicode

—> Unicode

coding table uses 16-bit or 32-bit codes to represent characters

used to represent language characters e.g japanase, arabic, chinese, emojies

—> Device Control

Carriage Return - moves print head to start of the line (like in typewriter)

Line Feed - moves print head down one line

Boolean
—> has only 2 value, true and false

3.0 Data Representation 10


—> 0 = false
—> non-zero = true

Memory Address
—> each byte has a unique address

—> a pointer is a data element containing the address of another data element
—> address values always starts with zero
—> Flat memory model

used by moder CPU’s

address identified by a series of unsigned values

—> Segmented memory model

used by older CPU’s but is still supported by modern ones

memory is divided into fixed pages

Data Structures
—> group of primitive data elements organized and manipulated in software

—> can’t be manipulated through hardware


—> E.g software level “string” is a data structure composed of multiple characters

3.0 Data Representation 11


Arrays

—> ordered list of similar elements


—> Index values commonly starts with 0 and are not stored, implies data value
location

Linked List
—> uses pointers so that list elements can be placed in nonsequential manner

—> each list element contains a pointer that holds the location of the next list
element

3.0 Data Representation 12


—> more difficult to locate list elements but much easier to insert on compare to
array

Record
—> composed of other data structures and commonly used as unit of input and
output from other files

—> file is a sequence of records on secondary storage

3.0 Data Representation 13


—> table s a sequence of records on main storage

Classes and Objects


—> object-oriented programming is a way of combining program instructions and
data into 1 data structure

—> class contains both traditional (static) data and manipulates the data
—> object is one variable of a class

3.0 Data Representation 14

You might also like