ICT - JAVA1-Grade11 - IntroToNumberSystems

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 19

Mind and Integrity College, Inc.

San Cristobal, Calamba City


In collaboration with
Department of Education
Region IV – CALABARZON

JAVA 1
Quarter 1 – Module 3:
NUMBER SYSTEMS

SELF LEARNING MODULE


GRADE 11

Development Team:
Writer: Randy T. Mercado
Reviewer: Marife P. De Castro
Layout: Laurence E. Leonen
Management: Dr. Edwin T. Casila, MCL – Principal
Christian D. Manalansan – President

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 1 of 19
Mind and Integrity College, Inc.
Selina-Liz Bldg. National Hi-way, San Cristobal, Calamba City, Laguna
Contact #: 049-531-1604 / 0908-965-0010
Email Address: mai.school@yahoo.com

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 2 of 19
Dear Parents,

Mind and Integrity College, Inc. is one with every Filipino family in coping with the
demands of our modern times amidst the threat of COVID-19 pandemic.

The school initiated the distribution of a Self-Learning Module (SLM) in order to


meet the essential learning competencies required to be learned by your child whether
your child opts for online, modular, or blended learning modality. The learning activities
in this SLM are arranged chronologically from simple to complex that will lead your child
to think critically, act skillfully, and reflect deeply on each lesson and to practice them
into real life settings. Most importantly, this SLM promotes self-paced learning as your
child can always review the least understood lessons as often as he/she pleases.

Thank you in advance for being one with us! Together, let us envision that, by the
end of this school year, we will see your child as one responsible young person with a
heart and mind for humanity, for nature, for the country, and for God.

Dear Learner,

Welcome to a brand-new year of learning!

This is our gift to you. The school initiated the distribution of Self-Learning
Modules (SLM) that will help you keep up with the lesson whether you opted for online,
modular, or blended learning as a modality.

Please take time to read and do the activities in these SLM as if you are reporting
in school. Set a regular study schedule for you as much as possible, but keep in mind
that these SLM will enable you to learn at your own pace. If you do not understand a
lesson, the SLM would not mind you flipping back the pages repeatedly for review. Also,
remember to keep in touch with your teachers. Send them a message through your
online sessions or write them a note as you do your modular activities.

We wish you good luck in your studies, and we hope that you will remain happy
and enthusiastic in learning!

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 3 of 19
What This Module is About
Welcome to the 21st Century Society!
We live in a world where the advancement of technologies are going fast – paced and as
the first century looms ahead, it is clear to see that it has advancements that humanity may
never have dreamed of and one of these shining developments is the well-recognized
computer. Having the Latin meaning of ‘computing’ or ‘reckoning’ the computer is an invention
that was called the ‘MAN OF THE YEAR’ in a survey carried out by an international magazine.
This module is an introductory part for the subject in Computer Systems, which will pave
the way towards more meaningful discussions and interactions. This is aimed in introducing the
concept of Computer Systems to Senior High School learners, as solid ground for college
readiness. Basic concepts and terminologies will be presented as we go along the module.
Together, let us scan the next few pages of this module in order for us to be fully
equipped and to be computer literate individual. There are several standard symbols (icons)
used as you go about in the completion of this module. For instance, a hand cupped with a
sprout represents an activity that introduces you to a new lesson or concept. This is reinforced
with the magnifying glass icon that discusses the activity as a part of the lesson, enabling you to
discover and understand the totality of the lesson. Highlighting each lesson is your application of
learning, an activity that shall transfer the skills and knowledge gained into your real life
situations, symbolized with a nut and wrench tandem.
This module contains varied activities that can help you as a Senior High School student
to not just be a computer literate individual, but a creative and critical thinker as well as
responsible user of computer system.

NOTE: Prepare yellow pad papers where you would write all your outputs for this
module. Do not forget to label your works properly corresponding to the title of each
activity. Do not forget to write your name, section and the date of first entry.
Make sure to clip/staple your works so that they will not easily be separated. It is advised
to take down notes about the important information from each lesson because of the
modules will be returned at the end of every week. Please do not write anything on
module.

The following are the lessons contained in this module:


