Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
31 views

Programming and Problem Solving Through C Language

The document provides information about basic computer organization and components. It describes the five basic functions of a computer as inputting, storing, processing, outputting, and controlling. These functions are performed by the computer's main components which include the input unit, storage unit, control unit, ALU, and output unit. The storage unit has two types: primary storage (main memory) and secondary storage (auxiliary storage). The document also discusses computer hardware such as input devices like keyboards and mice, output devices like monitors, and storage devices including hard disks.

Uploaded by

Sana chaudhary
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Programming and Problem Solving Through C Language

The document provides information about basic computer organization and components. It describes the five basic functions of a computer as inputting, storing, processing, outputting, and controlling. These functions are performed by the computer's main components which include the input unit, storage unit, control unit, ALU, and output unit. The storage unit has two types: primary storage (main memory) and secondary storage (auxiliary storage). The document also discusses computer hardware such as input devices like keyboards and mice, output devices like monitors, and storage devices including hard disks.

Uploaded by

Sana chaudhary
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 96

T A L

A EN
M
U N D
IT F
AN D
I N G
R A MM
RO G
CP

1
MODULE – 1

INTRODUCTION TO
COMPUTER
FUNDAMENTALS
Basic Computer Organization
COMPUTER
It comes from the word “compute”, which means, “to calculate”.
It is a device which operates on data.
BASIC FUNCTIONS
It performs the following five basic operations for converting raw input data
into useful information and presenting it to the user.
1.Inputting : Process of entering data and instructions into a computer
system
2.Storing : Saving data and instructions to make them readily available
for initial or additional processing as and when required.
3.Processing : Performing arithmetic operations (add, subtract etc) or
logical operations (comparisons like equal to, less than etc.)
on data to convert them into useful information. 3
Basic Computer Organization
4. Outputting : Process of producing useful information or results for a
user, such as printed report or visual display.
5. Controlling: Directing the manner and sequence in which the above
operations are performed.

• The internal architecture of computers differs from one system model to


another. However, the basic organization remains the same for all
computer systems.
• The above five basic operations are performed by five major building
blocks (functional units) of a digital computer system.
• Figure on the coming slide shows a block diagram of basic computer
organization.
4
Basic Computer Organization
Storage Unit
Program Information
and Data Secondary (Results)
Storage
Input Output
Unit Primary Unit
Storage

Control
Unit
Indicates the control
exercised by the
Arithmetic control unit
Logic Unit Indicates flow of
instructions and data
Central Processing Unit
5
Basic Computer Organization
INPUT UNIT
• It accepts (or reads) instructions and data from outside world.
• It converts these instructions and data in computer acceptable form.
• It supplies the converted instructions and data to computer system for
further processing.

OUTPUT UNIT
• It accepts the results produced by the computer, which are in coded form
and hence, we cannot easily understand them.
• It converts these coded results to human acceptable (readable) form.
• It supplies the converted results to outside world.

6
Basic Computer Organization
STORAGE UNIT
It holds (store):
• Data and instructions required for processing (received from input
devices).
• Intermediate results of processing.
• Results for output, before they are released to an output device.
Types:
a. Primary Storage
Also known as main memory, is used to hold pieces of program
instructions and data, intermediate results of processing and recently
produced results of those jobs on which computer is currently working.
It can hold information only while computer system is on.
7
Basic Computer Organization
b. Secondary Storage
Also known as auxiliary storage, is used to supplement the limited
storage capacity and the volatile characteristics of primary storage. It
holds the program instructions, data and information of those jobs on
which the computer system is currently not working but needs to hold
them for processing later.

CONTROL UNIT
It does not perform any actual processing on data, rather acts as a central
nervous system for other components of a computer system. It manages
and coordinates the entire computer system. It obtains instructions from
the program stored in main memory, interprets the instructions, and
issues signal causing other units of the system to execute them.
8
Basic Computer Organization
ARITHMETIC LOGIC UNIT (ALU)
It is the place where actual execution of instructions takes place during
processing operation.

CENTRAL PROCESSING UNIT (CPU)


Control Unit (CU) and Arithmetic Logic Unit (ALU) of a computer
system are together known as the Central Processing Unit (CPU). It is
the brain of the computer system.

9
QUESTIONS
Q1. Which unit accepts instructions and data from outside world?
A.Output Unit
B.Input Unit
C.Storage Unit
D.Arithmetic Logic Unit

