Download as pdf or txt
Download as pdf or txt
You are on page 1of 41

Computer Fundamentals and Programming 1

Module
COMPUTER FUNDAMENTALS AND
1 PROGRAMMING

OVERVIEW:

Think about some of the different ways that people use computers. In school,
students use computers for tasks such as writing papers, searching for articles, sending
email, and participating in online class. At work, people use computers to analyze data,
make presentations, conduct business transactions, communicate with customers and co-
workers, control machines in manufacturing facilities, and do many other things. At home,
people use computers for tasks such as paying bills, shopping online, communicating with
friends, and playing computer games. And don’t forget cellphones, car navigation systems,
and many other devices are computers too. The uses of computers are almost limitless in
our everyday lives.

Computers can do such a wide variety of things because they can be programmed.
This means that computers are not designed to do just one job, but to do any that their
programs tell them to do.

This chapter discusses the computer organization; number system and data
representation: number system operations, radix conversion, representation of negative
integers, non-numeric value representation and binary data access and representation.

Computer Fundamentals and Programming 2


Topic Learning Outcomes
At the end of the lesson, you will be able to:
 understand the strengths, limitations and fundamentals uses of
computer
 understand computer organization
 determine types of processor operations
 compare and understand such number systems as binary, octal,
decimal and hexadecimal number systems
 add and subtract using the binary, octal, decimal and
hexadecimal number systems
 convert whole numbers into their binary, octal, decimal and
hexadecimal equivalents
 convert real numbers into their binary, octal, decimal and
hexadecimal equivalents
 describe how negative numbers are represented
 describe how non-numeric values are represented
 discuss how data are accessed and processed

Pre-activity (Get Set)

1. Which electronic tool allows information to be input, processed and output?


2. What is an operating system?
3. What are the different components of computer system?
4. What are the different types of processor operations?
5. What is the worldwide network of computers called?
6. What is the name for the short term memory of the computer that is lost when
the computer is turned off?
7. What other than numbering is used to create ordered/unordered list in a
document?
8. What are some applications of computer?
9. Windows, Android, iOS and MacOS are all examples of?
10. Programs and their specific instructions that enable a user to interact with a
computer for a specific purpose.

Computer Fundamentals and Programming 3


Self-Assessment (Are you ready?)

Below is a list of knowledge that maybe you have encountered in your previous
computer subjects. Check the appropriate box corresponding to your agreement to
the statement using the scale given below.

5-advanced 4-Proficient 3-approaching proficiency 2-developing 1-beginning

Statements 5 4 3 2 1
I can identify the basic parts of a computer system

I can properly start and shut down a computer system


I can start and close a computer program
I can describe some common uses of computers in society
I can use a mouse/pointing device
I can create a new word processing document
I can edit, delete, save a document
I can send and receive email, including attachments
I know how to use the following apps:
a. Microsoft PowerPoint
b. Microsoft Excel
c. Microsoft Word
d. Email account
e. Google Classroom (Moodle)

Computer Fundamentals and Programming 4


Read and Learn Module
1
Lesson 1 Introduction to Computers

1.1 Strengths of Computers


The power and usefulness of this popular tool are mainly due to its following characteristics:

AUTOMATIC

An automatic machine works by itself without human intervention. Computers are


automatic machines because once started on a job, they carry out the job (normally without
a human assistance) until it is finished. However, computers being machines cannot start
themselves and cannot go out and fine their own problems and solutions. We need to
instruct a computer using coded instructions that specify exactly how it will do a particular
job. Some of the other characteristics of computers (such as speed and accuracy) are
because they are automatic and work on a problem without any human intervention.

Speed

A computer is a very fast device. It can perform in a few seconds, the amount of
work that a human being can do in an entire year, if he/she worked day and night and did
nothing else. In other words, a computer can do in a few minutes what would take a man his
entire lifetime.
While talking about the speed of a computer we do not talk in terms of seconds or
even milliseconds (10-3) but in terms of microseconds (10-6), nanoseconds (10-9), and even
picoseconds (10-12). A powerful computer is capable of performing several billion (109)
simple arithmetic operations per second.

Accuracy

In addition to being very fast, computers are very accurate. Accuracy of a computer
is consistently high and the degree of its accuracy depends upon its design. A computer
performs even calculation with the same accuracy.
However, errors can occur in a computer. These errors are mainly due to human
rather than technological weaknesses. For example, errors are mainly due to human rather
than technological weaknesses. For example errors may occur due to imprecise thinking by
a programmer (a person who writes instructions for a computer to solve a particular
problem) or incorrect input data. We often refer to computer errors caused due to incorrect
input data or unreliable programs as garbage-in-garbage-out (GIGO).

Computer Fundamentals and Programming 5


