0% found this document useful (0 votes)
7 views29 pages

Computer Fundamentals & Programming Module

The document is an approval sheet for the instructional material titled 'Learning Module in Computer Fundamentals and Programming' compiled by Charmaine D. De Guzman for the Occidental Mindoro State College. It outlines the course description, goals, outcomes, and syllabus for the course, including topics such as programming basics, algorithm development, and C++ programming. Additionally, it specifies grading policies, attendance requirements, and course evaluation methods.

Uploaded by

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

Computer Fundamentals & Programming Module

The document is an approval sheet for the instructional material titled 'Learning Module in Computer Fundamentals and Programming' compiled by Charmaine D. De Guzman for the Occidental Mindoro State College. It outlines the course description, goals, outcomes, and syllabus for the course, including topics such as programming basics, algorithm development, and C++ programming. Additionally, it specifies grading policies, attendance requirements, and course evaluation methods.

Uploaded by

delacruzjocen16
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Republic of the Philippines

OCCIDENTAL MINDORO STATE COLLEGE


Labangan, San Jose, Occidental Mindoro
website: [Link] email address: omsc_9747@[Link]
Tele/Fax: (043) 457-0231 CERTIFIED TO ISO 9001:2015
CERT. NO.: 50500643 QM15

APPROVAL SHEET

This Instructional Material entitled LEARNING MODULE IN COMPUTER


FUNDAMENTALS AND PROGRAMMING, compiled by CHARMAINE D. DE
GUZMAN (A.Y. 2020-2021), is recommended for production and utilization by the
students and faculty members of the Occidental Mindoro State College.

PANEL OF EVALUATORS

Local Evaluation Committee

College of Architecture, Engineering and Technology


Allied Courses

ENGR. ABIGAIL N. GONZALES, MSEE ENGR. NOEL C. PRIMERO, MT


Member Member

ENGR. MICHELLE D. ENRIQUEZ, MSCE, MPA


Chairperson

Overall Instructional Materials Development Committee

VENESSA S. CASANOVA, PhD MA. IMELDA C. RAYTON, MAEd


Member Member

Recommending Approval:

JESSIE S. BAROLO, JR., MAEd


Chairperson

Approved:

ELBERT C. EDANIOL, EdD


Vice President for Academic Affairs
REPUBLIC OF THE PHILIPPINES
OCCIDENTAL MINDORO STATE COLLEGE
Labangan, San Jose, Occidental Mindoro 5100
Website: [Link] Email address: omsc_9747@[Link]
Tele/Fax: (043) 491-1460

College of Architecture Engineering and Technology


MAIN CAMPUS

BACHELOR OF SCIENCE IN CIVIL ENGINEERING


BACHELOR OF SCIENCE IN ELECTRICAL ENGINEERING
BACHELOR OF SCIENCE IN INDUSTRIAL ENGINEERING

OBE COURSE SYLLABUS

OMSC VISION
A premier higher education institution that develops globally competitive, locally responsive, innovative professionals and life-long learners.
OMSC MISSION
OMSC is committed to produce intellectual and human capital by developing excellent graduates through outcomes-based instruction, relevant research, responsive technical
advisory services, community engagement, and sustainable production.
COLLEGE OF ARCHITECTURE, ENGINEERING AND TECHNOLOGY GOAL
To provide advance knowledge in Architecture, Engineering & Technology, technical skills, and appropriate work ethics among the students with the aim of improving the quality of
life in the province of Occidental Mindoro, and be of help to boost the economic stability of the country and the ASEAN region.

COURSE TITLE : COMPUTER FUNDAMENTALS AND PROGRAMMING


COURSE DESCRIPTION :
Basic information technology concepts; fundamentals of algorithm development; high-level language and programming applications; computer solutions of engineering problems.
COURSE CODE : CAE 122
CREDIT UNITS : 2
PREREQUISITE/S : None
PROGRAM GOAL:

i
The Bachelor of Science in Civil Engineering aims to produce competent civil engineers capable of embracing services such as consultancy, design, preparation of plans and
specifications, construction and supervision of projects in government or private sector projects.