Q2. The heart of any computer is


A.CPU
B.Memory
C.I/O unit
D.Disks
10
Computer Hardware Components
Hardware refers to the physical devices of a computer system
Input Devices
For giving commands to the computer
Keyboard Mouse

Other Pointing Devices


Trackball, Pointing Stick, Touch Pad etc.
11
Computer Hardware Components
Output Devices
Engaging our senses

Visual Output : Text, Graphics, Video


Audio Output : Sound, Music, Speech
12
Computer Hardware Components
Storage Devices
For saving the data
Storage devices are categorized by:
•The type of operations they perform
•Primary Storage and Secondary Storage
•The method they use to access the information
•Sequential and Random Access
•The technology they use
•Magnetic and Optical

13
Computer Hardware Components
•Their location in the storage hierarchy
•Online, Near-online and Offline
•Their capacity and speed
•Floppy Disk, Hard Drive and CD-ROM

14
QUESTIONS
Q1. Which of the following input or output devices is not associated with
personal computers?
A. optical scanners
B. mice
C. color monitors
D. punched cards

15
Disc

Platter Read/Write Head

•Hard disks are high-speed, high-capacity storage devices.


•They contain metal disks called platters.
•They contain two or more stacked platters with read/write heads for each
side.
•Hard disks can be divided into partitions to enable computers to work with
more than one operating system.
16
Disc
Factors Affecting a Disk’s Performance
•Seek time or positioning performance – How quickly the read/write head
positions itself and begins transferring information. It is measured in
milliseconds (ms).
•Spindle speed or transfer performance – How quickly the drive transfers
data. It is measured in rotations per minute (RPM).

17
QUESTIONS
Q1. The metal disks, which are permanently housed in, sealed and
contamination free containers are called
A.Hard disks
B.Floppy disks
C.Winchester disk
D.Flexible disk

18
Primary Memory

RAM – Memory
• Also known as main memory.
• It is used to hold pieces of program instructions and data, intermediate
results of processing and recently produced results of those jobs on which
computer is currently working.
• It can hold information only while computer system is on. As soon as the
computer system switches off or resets, the information held in primary
memory is erased.
• It has limited storage capacity and is very expensive.
19
QUESTIONS
Q1. What is another name for primary memory?
A.Secondary Memory
B.Main Memory
C.Auxiliary memory
D.Cache Memory

20
Secondary Memory

Hard – Disks
• Also known as auxiliary memory.
• It supplements the limited storage capacity and the volatile characteristics
of primary memory.
• It is much cheaper and can retain information even when a computer
system switches off or resets.
• It holds the program instructions, data and information of those jobs on
which the computer system needs to hold for processing later.
21
QUESTIONS
Q1. What is another name for secondary memory?
A.Virtual Memory
B.Main Memory
C.Auxiliary memory
D.Cache Memory

22
Keyboard

The keyboard allows the computer user to enter words, numbers,


punctuation, symbols, and special function commands into the computer’s
memory. There are typically 101 keys laid out in the QWERTY fashion.
23
QUESTIONS
Q1. How many keys are there in a normal QWERTY keyboard?
A.107
B.110
C.105
D.101

24
Mouse

• The mouse is the most widely used pointing device.


• A mouse is palm sized.
• As the mouse is moved, its movements are mirrored by the on-screen
pointer

25
Mouse
Types

Wheel Mouse Cordless Mouse

• Wheel mouse – Contains a rotating wheel used to scroll vertically within


a text document; connects to PS/2 port or USB port
• Cordless mouse – Uses infrared signals to connect to the computer’s
IrDA port; it must be within sight of the receiving port
26
Mouse
Using the Mouse
Mouse buttons enable the user to initiate actions.
• Clicking (left, right or double-clicking) allows the user to select an
item on the screen or open a program or dialog box
• Click and drag – Holding down the left mouse button and moving
the mouse enables the user to move objects on the screen

27
QUESTIONS
Q1. Which mouse action is used to move an item from one place to another.
A.Click
B.Double Click
C.Click and Drag
D.Roll Mouse

28
Printer

•A printer is a peripheral device that produces a physical copy or hard copy


of the computer’s output.
•There are many types of printers. Most commonly used are:
•Inkjet and Laser printers

29
Printer

Inkjet Printers Laser Printers