Diligence

Unlike human beings, a computer is free from monotony, tiredness, and lack of
concentration. It can continuously work for hours without creating any error without
grumbling. Hence, computers score over human beings in doing routine type of jobs that
require great accuracy. If ten millions calculations have to be performed, a computer will
perform that last one with exactly the same accuracy and speed as the first one.

Versatility

Versatility is one of the most wonderful things about a computer. One moment it is
preparing results of an examination, next moment it is busy preparing electricity bills, and in
between. It may be helping an office secretary to trace an important letter in seconds. All
that is required to change its talent is to slip in a new program (a sequence of instructions
for the computer) into it. In brief, a computer is capable of performing almost any task, if
the task can be reduced to a finite series of logical steps.

Power of Remembering

As a Human being acquires new knowledge, his/her brain subconsciously selects


what it feels to be important and worth retaining in memory. The brain relegates
unimportant details to back of mind or just forgets them. This is not the case with
computers. A computer can store and recall any amount of information because of its
secondary storage (a type of detachable memory) capability. It can retain a piece of
information as long as a user desires and the user can recall the information whenever
required. Even after several years, a user can recall exactly the same information that
he/she had stored in the computer several years ago. A computer forgets or looses certain
information only when a user asks it to do so. Hence, it is entirely up to the user to make a
computer retain or forget some information.

No IQ

A computer is not a magical device. It possesses no intelligence of its own. Its I.Q. is
zero at least until today. It has to be told what to do and in what sequence. Hence, only
users determine what tasks a computer will perform. A computer cannot take its own
decision in this regard.

No Feelings

Computers are devoid or emotions. They have no feelings and no instincts because
they are machines. Although men have succeeded in building a memory for computer, but
no computer possesses the equivalent of a human heart and soul. Based on our feelings,
taste, knowledge, and experience we often make certain judgments in our day-to-day life
whereas, computers cannot make such judgments on their own. They make judgments
based on the instructions given to them in the form of programs that are written by us
(human beings).

Computer Fundamentals and Programming 6


1.2 Limitations of Computers
Despite its various features, a computer does have the following limitations:

No Self Intelligence

Today, a computer is able to do a work which is impossible for man. Computers are
used to do risky and dangerous work and where sharp actually is needed. But it does not
have any intelligence of its own. It works according to the instruction only.

No Decision-Making power

Computer cannot take any decision of its own. It does only those tasks which are
already instructed to it.

No learning power

Computer has no learning power. Once you give instructions to a computer how to
perform a task, the very task is cannot perform if you do not give it any instructions for the
next time. For example, when you are taught how to solve a problem and if same type of
problem is given you to solve, then you can do it.

Emotionless

Computers are emotionless. They do not have emotion, like dislike feelings. They are
simply machines which work as per the instruction given to them.

Curtail human Capabilities

Although computers are great help to human beings, it is commonly felt that we
people have become so dependent on calculator that we cannot make very simple
calculation without calculator. Sometimes, find it difficult to instantly speak out even that
telephone number which they use every now and then as they have got the habit of using
them by retrieving the storage.

Computer Fundamentals and Programming 7


1.3 Fundamentals Uses of Computers
Communication

Thanks to computer and the Internet, the world has gotten much smaller in recent
years. Many people use their computers to keep in touch with friends and family using
instant messenger programs as well as email. A growing communication tool is social
networking, with sites like Face book and Twitter becoming incredibly popular.

Games

PCs have long served as recreational devices with hundreds of games available each
year. Gaming on a PC can be an expensive hobby, with video cards ranging in price from $60
to more than $400 and fully equipped gaming PCs costing in excess of $1500 in many cases.
For all the top-tier AAA titles, there are other games that users can find both pre-installed
on PCs as well as online.

Entertainment

Almost all computers come with CD or DVD disk drives, which allow you to use the
computer as a CD player or DVD player. Some computers are also capable, with the proper
hardware, of viewing and recording television onto the machine’s hard drives. With an
Internet connection, users have a nearly limitless of videos and music available online as
well.

Work

Almost every working environment uses computers in one capacity or another.


Office buildings use computers to keep track of everything from pay wages to hours logged,
retail stores use computers as cash registers and industries such as construction and
architecture use computers to help design buildings.

Computer Fundamentals and Programming 8


Lesson 2 Computer Organization

System Components

 CPU/Microprocessor
 Memory Subsystem
 I/O Subsystem

System Buses

 Address Bus
 Data Bus
 Control Bus

Instruction Cycle

 Fetch
 Decode
 Execute

Computer Fundamentals and Programming 9


Instruction Fetch

Types of I/O Organization

 Isolate I/O
 Memory-mapped I/O

CPU Organization