The Bachelor of Science in Electrical Engineering shall provide the students with an education in the fundamentals of Electrical Engineering that will allow them to be immediately
competitive in the industry or in graduate work while providing the best opportunity for achieving full potential. Develop a sense of professional responsibility and social awareness.
Provide practical applications and hand-on work as evidence by laboratory, design, project study, computer exercises and practicum courses. These would help the student to work
well whether independently or as part of a group.

The Bachelor of Science in Industrial Engineering is intended the student for a professional Industrial Engineering career including a leading role in design, improvement and
installation of integrated system of people, materials, information, equipment and energy. Graduates of the program must have specialized knowledge and skills in the mathematical,
physical and social science together with the principle methods of engineering analysis and design to specify, predict, and evaluate the result to be obtained from such system.
PROGRAM OUTCOMES:
BSCE
 Apply knowledge of mathematics and science to solve complex civil engineering problems.
 Know and understand engineering and management principles as a member and leader of a team, and to manage projects in a multidisciplinary environment.
BSEE
 Ability to apply techniques, skills, and modern engineering tools necessary for electrical engineering practice.
BSIE
 Ability to apply knowledge of mathematics and science to solve complex industrial engineering problems
 Ability to use techniques, skills, and modern engineering tools necessary for engineering practice
COURSE OUTCOMES:
After completing this course, the student must be able to:

1. Understand basic information technology concepts;


2. Use application software and the Internet property;
3. Acquire proficiency in algorithm development using high level-programming language;
4. Use high level language and programming applications in solving electrical engineering problems.

COURSE OUTLINE
Orientation of the students on the updates on the VMGO and Core Values of the Institution ( 1hour)
Orientation of the Students on the importance of gender equality and increase their awareness on the new accepted genders in society ( 1 hour)
Desired Learning Course Content Textbooks/References Teaching / Learning
Week Resource Materials Assessment
Outcomes Activities

ii
 Recognize what is a LESSON 1.  Gaddis, T. ONLINE  Laptop  Quiz #1:
program and its use. Introduction to Computers (2011). Starting Out  Video Lecturing  Internet Programming
 Identify the Computer and Programming with C++: From  Video Connection languages
systems.  Why Program? Control Structure to Demonstration  Quiz #2: What
 Distinguish the different  Computer Systems: Objects. Addison- is a program
programs and Hardware and Wesley Publishing MODULE made of?
programming Software Company.  Module Lectures
languages.  Programs and  Task 1: Reaction
1-2 Programming
 Identify the Paper about the
programming process Languages video to be send
and its flow.  What Is a Program online.
Made of?
 Input, Processing,
and Output
 The Programming
Process
 Identify what is Binary LESSON 2. Number  Harle, R. (2015). ONLINE  Laptop  Quiz #3:
Numbers. System and Data Computer  Video Demonstration  Internet Conversion of
 Predict how to add Representation Fundamentals.  Video Lecturing Connection Binary numbers
binary numbers.  Binary Numbers Number System. 2-  Quiz #4:
 Laboratory Activity:
 Identify how to convert  Converting Binary 47 Adding,
to Decimal #1. Hexadecimal to
binary to decimal Subtracting,
numbers and vice versa. Numbers and vice Color Multiplying and
versa Dividing Binary
3-4  Adding, MODULE Numbers
Subtracting,  Module Lectures  Laboratory
Multiplying and  Task 2: Conversion Activity thru
Dividing Binary Binary to Photoshop web
Numbers Hexadecimal app
 Hexadecimal ([Link]
System [Link]/
) to be uploaded

iii
to
[Link]

 Determine the parts of a LESSON 3. Introduction to  Gaddis, T. ONLINE  Laptop


C++ program. C++ (2011). Starting Out  Video Demonstration  Internet  Quiz #5:
 Recognize the use cout  The Parts of a C++ with C++: From  Video Lecturing Connection Introduction to
object, #include directive Program Control Structure to  C++
Laboratory Activity
 Identify the use  The cout Object Objects. Addison-  Laboratory
 The #include #2. Simple Text
variables, identifiers, Wesley Publishing Activities in Dev
data types and char data Directive Company. display C++
type.  Variables and the  Laboratory Activity:
 Distinguish the use of Assignment #3. Char & String
string class, arithmetic Statement Class
operators, comments,  Identifiers
5-6
and programming style.  Integer Data Types
 The char Data Type MODULE
 The C++ string  Module Lectures
