Computer
Fundamentals
Lecture 1: Data Types and Data
Representation
03/12/09 Sri Lanka Institue of Information Technology
Course Objectives
After completing this module students will be able
to:
Explain fundamental concepts related to computer
systems
Identify major components of a computer and describe
their functionality
Illustrate how each component work and communicate
with each other
Distinguish the functional importance of different
components
And
Assemble a computer for a given task
03/12/09 Sri Lanka Institue of Information Technology
Lecture Outline
03/12/09 Sri Lanka Institue of Information Technology
Lecture Objectives
Data and it’s representation inside
computers
What do they mean by “data”?
Why do we need a representation to hold them
inside a computer?
Data types and their usage
03/12/09 Sri Lanka Institue of Information Technology
Agenda
A Modern Computer System
What is data ?
How do we store them inside a computer?
Programmers point of view
Basic Data Types
Number Representation
Floating Point Representation
Data Representation in Computers
Binary Code Transmission
03/12/09 Sri Lanka Institue of Information Technology
A Modern Computer System
Image Credit: Modern Operating System by Andrew S Tanenbaum
03/12/09 Sri Lanka Institue of Information Technology
A Modern Computer System
Image Credit: Operating System Concepts by Silberschatz et. al.
03/12/09 Sri Lanka Institue of Information Technology
What is data ?
Data is an observation
The physical world is observed by sensors
These sensors, upon receiving input signals
output a signal
These input signals are very often analog in
nature
Analog signals are continuous electrical signals
that vary with time
Most of the time, the variations follow that of the
non-electric (original) signal, therefore the two
are analogous
03/12/09 Sri Lanka Institue of Information Technology
How do we store them in a
computer?
Computer is a digital device which is capable to
handle discrete data/information
Therefore, we need to convert these analog
signals to digital signals after capturing them by
the input devices
This is done with the converter ADC
Digital signals are represented by numbers
Once these numbers are captured they need to
be stored in the main memory ( this is a
requirement by the architecture)
03/12/09 Sri Lanka Institue of Information Technology
How do we store them in a
computer?
The main memory is a collection of
discrete units called BYTES.
In order to store a lengthy number when it
exceeds one BYTE we need a specific way
That is what we call the data
representation
03/12/09 Sri Lanka Institue of Information Technology
How do we store them in a
computer?
The memory is made up of BYTES
Each BYTE can be addressed uniquely
When the address is expressed in Binary, the
number of maximum BITs used to write the
address specifies the total number of locations
available
If n number of BITs are available then the
total number of locations available is 2n
If we have 32 BITs then we can have 4GB of
Memory
03/12/09 Sri Lanka Institue of Information Technology
How do we store them in a
computer?
Our pc’s are having 512MB of main
memory (RAM). How many bits are used
to address the memory locations of the
PC?
03/12/09 Sri Lanka Institue of Information Technology
How do we store them in a
computer?
The number used to identify a memory
location (which is a BYTE) is called the
address.
There is no place given in the memory
location to have this address
03/12/09 Sri Lanka Institue of Information Technology
Programmers point of view
Programmers need to use data in their programs
The architecture says, it is required to store them
in the main memory before use
Therefore, it is required to find a way to put them
in memory
He sets his requirement through what we call a
DATA TYPE
Through a data type, architecture tells the
computer that data must be stored in a particular
way in the main memory
For that, the data must have a representation
03/12/09 Sri Lanka Institue of Information Technology
Basic Data Types: Character
Data
Numeric
012…9
Alphabetic
Abc……z
Special
(#@%$&…
03/12/09 Sri Lanka Institue of Information Technology
Basic Data Types: Numeric
data
Integer
+ & - whole numbers
4251 -582
Most significant bit Least significant bit
Real
All numbers including everything between
integers
0.23, 0, 5 ½, -2.3,
03/12/09 Sri Lanka Institue of Information Technology
Number Representation
Fixed Point Representation
12.548
Floating Point Representation
Scientific Notation
12.054 -> 1.2054 * 101
Computer Notation
12.65 -> .1265*102
03/12/09 Sri Lanka Institue of Information Technology
Floating Point
Representation
Mantissa/argument
15.23 * 10 4
Exponent
Radix /base
03/12/09 Sri Lanka Institue of Information Technology
Data Representation in
Computers
How do computers represent data?
Most computers are digital
Recognize only two discrete states: on or off
Computers are electronic devices powered by
electricity, which has only two states, on or off
1 1 1 1 1
0 0 0 0 0
03/12/09 Sri Lanka Institue of Information Technology
Data Representation in
Computers
Binary representation
A number system that has just two unique
digits, 0 and 1
The two digits represent the two off and on
states
Binary Electronic Electronic
Digit (bit) Charge State
03/12/09 Sri Lanka Institue of Information Technology
Data Representation in
Computers
BCD (Binary Coded Decimal)
4 bit code for numeric values only
9 ->1001
03/12/09 Sri Lanka Institue of Information Technology
Data Representation in
Computers
ASCII (American Standard Code for
Information Interchange)
7 bit code for all 128 characters
A=1000001
EBCDIC (Extended BCD Interchange Code)
8 bit ASCII
03/12/09 Sri Lanka Institue of Information Technology
Data Representation in
Computers
ASCII (American
Standard Code for
Information
Interchange)
7 bit code for all
128 characters
A=1000001
03/12/09 Sri Lanka Institue of Information Technology
Binary Code Transmission
Pulse Train Pulse
level
High
Parity bit Parity bit
Even parity
Odd parity Low
time
ASCII –’
A’
03/12/09 Sri Lanka Institue of Information Technology
Thank You
03/12/09 Sri Lanka Institue of Information Technology