Types of Memory
 Static RAM
 Dynamic RAM
 ROM
 PROM
 EPROM
 EEPROM

Computer Fundamentals and Programming 10


Electronic Digital Computers

 based on stored
program design
 processor system
 CPU
 memory
 input/output system
 input/output
devices
 secondary
storage

Central Processing Unit


 manages the instruction-
execution cycle
 FETCH – DECODE – EXECUTE
 coordinates the activities of
other devices

Main Memory
 (fast access) storage device for preserving binary
data and instructions
 memory is divided into units or words
 each is usually a standard size or fixed-length
 each memory word has a unique address for
random access

 Random Access  Read Only Memory


Memory (RAM) (ROM)
 readable  readable
 writeable  permanent
 usually volatile  nonvolatile
(e.g., Dynamic  special-
RAM or DRAM) purpose
 general storage for
storage data and
instructions

Computer Fundamentals and Programming 11


The CPU and Main Memory

Inside the CPU

memory
memory
data
address
register
register

accumulator
instruction (work
register register)

program arithmetic
counter logic unit
system
clock

Computer Fundamentals and Programming 12


FETCH the instruction

1. address of the next instruction


is transferred from PC to MAR

2. the instruction is located in


memory

3. instruction is copied from memory


to MDR

Computer Fundamentals and Programming 13


DECODE the instruction

 instruction is transferred to
and decoded in the IR

EXECUTE the instruction

 control unit sends signals


to appropriate devices to
cause execution of the
instruction

Computer Fundamentals and Programming 14


Types of Processor Operations

 Data Movement  Arithmetic and Logical


Operations Operations
 moving data  integer
from memory arithmetic
to the CPU  comparing two
 moving data quantities
from memory  shifting,
to memory rotating bits in
 input and a quantity
output  testing,
comparing, and
converting bits

 Program Control
 starting a program
 halting a program
 skipping to other
instructions
 testing data to decide
whether to skip over
some instructions

Computer Fundamentals and Programming 15


Lesson 3 Number Systems and Data Representation

We are very familiar with the way the decimal number system represents numeric
characters. In this system, the base is 10 and 10 possible entries are used to represent
values. However, deep into the hardware level of machines, the computer understand only
one specific format, which is the combination of 0s and 1s called the binary number system.
To understand the inner workings of machines, we need to learn the relationship among
these number systems.

This lesson will deal with how numeric data are represented and converted from one
radix to another. Negative number representation with the use of radix and reduced radix
complement are also discussed. The code representation of alpha numeric and special
characters are also dealt with.

The last topic shows the relationship of the byte, nibble, word and double word to
the binary digit (bit).

3.1 Number Systems

Number systems are systems or styles of notations that represent quantities or


numbers. These include:

1. Decimal System – requires 10 different symbols. Hence, it is a base 10 number


system. It is unusually used today in most applicants.

2. Binary System – uses only 2 symbols, 0 and 1, and is mostly used for computer
applications. For example, 10 in the decimal systems is equal to 2 in the decimal
system.

3. Octal System – base 8 number system which is used in computer systems

4. Hexadecimal System – base 16 number system often used in assembly language


programming.

3.2 Number System Operations

The different number systems (decimal, binary, octal and hexadecimal) have their
particular addition and subtraction rules. On the other hand, numbers from one radix (or
number system) can also be converted into another by using formulas. The two most
important formulas for conversion are:

 From Decimal to any Radix: Multiply the number by its corresponding quotient by
the radix until the quotient becomes zero. Gather all remainders with the recent
remainder as most significant to the first remainder, which is the least significant.

Computer Fundamentals and Programming 16


 From any Radix to Decimal: Multiply the number by its corresponding radix weight
representation. Sum up all the radix weight representation to obtain the decimal
value.

Knowledge in radix conversion is essential, particularly in mathematics, as the


different radices offer various methods of counting, and in computer programming, as
machine language uses the 0s and 1s of the binary number system to represent numbers
and instructions. For example, the binary digit can be expressed in terms of nibble, byte,
word and double:

1 nibble = 4 bits
1 byte = 8 bits
1 word = 2 bytes
1 double = 4 bytes

These combinations of binary digits are used in calculating space for computer
storage and memory.

Other number forms and characters may be represented as follows:

 Negative numbers may be represented using absolute value representation and


complement representation. In complement representation, we can use the
radix or the reduced radix complement.
 Non-numeric values may be represented using the ASCII (American Standard
Code Information Standardization), ISO (International Organization for
Standardization), EBCDIC (Extended Binary Coded Decimal Interchange Code) and
Unicode.

3.2.1 Addition and Subtraction Rules Applied to the Decimal


Number System