Class  Task 3: Debug a
 Determining the program
Size of a Data Type  Task 4: Debug a
 Arithmetic program
Operators  Task 5: Predict the
 Comments Output
 Programming Style

 1. LESSON 4. Expression and 


Determine the use of cin Gaddis, T. ONLINE  Quiz #6. cin
object. Interactivity (2011). Starting Out  Video Lecturing  Laptop object
 Recognize the  The cin object with C++: From  Video  Internet  Laboratory
mathematical  Mathematical Control Structure to Demonstration Connection activity using
7-8 Expressions
expression and its use. Objects. Addison-  Laboratory Activity: Dev C++
 Learn how to use type  Type Casting Wesley Publishing #4. Data Entry  Chapter Quiz:
casting.  Multiple Company. Chapters
Assignment and 1,2,3,4

iv
 Learn how to assigned Combined  Laboratory Activity:
multiple and combined Assignment #5. Arithmetic
assignment.  Working with Operators
 Identify the characters Characters and
and string objects. string objects MODULE
 Module Lectures
 Task 6: Predict the
output
 Task 7: Debugging a
program

MIDTERM EXAMINATION
 Distinguish the relational LESSON 5. Making  Gaddis, T. ONLINE  Laptop  Quiz #7: If and
operators. Decisions (2011). Starting Out  Video Demonstration  Internet if else statement
 Identify how to use if, if  Relational with C++: From  Video Lecturing Connection  Quiz #8:
else, if else if, and Operators Control Structure to  Predicting the
Laboratory Activity:
nested if statements.  The if statement Objects. Addison- Ouptut
 The if/else Wesley Publishing #6. If statement
 Recognize the logical  Quiz #9: Logical
operators. statement Company.  Laboratory Activity: operators and
 Familiarize with the use  Nested if #7. If/else statement switch
of switch statement. statements  Laboratory Activity: statement
 The if/else if #8. if else if  Laboratory
9-10 statement activity using
statement
 The Logical Dev C++
Operators  Laboratory Activity:
 The Switch #9. Switch statement
statement
MODULE
 Module Lectures
 Task 8: Relational
Operators
 Task 9: Debug a
program

v
 Task 10: Create a
program using if
statement
 Task 11: Predict
the output of switch
statement

 Identify the increment LESSON 6. Loops  Gaddis, T. ONLINE  Laptop  Quiz #10: While
and decrement  The Increment and (2011). Starting  Video Demonstration  Internet and Do while
operators. Decrement Out with C++: From  Video Lecturing Connection loop
 Recognize the while Operators Control Structure to  Quiz #11: For
 Laboratory Activity:
loop and for input  The While loop Objects. Addison- loop and Nested
 Using while loop for #10. While Loop
validation. Wesley Publishing loops
 Determine the use of do input validation Company.  Laboratory Activity:  Laboratory
while loop and its  The do-while loop #11. Do while loop activity using
difference to while loop.  The for loop  Laboratory Activity: Dev C++
 Familiarize with for loop. #12. For loop

11-12 MODULE
 Module Lectures
 Task 12: Predicting
the Output
 Task 13: Debug a
program
 Task 14: Create a
program using
while loop
 Task 15: Create a
program using do
while loop

vi
 Task 16: Predicting
the output of for
loop
 Recognize array and LESSON 7. Arrays  Gaddis, T. ONLINE  Laptop  Quiz #12:
how it holds a value  Arrays Hold (2011). Starting Out  Video Demonstration  Internet Arrays
 Identify array elements Multiple Values with C++: From  Video Lecturing Connection  Laboratory
and its initialization  Accessing Array Control Structure to activity using
 Laboratory Activity
 Distinguish the two- Elements Objects. Addison- Dev C++
 Array Initialization Wesley Publishing #13: One-
13-14 dimensional array and
its difference to one  Two-Dimensional Company. dimensional Array
dimensional. Arrays
 Identify arrays with  Arrays with Three MODULE
three or more or More  Task 17: Predicting
dimensions Dimensions the Output
FINAL EXAMINATION
SUGGESTED LEARNING RESOURCES
Harle, R. (2015). Computer Fundamentals. Number System.
Gaddis, T. (2011). Starting Out with C++: From Control Structure to Objects. Addison-Wesley Publishing Company