•Inkjet printer
• Also called a bubble-jet, makes characters by inserting dots of ink onto
paper
• Letter-quality printouts and cost of printer is inexpensive but ink is costly.
• Laser printer
• Works like a copier where quality is determined by dots per inch (dpi)
produced
• Color printers available and expensive initial costs but cheaper to operate
30
per
QUESTIONS
Q1. Impact printers
A.strike a ribbon against the paper to produce character images
B.include ink-jet and thermal devices
C.are more expensive than laser printers
D.use optical technology

31
Monitors

CRT LCD
•A monitor is a peripheral device which displays computer output on a
screen.
•Screen output is referred to as soft copy.
•Types of monitors:
• Cathode-ray tube (CRT)
• Liquid Crystal Display (LCD or flat-panel)
32
Monitors
Cathode – Ray Tube

• Resemble televisions
• Use picture tube technology
• Less expensive than a LCD monitor
• Take up more desk space and use more
energy than LCD monitors

33
Monitors
Liquid Crystal Display (LCD)
• Cells sandwiched between two transparent layers form images
• Used for notebook computers, PDAs, cellular phones, and personal
computers
• More expensive than a CRT monitor
• Take up less desk space and use less energy than CRT monitors
• Types of LCD monitors:
• Passive-matrix LCD
• Active-matrix LCD
• Gas plasma display
• Field emission display
34
Monitors
Monitor Specifications

•Screen size – The diagonal measurement of the screen surface in inches


(15, 17, 19, 21)
•Resolution – The sharpness of the image determined by the number of
horizontal and vertical dots (pixels) that the screen can display (800 x 600,
1024 x 768, 1600 x 1200)
•Refresh rate – The speed at which the screen is redrawn (refreshed) and
measured in Hertz (Hz) (60Hz, 75Hz)
35
QUESTIONS
Q1. What does LCD stands for?
A.Liquid Central Design
B.Liquid Crystal Design
C.Liquid Central Display
D.Liquid Crystal Display

36
CD
• CD-ROM stands for Compact Disc-Read Only
Memory.
• CD-ROM drives can not write data to discs.
• They are capable of storing 650 MB of data.
• They are used for storing operating systems,
large application programs, and multimedia
programs.

37
CD
CD-R CD-RW
• Discs can be read and • Discs can be read and
written to written to
• Discs can only be written to • Discs are erasable
“once” • Discs can be written to
many times
• CD-R drives are capable of • CD-RW drives are capable
reading and writing data of reading, writing, and
erasing data

38
DVD
• DVD stands for Digital Video Disc.
• DVD technology is similar to CD-ROM
technology.
• DVDs are capable of storing up to 17GB of data.
• The data transfer rate of DVD drives is
comparable to that of hard disk drives.
• DVD-R and DVD-RW drives have the ability to
read/write data

39
QUESTIONS
Q1. How much data can a DVD hold?
A.20 MB
B.20 GB
C.17 MB
D.17 GB

40
Computer Software
• A computer cannot do anything on its own. It must be instructed to do a job
desired by us. Hence, it is necessary to specify a sequence of instructions a
computer must perform to solve a problem. Such a sequence of instructions
written in a language understood by a computer is called a computer
program.
• A program controls a computer’s processing activity, and the computer
performs precisely what the program wants it to do. When a computer is
using a program to perform a task, we say it is running or executing the
program.
• The term software refers to a set of computer programs, procedures and
associated documents (flow charts, manuals etc.) describing the programs,
and how they are to be used.

41
Computer Software
Relationship between Hardware and Software
• Both hardware and software are necessary for a computer to do useful job.
Both are complementary to each other.
• Same hardware can be loaded with different software to make a computer
perform different types of jobs just as different songs can be played using the
same disc player.
• Except for upgrades (lie increasing main memory and hard disk capacities,
or adding speakers, modems etc.), hardware is normally a one time expense,
whereas software is a continuing expense.
Types of Software
• System Software
• Application Software
42
QUESTIONS
Q1. Software do not consists of
A.Programs
B.Hardware Components
C.Procedures
D.Associated Documents

43
Introduction to Application Software
Application Software
It is a set of one or more programs designed to solve a specific
problem, or do a specific task. For eg. Payroll Processing Software,
Examination Results Processing Software, Railway/Airline Reservation
Software, Computer Games Software etc. There are literally millions of
application software available for a wide range of applications.
Application Program
These are the programs which are included in an application
software package.
Application Programmers
These are the programmers who prepare application software.