1. Number Systems

What I Need to Know

At the end of this module, you should be able to:

1. Familiarize the four important number systems in computing—binary, octal, decimal, and
hexadecimal;
2. Convert a number from one number system to another;
3. Abbreviate binary numbers using the octal and hexadecimal number systems, and why this is
useful;

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 4 of 19
How to Learn from this Module
To achieve the objectives cited above, you are to do the following:
 Take your time reading the lessons carefully.
 Follow the directions and/or instructions in the activities and exercises diligently.
 Answer all the given tests and exercises.

Icons of this Module


What I Need to This part contains learning objectives that are
Know set for you to learn as you go along the
module.

What I know This is an assessment as to your level of


knowledge to the subject matter at hand,
meant specifically to gauge prior relatedt
Knowledge
What’s In This part connects previous lesson with that of
the current one.

What’s New An introduction of the new lesson through


various activities, before it will be presented to
you

What is It These are discussions of the activities as a


way to deepen your discovery and under-
standing of the concept.

What’s More These are follow-up activities that are in-


tended for you to practice further in order to
master the competencies.

What I Have Activities designed to process what you


Learned have learned from the lesson

What I can do These are tasks that are designed to show-


case your skills and knowledge gained, and
applied into real-life concerns and situations.

Assessment This is a task which aims to evaluate your level


of mastery in achieving the learning competency

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 5 of 19
What I Know

Multiple Choice: Select the letter of the best answer from among the given choices.
1. This is a type of number system which also referred to as base 2, makes use of only
two digits—1 and 0.
A. Octal B. Decimal
C. Binary D. Hexadecimal

2. A21F is an example of what type of number system?


A. Octal B. Decimal
C. Binary D. Hexadecimal

3. This is the smallest unit of storage measurement.


A. Bit B. Binary
C. Byte D. Octal

4. The following is an example of decimal number system EXCEPT:


A. 10010 B. 7778
C. 25010 D. 1010

5. What is the base of an octal?


A. 10 B. 8
C. 2 D. 12

6. Which of the following has a base of 16?


A. Binary B. Decimal
C. Hexadecimal D. Octal

7. Which of the following number system uses digits 0 – 7?


A. Octal B. Binary
C. Decimal D. Hexadecimal

8. Which of the following number system uses digits 0 – 9 and A – F?


A. Decimal B. Hexadecimal
C. Binary D. Octal

9. Which of the following is an example of Octal Number System?


A. 1001 B. 5F6A
C. 253 D. 0245

10. It is derived from a Latin word decimalis which means tithes.


A. Octal B. Binary
C. Decimal D. Hexadecimal

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 6 of 19
Lesson 1: Number Systems

What I Need to Know

In module 1, “Introduction to Computer Systems” introduced you to the nature of


computer hardware and its close connection to the binary number system. It also hinted at the
usefulness of other number systems to help programmers overcome the awkwardness of the
binary number system. This module gives a thorough introduction to each of the number
systems and will show you how to utilize the octal and hexadecimal number systems to cut
through the cumbersome binary number system.

BINARY NUMBER SYSTEM

The binary number system, also referred to as base 2, makes use of only two digits—1
and 0. “Bi” in binary is analogous to bi in bicycle (two wheels). Each digit of the binary system is
called a bit originating from binary digit.

If we count from zero to eleven in the decimal system, as shown in Table 1, we can
observe how the binary number system compares with the decimal number system.

Table 1: Counting with the Binary and Decimal Number Systems

When we reach 1 in the binary system, we run out of digits and are forced to increase the next
number to 10. Similarly, the number after 11 is 100. So 10 is greater than 1, 100 is greater

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 7 of 19
than 11, and 1000 is greater than 111. 1 in the third place from the right in 100 is worth more
than the two 1s in 11.
In the decimal system, we run out of digits at 9 and, accordingly, the next number is 10.
Similarly, the number after 99 is 100, and 1000 comes after 999. Again, 1 in the fourth position
from the right in 1000 is worth more than 999.
Here we are using positional notation in which digits written in different positions of the
number have a different positional value. As we move to the left, the positional value
increases. Most conventional number systems apply the positional notation, the systems
discussed in this appendix in particular.
Then what exactly is the value ascribed to each position of a number in the binary
system? To answer this question, it is useful first to have a look at the positional values of the
decimal system displayed in Table 2.