Other Readings/References:
a. Online References
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
 Group/Individual projects
 Group/Individual reports/Assignments
COURSE REQUIREMENTS  Complete submission of final outputs
 Written examinations

vii
Learning Activities = 40%
Mid-term ∕ Final Examination = 60%
GRADING SYSTEM
100%
Final Rating = Mid -Term (40%) + Final Term (60%)

Attendance:
1. Students having twelve (12) absences without valid reasons will be dropped from the class. Students are required to
present admit to class slip from the Office of Student Affairs and Services after being absent in the previous meeting.
2. Three (3), not necessarily consecutive, tardiness without further notice is equivalent to one (1) absence.
COURSE POLICIES
Incomplete Grade:
1. Students who were not able to take the midterm/final examinations will receive an incomplete grade.
2. Incomplete grade should be complied within one year.

Prepared by: Noted: Approved:

ENGR. MICHELLE D. ENRIQUEZ, MSCE


Program Head, BSCE
ELBERT C. EDANIOL, EdD.
CHARMAINE D. DE GUZMAN, MSIT Vice President for Academic Affairs
Instructor I

________________________ ________________________
Date Date

viii
ENGR. CHARMINE SHEENA S. SAFLOR, MSIE
Program Head, BS Industrial Engineering

Recommending Approval:

MICHELLE D. ENRIQUEZ, MSCE, MPA


College Dean

________________________
Date

ix
PREFACE

College Education demands skills development that prepare students for


employment both locally and globally. In this regard, provide advance knowledge in,
technical skills, and appropriate work ethics among the students with the aim of
improving the quality of life in the province of Occidental Mindoro, and be of help to boost
the economic stability of the country and the ASEAN region.

This learning module is divided into seven lessons introduces the basic
information technology concepts; fundamentals of algorithm development; high-level
language and programming applications; computer solutions of engineering problems.
C++ (pronounced see plus plus) is a general purpose programming language that is free-
form and compiled. It is regarded as an intermediate-level language, as it comprises both
high-level and low-level language features. It provides imperative, oriented and generic
programming features.

This module can also be used as course material for introduction to fundamentals
computer and programming in other colleges. There is no doubt that this module will be
useful to all categories of readers. In case of any suggestion for improvement of this
module you may email charmainedeguzman15@[Link].

Charmaine D. De Guzman, MSIT


Table of Contents

Introduction to Computers and Programming.................................................................. 1


Why Program?................................................................................................................. 1
Computer Systems: Hardware and Software .................................................................. 3
Programs and Programming Languages ......................................................................... 7
What Is a Program Made of? ........................................................................................ 10
Input, Processing, and Output ...................................................................................... 14
The Programming Process............................................................................................. 15
Number System and Data Representation...................................................................... 19
Binary Numbers ............................................................................................................. 19
Converting Binary to Decimal Numbers and vice versa ................................................ 20
Adding, Subtracting, Multiplying and Dividing Binary Numbers .................................. 24
Hexadecimal System ..................................................................................................... 30
Introduction to C++ .......................................................................................................... 34
The Parts of a C++ Program ........................................................................................... 34
The cout Object ............................................................................................................. 39
The #include Directive ................................................................................................... 44
Variables and the Assignment Statement..................................................................... 48
Identifiers ...................................................................................................................... 51
Integer Data Types ........................................................................................................ 53
The char Data Type........................................................................................................ 55
The C++ string Class ....................................................................................................... 57
Determining the Size of a Data Type ............................................................................. 59
Arithmetic Operators .................................................................................................... 60
Comments ..................................................................................................................... 64
Programming Style ........................................................................................................ 66
Expression and Interactivity ............................................................................................ 70
The cin object ................................................................................................................ 70
Mathematical Expressions ............................................................................................ 75
Type Casting .................................................................................................................. 82
Multiple Assignment and Combined Assignment ......................................................... 84
Working with Characters and string objects ................................................................. 86
Making Decisions.............................................................................................................. 89
Relational Operators ..................................................................................................... 89
The if statement ............................................................................................................ 94
Program Output 2 ......................................................................................................... 97
The if/else statement .................................................................................................... 98
Nested if statements ................................................................................................... 102
The if/else if statement ............................................................................................... 107
The Logical Operators ................................................................................................. 112
The Switch statement ................................................................................................. 118
Loops ............................................................................................................................... 126
The Increment and Decrement Operators .................................................................. 126
The While loop ............................................................................................................ 132
Using while loop for input validation .......................................................................... 137
The do-while loop........................................................................................................ 140
The for loop ................................................................................................................. 143
Arrays .............................................................................................................................. 150
Arrays Hold Multiple Values ........................................................................................ 150
Accessing Array Elements ........................................................................................... 152
Array Initialization ....................................................................................................... 156
Two-Dimensional Arrays ............................................................................................. 161
Arrays with Three or More Dimensions ...................................................................... 165
REFERENCES .................................................................................................................... 166
2
Number System and Data
Representation