44
Introduction to Application Software
Commonly known Application Software
•Word Processing Software
Enables us to make use of a computer for creating, editing, viewing,
formatting, storing, retrieving and printing the documents (written
material such as letters, reports, books etc.). Example: Microsoft
Word
•Spreadsheet Software
It is a numeric data analysis tool that allows us to create a kind of
computerized ledger. It has rows and columns to store and process
the data. Example: Microsoft Excel
•Database Software
It is a set of programs that enable us to create a database, maintain it
45
Introduction to Application Software
Commonly known Application Software
add, delete, update its records), organize its data in desired fashion
and selectively retrieve useful information from it. Example:
Microsoft Access
• Graphics Software
It enables us to use a computer system for creating, editing, viewing,
storing, retrieving and printing of designs, drawings, pictures,
graphs, etc. Example: Corel Draw
• Personal Assistance Software
It allows us to use personal computers for storage and retrieval of
our personal information, as well as planning and management of
our schedules, contacts, finances, and inventory of important items.
Example: Calenders 46
Introduction to Application Software
Commonly known Application Software
• Education Software
It allows a computer to be used as a teaching and learning tool. A
few examples of such software include those used for teaching
mathematics, grammar language, or any other subject.
• Entertainment Software
It allows a computer to be used as an entertainment tool. Example:
Computer games

47
QUESTIONS
Q1. Programs designed to perform specific tasks is known as
A.System software
B.Application software
C.Utility programs
D.Operating system

48
Introduction to System Software
System Software is a set of one or more programs designed to control the
operation and extend the processing capability of a computer system.

It performs the following functions


1.Supports the development of other application software.
2.Supports execution of other application software.
3.Monitors effective use of various hardware resources such as CPU,
memory, peripherals etc.
4.Communicates with and controls operation of peripheral devices such as
printer, disk, tapes etc.

49
QUESTIONS
Q1. Which one of the following is not considered to be a system software?
A.Assembler
B.Interpreter
C.Compiler
D.A COBOL program source code

50
Compilers
•A compiler is a translator program that translates a high-level language
program into its equivalent machine language program.

•The below figure illustrates the process of translating through compiler


High Level Input Output Machine
COMPILER
Language Program Language Program
(Source Code) (Object Program)
• It compiles the complete source code at one go and then show the errors, if
any.
• A compiler can translate only those source programs that have been written
in the language for which the compiler is meant. For example, a FORTRAN
compiler can only translate source programs written in FORTRAN.
Therefore, each computer requires a separate compiler for each high-level
language that it supports. 51
QUESTIONS
Q1. Compiler translates the program
A.Line by Line
B.Word by Word
C.Character by Character
D.Complete Program at one go

52
Interpreters
•An interpreter is a translator program that translates a high-level language
program into its equivalent machine language program. It takes one
statement of the source program, translates into machine language
instructions, and then execute the resulting machine language instructions
immediately.

•The below figure illustrates the process of translating through interpreter


High Level Input INTERPRETER Output Result of Program
Language Program (translates and executes execution
(Source Code)
statement – by - statement)

53
Difference between Compilers & Interpreters
COMPILERS INTERPRETERS
After compilation of a source program, Since no object program is saved for
the resulting object program is saved future use, repeated interpretation
permanently for future use. Hence (translation plus execution) is necessary
recompilation is not necessary for for its repeated execution.
repeated execution.
Compiles the complete source code in Interprets line by line.
one go.
Difficult to write, complex and requires Easier to write, less complex and
more memory. requires less memory.
One has to wait for detection and Easier and faster to correct the syntax
correction of errors until the complete errors.
program is compiled.
Execution of a program is faster. Slower when running a program
54
QUESTIONS
Q1. Interpreter translates the program
A.Line by Line
B.Word by Word
C.Character by Character
D.Complete Program at one go

55
Basic Operating System Concepts
• Operating system (often referred to as OS) is an integrated set of programs
that controls the resources (CPU, memory, I/O devices, etc.) of a computer
system and provide its user with an interface or virtual machine that is easier
to use.
• There are two primary objectives of an OS
1.Make a computer system easier to use
An OS hides details of hardware resources from programmers and other users and
provides them with a convenient interface for using a computer system. It acts as an
intermediary between the hardware and its users.
2.Manage the resources of a computer system
An OS manages all the resources of a computer system. This involves performing
such tasks as keeping track of who is using what resources, granting resources
requests etc. Efficient and fair sharing of system resources among users and/or
program is a key goal of all operating systems.
56
Basic Operating System Concepts
Logical Architecture of a Computer System