Base/Radix: 10
Valid Entries: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Weighted Representation:
1234 = 1 x 103 + 2 x 102 + 3 x 101 + 4 x 100
= 1 x 1000 + 2 x 100 = 3 x 10 = 4 x 1

Computer Fundamentals and Programming 17


Addition
To add decimal numbers

 Add the lowest positional value column. Check the sum of the specifies column:

 If the sum is still a valid entry, write the sum on the same column
position.
 If the sum is not a valid entry, continuously subtract the radix until the
entry sum is valid. The carry over to the next higher positional value is
the number of times the radix was subtracted to make the entry valid.

 Continue adding the next higher positional value until all the positional values are
exhausted.

Example:

256 1st digit: 6 + 3 = 9


+ 353 2nd digit 5 + 5 = 10 (not valid) – 10 (radix) = 0
609 3rd digit 2 + 3 + 1 (carry over, subtracted radix once) = 6

result: 609

Try this . . .

Practice Exercise
Addition

1. 2563 + 3489 + 6412


2. 499 + 376 + 993
3. 158 + 929 + 653 + 459
4. 5634 + 7742 + 1153
5. 969 + 888 + 656 + 246

Computer Fundamentals and Programming 18


Subtraction
To subtract decimal numbers

 Subtract the lowest positional value column.


 If the upper digit is greater or equal to the lower digit, just write the
difference on the same column position.
 If the upper digit is less than the lower digit, borrow from the next
higher positional value. Whenever you borrow from the next higher
positional value, always borrow the radix and subtract 1 from the
higher positional value. Add the radix and the upper digit minus the
lower digit and place the difference in the same column.
 Continue the subtraction until all the positional values are exhausted.

Example:

765 1st digit: 5 - 8 (cannot be so borrow from next column)


- 328 5 + 10 (borrowed 1 which is equal to radix) – 8 = 7
437 2nd digit: 6 – 1 (borrowed) – 2 = 3
3rd digit: 7 – 3 = 4

result: 437

Try this . . .



Practice Exercise

Subtraction


 1. 10054 – 8563
 2. 8765 – 3936
 3. 4467 – 3109
 4. 7200 – 6753
 5. 8903 - 3335

Computer Fundamentals and Programming 19


3.2.2 Addition and Subtraction Rules Applied to the Binary
Number System

Base/Radix: 2
Valid Entries: 0, 1

Weighted Representation:
10012 = 1 x 23 + 0 x 22 + 0 x 21 + 1 x 20
=1x8+0x4+0x2+1x1=9

Addition of Binary Numbers

To add binary numbers

The following are the four basic rules in addition of binary numbers:

02 + 02 = 02 02 + 12 = 12
12 + 02 = 12 12 + 12 = 102

Example:

1 0 1 1 02 1st digit: 02 + 12 = 12
± 01011 2nd digit: 12 + 12 = 2 (not valid) – 2 (radix) = 02
1 0 0 0 0 12 3rd digit: 12 + 02 +12 (carry-over)
= 2 (not valid) – 2 (radix) = 02
4th digit: 02 + 12 + 12 (carry-over)
= 2 (not valid) – 2 (radix) = 02
5th digit: 12 + 02 + 12 (carry-over)
= 2 (not valid) -2 (radix) = 02
6th digit: 12 (carry-over)

Result: 1000012

Try this . . .

Practice Exercise
Addition of Binary Numbers
1. 101112 + 111102
2. 100112 + 111012
3. 1102 + 1112 + 1112 + 1112
4. 1101102 + 1111002 + 1110002
5. 10010012 + 11111112 + 10111112

Computer Fundamentals and Programming 20


Subtraction of Binary Numbers
The following are the four basic rules in subtractions of binary numbers:
02 - 02 = 02 02 - 12 = (borrow from next higher value)
12 - 02 = 1 2 12 - 1 2 = 0 2

Example:

102 1st digit: 0 – 1 = (cannot be so borrow from next position)


12 2 (radix borrowed) + 02 – 12 = 12
12 2nd digit: 12 - 12 (borrowed) = 02

result: 012

Try this . . .

Practice Exercise
Subtraction of Binary Numbers
1. 10012 - 112
2. 1011102 - 11012
3. 100002 - 112
4. 1010112 - 1112
5. 1110012 - 1012

3.2.3 Addition and Subtraction in the Octal Number System

Base/Radix: 8
Valid Entries: 0, 1, 2, 3, 4, 5, 6, 7

Weighted Representation:
14468 = 1 x 83 + 4 x 82 + 4 x 81 + 6 X 80 = 1
= 1 x 512 + 4 x 64 + 4 x 8 + 6 X 1 = 806

Computer Fundamentals and Programming 21


Addition of Octal Numbers

To add octal numbers

Addition of octal numbers is best learned by performing operation through an


example:

Example:

4 4 68 1st digit: 68 + 18 = 7
± 3 4 18 2nd digit: 48 + 48 = 8 (invalid) – 8 (radix) = 08 with carry 1
1 0 0 78 3rd digit: 48 + 38 + 18 (carry) = 8 (invalid) – 8 (radix) = 08
with carry 1
4th digit: 1 (carry-over)

result: 10078

Try this . . .
Practice Exercise
Addition of Octal Numbers
1. 37658 + 5254
2. 15678 + 64778
3. 4328 + 7668
4. 57308 + 7428
5. 33118 + 73458

Subtraction of Octal Numbers

To subtract octal numbers

The same is the case in the subtraction of octal numbers.

Example:

6 5 38 1st digit: 38 - 68 (cannot be so borrow from next position)


- 2 5 68 = 38 + 8 (radix borrowed) – 68 = 58
nd
3 7 58 2 digit: 58 – 18 (borrowed) – 58 = (cannot be so borrow)
= 48 + 8 (radix borrowed) – 58 = 78
rd
3 digit: 68 – 18 = (borrowed) – 28 = 38

result: 3758

Computer Fundamentals and Programming 22


Try this . . .
Practice Exercise
Subtraction of Octal Numbers
1. 56438 - 2358
2. 64778 - 5318
3. 3328 - 778
4. 10008 - 6328
5. 12348 - 3458

3.2.4 Addition and Subtraction in the Hexadecimal Number


System

Base/Radix: 16
Valid Entries: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Where A = 10, B = 11, C = 12, D = 13, E = 14, F = 15

Weighted Representation:
C1216 = 12 x 162 + 1 x 161 + 2 x 160
= 12 x 256 + 1 x 16 + 2 x 1 = 3090

Addition of Hexadecimal Numbers

To add hexadecimal numbers

Example:

B A 316 1st digit: 316 + 12 (value of C16) = F16 (equivalent of 15)


+ 9 2 C16 2nd digit: 10 (value of A16) + 216 = C16 (equivalent of 12)
1 4 C F16 3rd digit: 11 (value of B16) + 916 = 20 (invalid)
= 20 – 16 (radix) = 416 with carry 1
4th digit: 116 (carry-over)

result: 14CF16

Try this . . .
Practice Exercise
Addition of Hexadecimal Numbers
1. A8516 + 38916
2. CAD16 + FEE16
3. B89D16 + 362916
4. ABCD16 + CDEF16
5. AB16 + BC16 + CD16 + DE16 + EF16

Computer Fundamentals and Programming 23


Subtraction of Hexadecimal Numbers

To subtract hexadecimal numbers

Example:

8 3 716 1st digit: 716 - A16 = (cannot be so borrow from next position)
2 5 A16 = 716 + 16 (radix borrowed) – 10 (value of A16) = D16
5 D D16 2nd digit: 316 – 116 (borrowed) – 516 = (cannot be so borrow)
= 216 + 16 (radix borrowed) – 516 = D16 (equivalent of 13)
3rd digit: 816 – 116 = (borrowed) – 216 = 516
result: 5DD16

Try this . . .
Practice Exercise
Subtraction of Hexadecimal Numbers
1. C89316 – 2AB16
2. 3BBE – F2616
3. 987616 – 2ABC16
4. 1AB216 – DEC16
5. 1000016 - 934216
6.

Computer Fundamentals and Programming 24


3.3 Radix Conversion (Number System Conversion)

3.3.1 To convert decimal whole number into any radix


The following are the rules on conversion of decimal whole number to any radix:

 Divide the whole number by the radix required. Get the quotient and remainder.
 Repeatedly divide the quotient by the radix required until the quotient becomes
zero. Take note of all remainders.
 Get all the remainders, the most recent remainder is the most significant position
(msp) and the first remainder is the least significant position (lsp).

Example:

36 = __________2

Divisor Quotient Remainder


2 36 Rem 0 Lsp
2 18 Rem 0
2 9 Rem 1
2 4 Rem 0
2 2 Rem 0
2 1 Rem 1 msp
0

result: 1001002

Try this . . .
Practice Exercise

1. 506 = ____________16
2. 316 = ____________8
3. 95 = _____________2
4. 448 = ____________16
5. 426 = ____________8
6. 215 = ____________2

Computer Fundamentals and Programming 25


3.3.2 To convert decimal fraction into any radix
The fractional part is multiplied by the required radix until the fractional portion
becomes zero. The truncated whole numbers from the product are noted down such that
the first whole number product is the most significant position (msp) while the last whole
number product is the least significant position (lsp).

Examples:

1. 0.35810 = _____________2

Number Multiplicand Product

Whole number Fractional Part