TOPICS

2.1 Binary Numbers


2.2 Converting Binary to Decimal Numbers and vice versa
2.3 Adding, Subtracting, Multiplying and Dividing Binary Numbers
2.4 Hexadecimal System

LEARNING OUTCOMES

At the end of the lesson, you should be able to:


1. identify what is Binary Numbers;
2. predict how to add binary numbers;
3. identify how to convert binary to decimal numbers and vice versa.

2.1 Binary Numbers

IDEA: The binary number system, also called the base-2 number system, is a
method of representing numbers that counts by using combinations of
only two numerals: zero (0) and one (1).
A bit (Binary digit) is merely 0 or 1
 It is a unit of information since you cannot communicate with anything less than
two states
 The use of binary encoding dates back to the 1600s with Jacquard's loom, which
created textiles using card templates with holes that allowed needles through

Digital computers are made up of electronic circuits, which have exactly 2 states: on
and off.

19
A binary digit or bit can take on only these two values.

Low Voltage = 0
High Voltage = 1 all bits have 0 or 1

Binary numbers are built by concatenating a string of bits together.


Example: 101010101

Each digit in a binary number if called a BIT, 4 bits form a NIBBLE, 8 bits form a
BYTE, 2 bytes form a WORD, 2 words form a DOUBLE WORD.

DECIMAL SYSTEM BINARY SYSTEM


0 0
1 1
2 10
3 11
4 100
5 101
6 110

Based two

Highest bit Lowest bit


128 x 2 64 x 2 32 x 2 16 x 2 8x2 4x2 2x2 1x2
1 1 1 0 0 1 0 1 0 1
… 256 128 64 32 16 8 4 2 1

Converting Binary to Decimal Numbers and


2.2 vice versa
IDEA: An easy method of converting decimal to binary number equivalents is
to write down the decimal number and to continually divide-by-2 (two)
to give a result and a remainder of either a “1” or a “0” until the final
result equals zero. Only two numerals: zero (0) and one (1).

20
It is often required to convert a number in a particular number system to any other
number system, e.g., it may be required to convert a decimal number to binary. The
reverse is also true, i.e., a binary number may be converted into decimal and so on.

 BINARY NUMBERS TO DECIMAL NUMBERS

In converting binary number, all you have to remember that 0-represents a false
condition and 1- represents true. Meaning all you have to take is the true condition which
is 1. Don’t forget to start to count from the lowest bit which is in the right.

BINARY NUMBER DECIMAL NUMBER


1111 15

All you have to do is to add all the binary which is in true condition. Now let’s try with
a combination of 0.

BINARY NUMBER DECIMAL NUMBER


110011 51

You’re going to get only the value which is in true condition.


 DECIMAL NUMBER TO BINARY NUMBER

21
Now to convert a number in decimal to a number in binary we have to do the same
method just like converting binary to decimal. But this time you have to start with the
largest bit near to the decimal number you want to convert.

DECIMAL NUMBER BINARY NUMBER


23 10111

This time we started at the largest bit which is 16. Our decimal value to convert is
23, we cannot go far aside from 16 because the next one will be 32 bit value which is more
than 23.
NOTE: Get first the largest bit which is near but not more than to your decimal
number, and then start to add another bit until reached the equal
number.

DECIMAL NUMBER BINARY NUMBER


34 100010

In here we started at the largest bit which is 32 (near but not more that to 34) and
then we start adding another bit to get exact value which is 34.