57
Basic Operating System Concepts
Main functions of an Operating System
1.Process Management
This module takes care of creation and deletion of processes,
scheduling of system resources to different processes requesting
them, and providing mechanisms for synchronization and
communication among processes.
2.Memory Management
This module takes care of allocation and de-allocation of memory
space to programs in need of this resource.
3.File Management
This module takes care of file-related activities such as organization,
storage, retrieval, naming, sharing and protection of files.
58
Basic Operating System Concepts
4. Security
It protects the resources and information of a computer system
against destruction and unauthorized access.
5. Command Interpretation
This module takes care of interpreting user commands, and
directing system resources to process the commands. With this
mode of interaction with a system, users are not much concerned about
hardware details of the system.

59
Basic Operating System Concepts
Measuring System Performance
1.Throughput
It is the amount of work that a system is able to do per unit time. It is
measured as the number of jobs (processes) completed by the system per unit
time. It is normally measured in processes/hour. It is desirable to maximize
the throughput.
2.Turnaround Time
It is the interval between the time of submission of a job to the system for
processing to the time of completion of the job. It is desirable to minimize
the turn around time.
3.Response Time
It is the interval between the time of submission of a job to the system for
processing to the time of the system producing the first response for the
job. It is desirable to minimize the response time. 60
QUESTIONS
Q1. The interval between the time of submission of a job to the system
for processing to the time of completion of the job is known as
A.Throughput
B.Turn Around time
C.Response Time
D.Answerable Time

61
Functional Knowledge of MSDOS and WINDOWS
MS-DOS

• MS-DOS, short for Microsoft Disk Operating System, is an Operating


system for personal computers.
• It is a single-user operating system.
• The default user interface is Command – line/text.
• It was the most commonly used member of the DOS family of operating
systems, and was the main operating system for IBM PC compatible
personal computers during the 1980s to the mid-1990s, until it was gradually
superseded by operating systems offering a graphical user interface (GUI), in
particular by various generations of the Microsoft Windows operating
system. 62
Functional Knowledge of MSDOS and WINDOWS
WINDOWS

• Microsoft Windows OS was developed by Microsoft to overcome the


limitations of its own MS-DOS OS
• First version was Windows 3.0 and since then many versions has been in
the market.
• Main features are
• Its native interface is a GUI. So, it is easier to learn computers for a new user.
• It is a single user, multitasking operating system.
• It was designed to be not just an operating system but also a complete
operating environment. All its programs conform to a standard way of working.
63
QUESTIONS
Q1. The default user interface for MS-DOS is
A.Command Line
B.Graphical User
C.Instructions
D.None of the above

64
Number System
•Number system is a format required for performing arithmetic calculations
on the numbers.
•There are two types of number system

1.Non-Positional Number System


It is a method of counting which uses an additive approach. In this system,
we have symbols such as I for 1, II for 2, III for 3, IIII for 4, IIIII for 5 and
so on. Each symbol represents the same value regardless of its position in a
number, and to find the value of the number, one has to count the number
of symbols present in the number. Since, it is very difficult to perform
arithmetic with such a number system, positional number system was
developed.

65
Number System
2. Positional Number System
In a positional number system, there are only a few symbols called digits.
These symbols represent different values, depending in the position they
occupy in a number. The value of each digit in such a number is
determined by three considerations:
A. The digit itself
B. The position of the digit in the number
C. The base of the number system (where base is defined as the total
number of digits available in the number system).

66
Binary
• Base (also called radix) = 2
• 2 digits { 0, 1 }, called binary digits or “bits”
• Weights
• Weight = (Base) Position
• Magnitude
• Sum of “Bit x Weight”
• Formal Notation
(10110)2
• Groups of bits
4 bits = Nibble 8 bits = Byte
• Valid Binary Numbers
10111, 101100, 100.1101, 1111.00001 67
QUESTIONS
Q1. What is the base of binary number?
A.2
B.8
C.10
D.16