Table 2: Positional Values in the Binary and Decimal System

Position in Table 2 refers to the position of each digit in an arbitrary number. The
rightmost digit is in position 1, and, as we move to the left, we increase the position by one for
each new digit we meet. For example, in the decimal number 768594, we have the following
positions:

We can establish a pattern for the positional value of a decimal number by looking at
Table 2. In general, the value of each position in the decimal system can be viewed as
Positional value of position x in decimal system = 10x-1
Consequently the positional value of position 3 is 103-1 = 100 as shown in Table 2.
We can now understand exactly what we mean when we write an arbitrary decimal
number, such as 7684:
7684 = 7x103 + 6x102 + 8x101 + 4x100
The decimal system is built around powers of 10. This explains its name; decimal is
derived from the Latin word decimalis meaning of tithes—a 10% tax.
Each position has a positional name and is derived from the corresponding positional
value. In the last decimal number, we can say that 4 is written in the ones position (100 = 1), 8 is
written in the tens position (101 = 10), 6 is written in the hundreds position (102 = 100), and 7 is
written in the thousands position (103 = 1000).
Of course, this way of looking at decimal numbers is merely our unconscious thoughts

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 8 of 19
made explicit. We have been reasoning like this since we were small kids. However, this
emphasis on the obvious paves the way to understanding how values are calculated using the
base 2, base 8, and base 16 number systems.
We can now utilize the logic applied to the positional values of the decimal number
system to work out the positional values of the binary number system. By looking at the values
in Table 2, we discover the following pattern for determining base 2 positional values:
Positional value of position x in binary number system: 2x-1
Converting from the binary to the decimal number system can then be performed as
illustrated by converting the binary number 100110 to base 10.
1x25 + 0x24 + 0x23 + 1x22 + 1x21 + 0x20 = 38
Like the decimal number system, each position in the binary number system has a
name, shown in Table 3. The names are found simply by applying the 2x-1 rule and writing the
result with text. For example 26-1 = 32 makes thirty twos.
Table 4: Positional Names for Digits in 100110

BITS AND BYTES


The byte concept is often used as a unit for memory size. One byte refers to a unit of
usually eight adjacently positioned bits in computer memory. A kilobyte is equal to 1,024 bytes,
and a megabyte is equal to 1,024 kilobytes.
OCTAL NUMBER SYSTEM
Table 4 gives an overview of the digits used in the four number systems discussed in
this appendix. Octal numbers use the digits 0–7. Table 5 compares the first 15 decimal numbers
to their octal counterparts.
Table 4: Digits of the Four Number Systems

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 9 of 19
Table 4 (Continued)

Table 5: Counting with the Octal and Decimal Number Systems

The octal numbers are based on powers of 8, just as the binary system is based on
powers of 2. Table 6 shows the relationship between the positional values of base 8 and base
10 systems.
It is easy to confuse an octal number with a decimal number. For example, nothing in
126 hints as to whether this number should be interpreted as belonging to base 10 or base 8.
Consequently, we will use a common notation form to indicate an octal number—a 0 (zero)
prefix. Thus, 06542 is an octal number.
When converting a number of base 8 to a number of base 10, we apply the same logic
as with the previous binary and decimal numbers. This is illustrated with 06542 as follows:

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 10 of 19
06542 = 6x83 + 5x82 + 4x81 + 2x80 = 6x512 + 5x64 + 4x8 + 2x1 = 3426

Table 6: Positional Values in the Octal and Decimal Systems

HEXADECIMAL NUMBER SYSTEM


Hexadecimal numbers use the digits 0–9 and the letters A–F (you can also use
lowercase a–f), as shown in Table 4. The first six letters of the alphabet were arbitrarily chosen
but are preferred because they are easy to remember and easy to find on a keyboard. To avoid
confusion, hexadecimal numbers have a 0x or 0X prefix, for the same reason that we use the
prefix 0 with octal numbers. Thus, 0x4B2 is a base 16 number.