22
ASSESSMENT

Assessing your knowledge of converting the binary to decimal and vice versa.

I. Convert the following Binary Number to Decimal Number.

BINARY NUMBER DECIMAL NUMBER


1001111
1101011
100101
111010
010011
11001101
110011
11111
100001
11011111

II. Convert the following Decimal Number to Binary Number

DECIMAL NUMBER BINARY NUMBER


88
55
100
40
96
87
51
250
128
170

23
Adding, Subtracting, Multiplying and Dividing Binary
2.3 Numbers
IDEA: Binary arithmetic is essential part of all the digital computers and
many other digital system.

In Binary numbers were introduced, as well as the techniques of their addition and
subtraction. This package covers the methods of multiplication and division but to begin,
here is a reminder of the rules of binary addition and subtraction.

 ADDITION

In the given example, 110 + 111 the answer is 1101.


You have to remember the given binary addition rules and
simply apply it. You have to start from the lowest bit (right)
to largest bit (left).
0+1=1
1 + 1 = 0 (you have to carry a 1 to the next left bit)
At the third row, get first the answer of the carried
binary, and the result will be added to the given binary
number. 1 (carried number) + 1 = 0 (and carry another 1 to
the next bit at the left, now zero becomes your carried
number) + 1 = 1. Bring down the carried binary number.

Checking:

Now, for you to check if you’ve got the


right binary number. You have to convert it to
decimal.
In the given question 110 + 111 is
converted to decimal as 6 + 7 and you got the
correct answer which is 1101 converted to
decimal as 13.

24
 SUBTRACTION

In the given example, 1110 - 1100 the


answer is 0010. You have to remember the
given binary subtraction rules and simply apply
it. You have to start from the lowest bit (right)
to largest bit (left).
0–0=0
1–0=1
1–1=0
1–1=0

Checking:

Now, for you to check if you’ve


got the right binary number. You have
to convert it to decimal.
In the given question 1110 -
1100 is converted to decimal as 14 - 12
and you got the correct answer which is
10 converted to decimal as 2.

25
Working with borrow:

In the given 10111 – 1110, again apply the rules.


Start with the lowest bit.
1–0=1
1–1=0
1–1=0
0 – 1 = cannot be subtract 0 to 1, so you have to
borrow to the next larger bit. (You always give 2
ones at the first borrow if ever that the previous
bit needs also a value.)
Now the value of the largest bit (at the left)
becomes 0 and you may or may not write it
down because it has no value. So the answer
may be written as 01001 or 1001.

At this example, 1101 – 110.


1–0=1
0 – 1 = cannot be subtract 0 to 1. So you have to
borrow a value at the next larger bit. Giving 2 ones.
That will become 11 (2) – 1 = 1
0 – 1 = this is the bit that we get borrowed so the
value of this is now 0, again you cannot subtract 0
to 1, so you have to borrow again to the next larger
bit. And repeat the method.

26
 MULTIPLICATON
The multiplication process for binary numbers is similar to decimal numbers. Partial
products are formed, with each product shifted one place to the left.

The third row is the multiplication of 111 by 1. In the


fourth row, the 0 is the shift left before 111 is
multiplied by 0. In the fifth row, the 00 is the shift left
before 111 is multiplied by 1. The final row is the
binary sum of the preceding three rows.

NOTE: Just copy the multiplicand if the multiplier is 1.

Checking:

Now, for you to check if you’ve got the right binary


number. You have to convert it to decimal.
In the given question 111 x 101 is converted to decimal
as 7 x 5 and you got the correct answer which is 100011
converted to decimal as 35.

 DIVISION
Binary division follows a similar process to that of decimal division.

27
The given is 1010 divided to 101 the answer is 10.
Steps:
1. Get first dividend the same number of bit to
divisor. Example the divisor is 101, you must get 3 bits in
dividend which is 101.
2. Follow the rules, the dividend is equal to divisor
(101 = 101) so the answer is 1. To be place also at the top
in line with the second lowest bit.
3. Multiply the quotient to the divisor and then subtract.
4. Now you have the reduced dividend which is 0000. The reduced
dividend is lesser than the divisor so the answer is 0.

To divide binary numbers, start by setting up the binary division problem in long division
format. Next, compare the divisor to the first digit of the dividend. Tack on the next digit
and repeat until you get a 1, then find the remainder.