68
Hexadecimal
• Base = 16
• 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
• Weights
• Weight = (Base) Position
• Magnitude
• Sum of “Digit x Weight”
• Formal Notation
(82AB.9C)16

69
QUESTIONS
Q1. What is the base of hexa decimal number?
A.2
B.8
C.10
D.16

70
Octal
• Base = 8
• 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
• Weights
• Weight = (Base) Position
• Magnitude
• Sum of “Digit x Weight”
• Formal Notation
(57.12)8

71
QUESTIONS
Q1. What is the base of octal number?
A.2
B.8
C.10
D.16

72
Decimal
• Base = 10
• 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
• Digit Position
• Integer & fraction
• Digit Weight
• Weight = (Base) Position
• Magnitude
• Sum of “Digit x Weight”
• Formal Notation
(18734.987)10

73
QUESTIONS
Q1. What is the base of decimal number?
A.2
B.8
C.10
D.16

74
Conversion from one number system to another
Converting from Another Base to Decimal
The following steps are used to convert a number in any other base to a base
10 (decimal) number:
Step 1: Determine the column (positional) value of each digit (this depends
on the position of the digit and the base of the number system).
Step 2: Multiple the obtained column values (in Step 1) by the digits in the
corresponding columns.
Step 3: Sum up the product calculated in Step 2. The total is the equivalent
value in decimal.

75
Conversion from one number system to another
Converting from Another Base to Decimal
EXAMPLE 1: Binary to decimal
110012 = ?10
Step 1: Determine the column (positional) value of each digit.
Column Number Column Value
(from right)
1 20 = 1
2 21 = 2
3 22 = 4
4 23 = 8
5 24 = 16
76
Conversion from one number system to another
Step 2: Multiple the obtained column values (in Step 1) by the digits in the
corresponding columns

16 8 4 2 1
X1 X1 X0 X0 X1
16 8 0 0 1

Step 3: Sum up the products


16 + 8 + 0 + 0 + 1 = 25

110012=2510
77
Conversion from one number system to another
Converting from Another Base to Decimal
EXAMPLE 2: Octal to decimal
47068 = ?10
Step 1: Determine the column (positional) value of each digit.
Column Number Column Value
(from right)
1 80 = 1
2 81 = 8
3 82 = 64
4 83 = 512

78
Conversion from one number system to another
Step 2: Multiple the obtained column values (in Step 1) by the digits in the
corresponding columns

512 64 8 1
X4 X7 X0 X6
2048 448 0 6

Step 3: Sum up the products


2048 + 448 + 0 + 6 = 2502

47068=250210
79
Conversion from one number system to another
Converting from Another Base to Decimal
EXAMPLE 3: Hexadecimal to decimal
1AC16 = ?10
Step 1: Determine the column (positional) value of each digit.
Column Number Column Value
(from right)
1 160 = 1
2 161 = 16
3 162 = 256

80
Conversion from one number system to another
Step 2: Multiple the obtained column values (in Step 1) by the digits in the
corresponding columns

256 16 1
X1 X10 X12
256 160 12

Step 3: Sum up the products


256 + 160 + 12 = 428

1AC16 = 42810
81
Conversion from one number system to another
Converting from Decimal to Another Base
The following steps are used to convert a base 10 (decimal) number in any
other base number:
Step 1: Divide the decimal number by the value of the new base.
Step 2: Record the remainder from Step 1 as the rightmost digit (least
significant digit) of the new base number.
Step 3: Divide the quotient of the previous division by the new base.
Step 4: Record the remainder from Step 3 as the next digit (to the left of the
new base number).

Repeat Steps 3 and 4, recording remainders from right to left, until the
quotient becomes 0 in Step 3.
82
Conversion from one number system to another
Converting from Decimal to Binary
EXAMPLE 4: 4210 = ?2
2 42 Remainders
21 0
10 1
5 0
2 1
1 0
0 1

4210 = 1010102
83
Conversion from one number system to another
Converting from Decimal to Octal
EXAMPLE 5: 95210 = ?8
8 952 Remainders
119 0
14 7
1 6
0 1

95210 = 16708

84
Conversion from one number system to another
Converting from Decimal to Hexadecimal
EXAMPLE 6: 42810 = ?16
16 428 Remainders
26 12 = C
1 10 = A
0 1=1

42810 = 1AC16