0.358 2 0 msp 0.716
0.716 2 1 0.432
0.432 2 0 0.864
0.864 2 1 0.728
0.728 2 1 lsp 0.456

result: 0.35810 = 0.010112

Please note that sometimes, when we convert decimal fraction into binary fraction,
an infinite binary fraction is obtained.

2. 0.35810 = _____________8

Number Multiplicand Product

Whole number Fractional Part


0.358 8 2 msp 0.864
0.864 8 6 0.912
0.912 8 7 0.296
0.296 8 2 0.368
0.368 8 2 0.944
0.944 8 2 lsp 0.552

result: 0.35810 = 0.2672278

Computer Fundamentals and Programming 26


3. 0.35810 = _____________16

0.358 0.728 0.648 0.368 0.888 0.208


x 16 x 16 x 16 x 16 x 16 x 16
5.728 11.468 10.368 5.888 14.208 3.328

equal to B equal to A equal to E

result: 0.35810 = 0.5BA5E316

Try this . . .
Practice Exercise

1. 10.52310 = _________2
2. 30.65310 = _________8
3. 445.24610 = ________16
4. 96.3510 = __________2
5. 128.3610 = _________2
6. 644.32510 = ________16

3.3.3 To convert any whole number radix into decimal

The following are the rules in the conversion of any whole number radix into
decimal.

 Multiply the digit by its corresponding weight representation.


 Add all the weight representations to obtain the result.

Examples:

1. 1101112 = ____________10

1101112
1x20 = 1x1 = 1
1x21 = 1x2 = 2
1x22 = 1x4 = 4
0x23 = 1x8 = 0
1x24 = 1 x 16 = 16
1x25 = 1 x 32 = 32
55
result: 1101112 = 5510

Computer Fundamentals and Programming 27


2. 3 7 6 8 = _________10

6x80 = 6x1 = 6
7x81 = 7x8 = 56
3x82 = 3 x 64 = 192
254

result: 3762 = 25410

3. 8 B 8 16 = _________10

8 x 16 0 = 8 x 1 = 8
11 x 16 1 = 11 x 16 = 176
8 x 16 2 = 8 x 256 = 2048
2232

result: 8B816 = 223210

Try this . . .
Practice Exercise

1. ABC16 = _________10
2. 7768 = _________10
3. 111112 = _________10
4. B0B16 = _________10
5. 4278 = _________10
6. 1011111 = _________10

Computer Fundamentals and Programming 28


3.3.5 To convert any fraction radix into decimal

The following are the rules in the conversion of any fraction radix into decimal.

 Multiply the digit by its corresponding weight value


 Add up the weight values to get the result

Examples:

1. 0.7 2 3 8 = _________10
3 x 8 -3 = 3x1 = 0.0058593
2 x 8 -2 = 2 x 16 = 0.03125
-1
7 x 8 = 7 x 256 = 0.875
0.9121093
result: 0.7238 = 0.912109310

2. 0.1 1 0 1 2 = _________10
1 x 2 -4 = 1 x 0.0625 = 0.0625
0 x 2 -3 = 0 x 0.125 = 0.0
1 x 2 -2 = 1 x 0.25 = 0.25
1 x 2 -1 1 x 0.5 = 0.5
0.8125

result: 0.11012 = 0.812510

3. 0.B 2 B 16 = _________10
11 x 2 -3 = 11 x 0.0002441 = 0.0026851
2 x 2 -2 = 2 x 0.0039063 = 0.0078126
11 x 2 -1 = 11 x 0.25 = 0.6875
0.6979977
result: 0.B2B16 = 0.6979977 10

Try this . . .
Practice Exercise

1. 10.3328 = __________10
2. 2A.6B16 = __________10
3. 100.10012 = ________10
4. 124.5658 = _________10
5. C95.25616 = ________10
6. 101.1012 = _________10

Computer Fundamentals and Programming 29


3.3.6 To convert from any radix number into another
radix other than decimal

The following are the rules of conversion from any radix number into another radix
other than decimal.

 Convert the given radix number to decimal number.


 The result in decimal is converted to the required radix number.

Examples:

1. 1101112 = ____________8

A B B Equivalent AxB
1 20 1 1
1 21 2 2
1 22 4 4
0 23 8 0
1 24 16 16
1 25 32 32
Total 5510

result: 1101112 = 5510

Number Divisor Quotient Remainder


55 8 6 7 lsp
6 8 0 6 msp

result: 5510 = 678

Shortcut:

Each octal digit is equivalent to three binary digits. Group all binary digits by
three’s starting from the rightmost to the leftmost digit, then add their corresponding
weighted value.

110 1 1 12
weighted value 4 2 1 4 2 1
6 7

Computer Fundamentals and Programming 30


2. 1101112 = ____________16