Following the logic of bases 2, 8, and 10, we don’t experience any surprises when
looking at the positional values of base 16 numbers in Table 8. Using 0x4B2 as an example, we
say that 2 is written in the ones position, B is written in the sixteens position, and 4 is written in
the twohundredandfiftysixths position.

Hexadecimal numbers are based on powers of 16, shown in Table 8, which then
provides us with enough information to calculate the base 10 value of 0x4B2.

0x4B2 = 4 x 162 + 11 x 161 + 2 x 160 = 1202

Notice how 11 is substituted for B in the formula. In Table 7, you can find the values for
the other letters A–F

Table 7: Counting with the Hexadecimal and Decimal Number Systems

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 11 of 19
Table 8: Positional Values in the Hexadecimal and Decimal Systems

THE PRACTICAL USE OF OCTAL AND HEXADECIMAL NUMBERS


Octal and hexadecimal numbers make it more convenient to work with the long cumbersome
binary numbers. In fact, we are able to abbreviate binary numbers by utilizing base 8 and base
16 numbers, as you will see shortly.
To understand how, we need to look at equivalent values of bases 2, 8, and 16 as shown in
Table 9. One of the first things to notice is that each lengthy binary number can be expressed
concisely in either the octal or the hexadecimal number systems. For example 1111 is
equivalent to 17 in base 8 and simply F in base 16. Even though each base 2 number also has

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 12 of 19
a shorter equivalent in base 10, this latter number system is not suitable for abbreviating binary
numbers.
Table 9: Base 2, Base 8, Base 16, and Base 10 Equivalents

The underlying reason why base 8 and base 16 can be used to abbreviate base 2
numbers can be found in the fact that 8 (being the base of base 8 numbers) and 16 (being the
base of base 16 numbers) are powers of the base of the binary system (being 2). This is
illustrated in Figure 1.
Figure 1: Relationships between bases 2, 8, and 16.

This same relationship does not hold for base 10, which renders it useless for abbreviating

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 13 of 19
binary numbers.
Consider the binary number 100110010100; its equivalent base 16 number is 0x994. To
see how we can easily convert 100110010100 to 0x994, we need to separate the binary
number into three parts with each containing four consecutive digits. Underneath each part we
write the corresponding base 16 number, which can be found in Table 9.
Base 2 1001 1001 0100
Base 16 9 9 4
This works because the base of base 16 is a power of the base of the binary system, as was
shown previously, enabling us to write:

Applying the same logic, we can use the octal number system to abbreviate our binary number
100110010100 from the previous example. This time, we need to break the binary number into
four parts each with three consecutive digits:
Base 2 100 110 010 100
Base 8 4 6 2 4
Thus, 100110010100 converts to 04624.
It is now a simple matter to reverse the process and convert base 8 and base 16 numbers to
base 2 numbers. For example, the octal number 04624 is converted to base 2 by writing the 4
as its binary equivalent 100, 6 converts to 110, 2 to 010, and 4 to 100. Combining them gives
us 100110010100. Exactly the same procedure is used when converting from base 16
numbers to base 2 numbers.
CONVERTING FROM BASE 10 TO BASES 2, 8, AND 16
We have already seen how we can convert from bases 2, 8, and 16 to base 10. Those
conversions followed naturally from the positional values. Albeit not as straightforward, the
process of converting from base 10 to bases 2, 8 and 16 is based on the same positional
values. The easiest way to understand the process is by looking at an example. Following are
the steps you need to take when converting 91 of base 10 to base 2.
1. Starting at the right side of the paper and moving to the left, write the positional values of the
base 2 number system beginning at position 1. Stop when we reach a position with a value
greater than the base 10 number 91. In this case, we stop at 128.

2. Remove the column with the value greater than our base 10 number. This leaves us

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 14 of 19
Take the number in the leftmost column and divide it into the base 10 number. Here, we
divide 64 into 91. The result is 1 with 27 as a remainder. We then write 1 under the 64 column
(see Table 10).
3. Find the rightmost column that is greater than 27; this is 32. Discard 32 and write a 0 under
32 (see Table 10). Use the number on the right side of 32 to divide into our remainder 27.
27/16 yields 1 with a remainder of 11. Now write 1 under 16. We repeat the same process over
and over to obtain the binary number 1011011.
Table 10: Converting from Base 2 to Base 10 Using Positional Values