85
Conversion from one number system to another
Converting from a base other than 10 to Another Base other than 10
The following steps are used
Step 1: Convert the original number to a base 10 (decimal) number.
Step 2: Convert the decimal number obtained in Step 1 to the new base
number.

Example: 1011102 = ?8
1: 1011102 = 4610
2: 4610 = 568
Hence, 1011102 = 568

86
Conversion from one number system to another
Decimal Binary Octal Hex
00 0000 00 0
01 0001 01 1
02 0010 02 2
03 0011 03 3
04 0100 04 4
05 0101 05 5
06 0110 06 6
07 0111 07 7
08 1000 10 8
09 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
87
QUESTIONS
Q1. (12)10 = ()8
A.248
B.148
C.348
D.448

88
Computer Codes – ASCII & EBCDIC
ASCII
• American Standard Code for Information Interchange
• A popular code used to represent information sent as character-based data.
• It uses 7-bits to represent:
• 94 Graphic printing characters.
• 34 Non-printing characters.
• Some non-printing characters are used for text format (e.g. BS =
Backspace, CR = carriage return).
• Other non-printing characters are used for record marking and flow control
(e.g. STX and ETX start and end text areas)

89
Computer Codes – ASCII & EBCDIC
EBCDIC
• Extended Binary Coded Decimal Interchange Code (EBCDIC)
• It is an 8-bit character encoding used mainly on IBM mainframe and IBM
midrange computer operating systems.
• EBCDIC descended from the code used with punched cards and the
corresponding six bit binary coded decimal code used with most of IBM's
computer peripherals of the late 1950s and early 1960s.

90
QUESTIONS
Q1. EBCDIC can code up to how many different characters?
A.256
B.16
C.32
D.64

91
Representation of Integers, Fixed & Floating Point
Numbers
FIXED NUMBERS
• Computer uses a fixed number of bits to represent a piece of data, which
could be a number, a character, or others.
• A n-bit storage location can represent up to 2n distinct entities. For
example, a 3-bit memory location can hold one of these eight binary
patterns: 000, 001, 010, 011, 100, 101, 110, or 111. Hence, it can represent at
most 8 distinct entities.
• You could use them to represent numbers 0 to 7, numbers 8881 to 8888,
characters 'A' to 'H', or up to 8 kinds of fruits like apple, orange, banana; or
up to 8 kinds of animals like lion, tiger, etc.

92
Representation of Integers, Fixed & Floating Point
Numbers
INTEGERS
• Integers are whole numbers or fixed-point numbers with the radix
point fixed after the least-significant bit.
• Computers use a fixed number of bits to represent an integer. The
commonly-used bit-lengths for integers are 8-bit, 16-bit, 32-bit or 64-bit.
• Besides bit-lengths, there are two representation schemes for integers:
•Unsigned Integers : can represent zero and positive integers.
•Signed Integers : can represent zero, positive and negative integers.

93
Representation of Integers, Fixed & Floating Point
Numbers
FLOATING POINT NUMBERS
• A floating-point number (or real number) can represent a very large
(1.23×1088) or a very small (1.23×10-88) value. It could also represent very
large negative number (-1.23×1088) and very small negative number (-
1.23×10^88), as well as zero.
• A floating-point number is typically expressed in the scientific notation,
with a fraction (F), and an exponent (E) of a certain radix (r), in the form
of F×rE. Decimal numbers use radix of 10 (F×10E); while binary numbers use
radix of 2 (F×2E).
•Representation of floating point number is not unique. For example, the
number 55.66 can be represented as 5.566×101, 0.5566×102, 0.05566×103,
and so on.
94
Representation of Integers, Fixed & Floating Point
Numbers
• The fractional part can be normalized. In the normalized form, there is only
a single non-zero digit before the radix point. For example, decimal
number 123.4567 can be normalized as 1.234567×102; binary
number1010.1011B can be normalized as 1.011011B×23.
• It is important to note that floating-point numbers suffer from loss of
precision when represented with a fixed number of bits (e.g., 32-bit or 64-
bit).
• It is also important to note that floating number arithmetic is very much
less efficient than integer arithmetic. It could be speed up with a so-called
dedicated floating-point co-processor. Hence, use integers if your application
does not require floating-point numbers.

95
QUESTIONS
Q1. Precision loss is suffered by which representation?
A.Integer
B.Fixed
C.Floating point
D.None of the above

96

You might also like