Convert 1101112 into decimal

A B B Equivalent A*B
1 20 1 1
1 21 2 2
1 22 4 4
0 23 8 0
1 24 16 16
1 25 32 32
Total 55

Convert 5510 into hexadecimal

16 55 Rem 7 lsp
16 3 Rem 3 msp
0

Shortcut:

Each hexadecimal value is equivalent to four binary digits. Group the binary digits
into groups of four starting from the rightmost digit towards the leftmost digit. Add their
corresponding weighted values.

0011 0 1 1 12
weighted value 0 4 2 1 8 4 2 1
3 7

3. 1238 = ____________2

First, convert 1238 into decimal and then convert the result computed into binary.

1 2 3 8 = _________10

3x80 = 3x1 = 6
2x81 = 2x8 = 16
1x82 = 1 x 64 = 64
83
8310 = ____________2

Computer Fundamentals and Programming 31


2 83 Rem 1 Lsp
2 41 Rem 1
2 20 Rem 0
2 10 Rem 0
2 5 Rem 1
2 2 Rem 0
2 1 Rem 1 msp
0

result: 10100112

Shortcut:

An octal digit is equivalent to three binary digits; hence, we have to assign three
binary digits per octal digit. The three binary digits have weighted values of 4, 2, and 1,
respectively. Place the value 1 on all weighted values needed to come up with equivalent
octal digit, otherwise, put the value zero.

1 2 3
001 010 011
weighted value 4 2 1 4 2 1 4 2 1

result = 10100112

4. BED16 = ____________2

Convert BED16 into decimal

B E D 16
A B A*B
0
D = 13 16 = 1 13
E = 14 161 = 16 224
B = 11 162 = 256 2816
TOTAL 3053

Computer Fundamentals and Programming 32


Convert 305310 into binary

2 3053 Rem 1 lsp


2 1526 Rem 0
2 763 Rem 1
2 381 Rem 1
2 190 Rem 0
2 95 Rem 1
2 47 Rem 1
2 23 Rem 1
2 11 Rem 1
2 5 Rem 1
2 2 Rem 0
2 1 Rem 1 msp
0

result: 1 0 1 1 1 1 1 0 1 1 0 1 2

Shortcut:
Each hexadecimal value is equivalent to four binary digits. Break each hexadecimal
digit into four binary digits each. The weighted values of the four binary digits are 8, 4, 2,
and 1, respectively. Put the value 1 to all weights needed to come up with the equivalent
value, otherwise, put the value zero.

B E D
1011 1110 1101
weighted value 8 4 2 1 8 4 2 1 8 4 2 1

result = 1011111011012

Try this . . .
Practice Exercise

1. 1011112 = _____________8
2. 11011011102 = _____________16
3. 2468 = _____________2
4. 3658 = _____________16
5. 45F16 = _____________2
6. 4CD316 = _____________8
7. 111011112 = _____________8
8. 11100111112 = _____________16
9. 35368 = _____________2
10. 45678 = _____________16
11. B2C416 = _____________2
12. F56316 = _____________8

Computer Fundamentals and Programming 33


3.4 Representation of Negative Integers

There are two ways of representing negative numbers: absolute value


representation and complement representation.

3.4.1 To represent negative numbers through absolute


value representation

The absolute value representation uses an eight-bit representation where the first bit
corresponds to the sign and the last seven bits to the value of the number. A value of 1 in
the first bit means negative while a zero value represents a positive value.

Example:

-15 is represented as
1 0 0 0 1 1 1 1

+15 is represented as
0 0 0 0 1 1 1 1

Limitations:

1. Only numbers from -127 to +127 will be represented, hence limited.


2. Zero may be represented as 100000002 or 000000002 which makes it complicated.

Computer Fundamentals and Programming 34


3.4.2 To represent negative numbers through complement
value representation

The two types of radix complements are radix complement and reduced radix complement.

Types of Radix Decimal Complement Binary Complement Negative Binary


Complement Number
Reduced Radix 9’s complement 1’s complement 1’s complement
Complement results in subtracting
results in subtracting Get the 1’s
the highest possible the highest possible complement of the
value from the given digit from the given number and affix a 1
number. number. on the 8th bit.
Ex. 25610 Ex. 10112 Ex. -9610 = 11000002
to get 1’s comp:
999 11112
- 256 -10112 1 1 1 1 1 1 12
743 9’s comp 01002 1’s comp -1 1 0 0 0 0 02
+ 1 1 0 0 1 1 1 1 12
1012 2’s comp
affix 1 on the 8th
bit
Radix Complement 10’s complement 2’s complement 2’s complement
is the addition of the is the addition of the Get the 2’s
constant 1 to the 9’s constant 1 to the 1’s complement of the
complement. complement: positive number and
Ex. 25610 Ex. 10112 affix a 1 on the 8th bit
743 9’s comp 01002 1’s comp Ex. -9610 = 11000002
+ 1 + 1 The 1’s complement
744 10’s comp 01012 2’s comp of 9610 is:
00111112
+ 12
01000002 2’s comp
101000002