28
ASSESSMENT

Testing your understanding of binary operation of addition, subtraction, multiplication,


and division.

I – ADDITION

1.) 101111 2.) 101010 3.) 110100 4.) 11111


+ 101011 + 100001 + 111011 + 111000

5.) 101101
+ 110010

II – SUBTRACTION

6.) 1100011 7.) 1101010 8.) 1110101 9.) 1001101


- 100100 - 101101 - 111001 - 100101

10.) 1100000
- 101010

III – MULTIPLICATION

11.) 10001 12.) 1111 13.) 1011011 14.) 101101


x 101 x 111 x 101 x 110

14.) 101101 15.) 1110110


x 110 x 101

29
IV – DIVISION

16.) 101√1000110 17.) 111√1110111 18.) 110√11100110

19.) 10011√11011001 20. ) 100√1101000

2.4 Hexadecimal System

IDEA: The hexadecimal numeral system, often shortened to "hex", is a


numeral system made up of 16 symbols (base 16).

Hexadecimal number system uses base 16. The digits in this system range 0 to 15.
By conversion, letters A through F is used to represent the hexadecimal digits
corresponding to decimal values 10 through 15.

30
DECIMAL BINARY HEXADECIMAL
0 0 0
1 1 1
2 10 2
3 11 3
4 100 4
5 101 5
6 110 6
7 111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

 How to convert Binary number to Hexadecimal number?

Converting Binary to Hexadecimal is a very simple operation. The Binary string is


divided into small groups of 4-bits (Nibble) starting from the least significant bit. Each 4-
bit binary group is replaced by its Hexadecimal equivalent.

Example:

11010110101110010110 Binary Number


1101 0110 1011 1001 0110 Dividing into groups of 4-bits
D 6 B 9 6 Replacing each group by its Hexadecimal equivalent

Thus 11010110101110010110 is represented in Hexadecimal by D6B96.

Binary strings which cannot be exactly divided into a whole number of 4-bit groups are
assumed to have 0’s appended in the most significant bits to complete a group.

1101100000110 Binary Number


1 1011 0000 0110 Dividing into groups of 4-bits
0001 1011 0000 0110 Appending three 0s to complete the group
1 B 0 6 Replacing each group by its Hexadecimal equivalent

Thus 1101100000110 is represented in Hexadecimal by 1B06.

31
 How to convert Hexadecimal number to Binary number?

Converting from Hexadecimal back to binary is also very simple. Each digit of the
Hexadecimal number is replaced by an equivalent binary string of 4-bits.

F D 1 3 Hexadecimal Number
1111 1101 0001 0011 Replacing each Hexadecimal digit by its 4-bit binary
equivalent

ASSESSMENT

Testing your understanding of Hexadecimal number system.

CONVERT THE FOLLOWING:


Binary to Hexadecimal Hexadecimal to Binary
1.) 1010001010 = 6.) 81 =
2.) 101010101 = 7.) 35A =
3.) 100111010 = 8.) 19E =
4.) 111100011110 = 9.) 2F4 =
5.) 1001011011 = 10.) 8BE =

32
LABORATORY ACTIVITY
Name: _________________________________________ Date: ___________________
Course/Year/Section: _____________________________ Score: __________________

ACTIVITY No. 1
Hexadecimal to Color
Instruction: Convert the following binary numbers to find the corresponding color of each
in your Adobe Photoshop.
Example: 1101 0001 0010 1010 1100 0011 = VIOLET

 Open Adobe Photoshop

Click this Type here


the HEX

 Convert your binary number to hexadecimal to find the corresponding color.


 1101 0001 0010 1010 1100 0011 = d12ac3

No. BINARY NUMBER HEXADECIMAL COLOR


1 100111110101101100010010 BROWN
2 10100100001010001011 DARK BLUE
3 100101001010111100001 LIGHT BLUE
4 100111000111001000100 DARK GREEN
5 111101001101110100011101 YELLOW
6 111101000001110110111111 PINK
7 111101001000110000011101 ORANGE
8 111011011100100010110110 PEACH
9 100001011100101100011000 YELLOW GREEN
10 101010001010100010100111 GREY

33

You might also like