CONVERSION EXAMPLES
1. BINARY TO DECIMAL 2. DECIMAL TO BINARY
4710 = ?2 10112 = ?10
Solution:
Solution:
= ((1x23) + (0x22) + (1x21) + (1x20))10
Quotient Remainder = ((1x8) + (0x4) + (1x2) + (1x1))10
2 47 = (8 + 0 + 2 + 1)10
= 1110
2 23 Therefore,
2 11 10112 = 1110
2 5
2 2
2Base1
0

 1
 1
 1
 1
 0
 1

Write it from down to up.


Therefore, the answer is:
4710 = 1011112

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 15 of 19
3. OCTAL TO DECIMAL 4. DECIMAL TO OCTAL

5. HEXADECIMAL TO DECIMAL 6. DECIMAL TO HEXADECIMAL

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 16 of 19
What’s More

Activity 1:
Matching: The table below is in the wrong order. Draw a line from the term on the left, to the
correct base on the right. Write your answer on yellow pad paper.
Binary Base 16
Decimal Base 8
Hexadecimal Base 10
Octal Base 2

What I Have Learned

Activity 2: Conversion
Instruction: Convert the following. Write your solution together with your answer on yellow
pad paper.
1. Decimal to Binary
13510 = ?2
2. Binary to Decimal
1011001002 = ?10
3. Decimal to Octal
67010 = ?8

4. Octal to Decimal
23228 = ?10

5. Decimal to Hexadecimal
54010 = ?16

6. Hexadecimal to Decimal
16AC516 = ?10

7.

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 17 of 19
What I Can Do

Activity 3: Equivalence

Instruction: On the table, write the counterpart in Binary, octal, and hexadecimal of the
decimal given. The first one is done for you. Write your answer on your yellow pad paper.

Table 11: Number System Equivalents


DECIMAL BINARY OCTAL HEXADECIMAL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Summary
1. The binary number system, also referred to as base 2, makes use of only two digits—1
and 0.

2. Octal numbers use the digits 0–7.

3. It is easy to confuse an octal number with a decimal number. Consequently, we will


use a common notation form to indicate an octal number—a 0 (zero) prefix.

4. Hexadecimal numbers use the digits 0–9 and the letters A–F (you can also use
lowercase a–f).

5. Assessment: (Post-Test)

Multiple Choice. Answer the question that follows. Choose the best answer from among the
given choices. Write your answer on your yellow pad paper.
1. What is the hexadecimal representation of 14?
A. A B. D

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 18 of 19
C. F D. E
2. What is NOT TRUE on the given choices?.
A. (101)10 = (1100101)2 B. C represents 12
C. G is valid in hexadecimal system D. The base of a hexadecimal is 16
3. What could be the maximum value of a single digit in an octal number system?
A. 8 B. 7
C. 10 D. 16
4. What is the binary number 111 in decimal?
A. 7 B. 9
C. 5 D. 6
5. Convert (22)8 into its corresponding decimal number.
A. 28 B. 18
C. 81 D. 82
6. The binary number 1110 in hexadecimal format is _____________.
A. 6 B. E
C. A D. 15
7. Convert: (110)2 = (__)10.
A. 4 B. 5
C. 6 D. 9
8. What is the computer language that is written in binary codes only?
A. Machine Language B. C#
C. C++ D. Java
9. Which of the following is NOT a binary number?
A. 10001 B. 000
C. 101 D. 11E

10. Convert the binary equivalent 10101 to its decimal equivalent.


A. 12 B. 31
C. 22 D. 21

References
"Number Systems"
https://ptgmedia.pearsoncmg.com/images/0672321521/downloads/APPENDIXD.PDF

"Number Systems - Binary System"


https://aybu.edu.tr/abulbul/contents/files/hafta_4.pdf

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 19 of 19

You might also like