affix 1 on the
th
8 bit

Computer Fundamentals and Programming 35


3.5 Non-Numeric Value Representation

The character codes are usually represented as one byte or 8 bits. They can be
represented using the following:

ASCII (American Standard Code for Information Interchange)

It was established by the American National Standard Institute (ANSI) in 1962.

Parity bit bit representing alpha, numeric and special character

ISO (International Organization for Standardization) Code

It was established by ISO in 1967 containing a 7-bit character code based on the SCII
code. Considered the base of character codes all over the world.

EBCDIC (Extended Binary Coded Decimal Interchange Code)

The EBCDIC was the character code developed by IBM for all its IBM computers. It
became a “de facto” standard because of the large number of users using IBM.

Unicode

The Unicode was proposed and designed by US companies to allow compatibilities


an easy exchange of data among PCs.

Computer Fundamentals and Programming 36


3.6 Binary Data Access and Representation
The binary digit can be accessed, processed and presented either as a bit, nibble,
byte, word or a double word.

Table 3.1 Binary Digit Representation

Bit = A binary digit which can either be a 0 or a 1


Nibble = 4 bits
Byte = 8 bits
= 2 nibbles
Word = 2 bytes
= 4 nibbles
= 16 bits
= usually the size of the data bus for processor
Double = 2 words or vary depending on processor
Word = 4 bytes
= 8 nibbles
= 32 bits

Computer Fundamentals and Programming 37


SUMMARY
 A number system is a way of representing a number. Every number system has a
base (the number of digits available).

 A number system does not change the value of the number, but only the manner in
which it is represented.

 The decimal system is a positional-value system in which the value of a digit depends
on its position.

 The decimal point separates the positive powers of 10 from the negative powers.

 The binary system is positional-value system, wherein each binary digit has its own
value or weight expressed as a power of 2.

 The hexadecimal number system is known as the base-16 number system, because
each position in the number represents an incremental number with a base of 16.

KEYWORDS

Binary System: It is a positional-value system, where in each binary digit has its own value
or weight expressed as a power of 2.

Digital Systems: Digital systems process digital signals which can take only a limited number
of values (discrete steps) usually just two values are used: the positive supply voltage (+Vs)
and zero volts (0V).

Hexadecimal Number System: It is known as the base-16 number system, because each
position in the number represents an incremental number with a base of 16.

Number System: It is a basic counting various items. On hearing the word number all of us
immediately think of the familiar decimal number system with its 10 digit: 0, 1, 2, 3, 4, 5, 6,
7, 8, and 9.

Octal: The octal, or base 8, number system is a common system used with computers.
Because of its relationship with the binary system, it is useful in programming some types of
computers.

Computer Fundamentals and Programming 38


You connect . . .

. . . with the class

 Submission of activity to Moodle/Google classroom

 Active participation in an open discussion using Google Meet/Facebook


Messenger

. . . with the world

 IMTS (International Institute of Management & Technology Studies)


A Genius Group Global Initiative (www.iimts.com)
3G University (www.3gu.edu.in)
Computer Fundamental. 3G Elearning FZ LLC (www.3glearning.com), UAE.

 Osergaard, Erik. (10 March 2003). Computer data representation and number
systems.
Online Available: http://www.danbbs.dk/~erikoest/binary.htm.

 Albano, Gisela May A., Atole, Ronnel R., Ariola, Rose Joy Y. (2003).
Introduction to Information Technology. Philippines: Trinitas Publishing, Inc.

 www.google.com

Computer Fundamentals and Programming 39


Do this . . .

Main Task

Define and discuss the following:

1. Binary Number System


2. Decimal Number System
3. Octal Number System
4. Hexadecimal Number System
5. Radix
6. Most Significant Positions (MSP)

Computer and convert the following numbers based on the radix required:

ADDITION BINARY OCTAL DECIMAL HEXADECIMAL


10111012 10111012 5. 9. 13.
42638 1. 42638 10. 14.
100110 2. 6. 100110 15.
76BC16 3. 7. 11. 76BC16
SUM 4. 8. 12. 16.

SUBTRACTION BINARY OCTAL DECIMAL HEXADECIMAL


11101102 11101102 19. 22. 25.
BE16 17. 20. 23. BE16
DIFFERENCE 18. 21. 24. 26.

Computer Fundamentals and Programming 40


Look back . . . share your thoughts

Computer Fundamentals and Programming 41

You might also like