lOMoARcPSD|46786555
Computer Programming Quarter 2 WEEK 1
General Education (Biliran Province State University)
Scan to open on Studocu
Studocu is not sponsored or endorsed by any college or university
Downloaded by Shiloh Araneta (
[email protected])
lOMoARcPSD|46786555
10
Computer
Programming
Quarter II – Module 1:
Data Types
"Designed by macrovector / Freepik"
lOMoARcPSD|46786555
Computer Programming – Grade 10
Self-Learning Module
First Edition, 2020
Republic Act 8293, section 176 states that: No copyright shall subsist in any work
of the Government of the Philippines. However, prior approval of the government agency or
office wherein the work is created shall be necessary for exploitation of such work for profit.
Such agency or office may, among other things, impose as a condition the payment of
royalties.
Borrowed materials (i.e., songs, stories, poems, pictures, photos, brand names,
trademarks, etc.) included in this module are owned by their respective copyright holders.
Every effort has been exerted to locate and seek permission to use these materials from
their respective copyright owners. The publisher and authors do not represent nor claim
ownership over them.
Published by the Department of Education – Regional Office VIII
Regional Director: Ramir B. Uytico EdD, CESO IV
Assistant Regional Director: Arnulfo M. Balane, CESO V
Development Team of the Module
Writers:
Language Editors: Name
Content Editors: Name
Illustrators: Name
Layout Artist: Name
Management Team:
Rosemarie M. Guino EdD, OIC – Chief, CLMD
Ryan R. Tiu EdD, EPS, CLMD – Science
Joy B. Bihag, EPS, CLMD – LRMS
Name, Chief, CID
Name, EPS, CID – Science
Name. EPS, CID - LRMS
Printed in the Philippines by ________________________
Department of Education – Regional Office VIII
Office Address: Government Center, Candahug, Palo, Leyte
Telefax: 053 - 3233156
E-mail Address:
[email protected].
lOMoARcPSD|46786555
Introductory Message
This Self-Learning Module (SLM) is prepared so that you, our dear learners,
can continue your studies and learn while at home. Activities, questions,
directions, exercises, and discussions are carefully stated for you to understand
each lesson.
Each SLM is composed of different parts. Each part shall guide you step-
by-step as you discover and understand the lesson prepared for you.
At the end of each module, you need to answer the test to self-check your
learning. Answer keys are provided for each activity and test. We trust that you
will be honest in using these.
In addition to the material in the main text, Notes to the Teacher are also
provided to our facilitators and parents for strategies and reminders on how they
can best help you on your home-based learning.
Please use this module with care. Do not put unnecessary marks on any
part of this SLM. Use a separate sheet of paper in answering the exercises and
tests. And read the instructions carefully before performing each task.
If you have any questions in using this SLM or any difficulty in answering
the tasks in this module, do not hesitate to consult your teacher or facilitator.
Thank you.
ii
lOMoARcPSD|46786555
For the learner:
Welcome to the Computer Programming – Learning Module 1 on Data Types
The hand is one of the most symbolized part of the human body. It is often used
to depict skill, action, and purpose. Through our hands we may learn, create, and
accomplish. Hence, the hand in this learning resource signifies that you as a
learner is capable and empowered to successfully achieve the relevant
competencies and skills at your own pace and time. Your academic success lies
in your own hands!
This module was designed to provide you with fun and meaningful opportunities
for guided and independent learning at your own pace and time. You will be
enabled to process the contents of the learning resource while being an active
learner.
This module has the following parts and corresponding icons:
This will give you an idea of the skills or
Explore
competencies you are expected to learn in the
module. A brief drill or review to help you link
the current lesson with the previous one. The
new lesson will also be introduced to you in
various ways such as a story, a song, a poem,
a problem opener, an activity, or a situation.
This section provides a brief discussion of the
Learn
lesson. This aims to help you discover and
understand new concepts and skills.
What’s More This comprises activities for independent
practice to solidify your understanding and
skills of the topic. You may check the answers
to the exercises using the Answer Key at the
end of the module.
This includes questions or blank
Apply sentence/paragraph to be filled into process
what you learned from the lesson.
Assess This is a task which aims to evaluate your
level of mastery in achieving the learning
competency.
This contains answers to all activities in the
Answer Key module.
iii
lOMoARcPSD|46786555
This contains the learner’s reflection. Learners
Reflect
are encouraged to think about the lessons
particularly the parts that went well (they
have understood) and the parts that were
weak (they have difficulty) and write about it
briefly. Learners can share their thoughts and
feeling about the lessons.
At the end of this module you will also find:
References This is a list of all sources used in
developing this module.
The following are some reminders in using this module:
1. Use the module with care. Do not put unnecessary mark/s on any part of
the module. Use a separate sheet of paper in answering the
exercises.
2. Read the instruction carefully before doing each task.
3. Observe honesty and integrity in doing the tasks and checking your
answers.
4. Finish the task at hand before proceeding to the next.
5. Return this module to your teacher/facilitator once you are through with it.
If you encounter any difficulty in answering the tasks in this module, do not
hesitate to consult your teacher or facilitator. Always bear in mind that you
are not alone.
We hope that through this material, you will experience meaningful learning
and gain deep understanding of the relevant competencies. You can do it!
iv
lOMoARcPSD|46786555
lOMoARcPSD|46786555
Explore
Introduction:
A data type is a classification of data which tells the compiler or
interpreter how the programmer intends to use the data. Most
programming languages support various types of data, including integer,
real, character or string, and Boolean
After going through this module, you are expected to:
Identify the types and uses of different datatypes.
Sub-Task:
a. Understand the concept of data types in Programming Languages;
b. discuss the need to use data type in declaring a variable;
c. use appropriate data type in a given variable.
Definition of Terms:
Boolean
A data type representing logical true or false.
data type
Defines a set of values and a set of operations that can be applied on those
values.
floating point
A data type representing numbers with fractional parts.
integer
A data type representing whole numbers.
string
A data type representing a sequence of characters
Q2_STE_Computer_Programming_ Module 1 Page 1 of 21
lOMoARcPSD|46786555
PRE-ASSESSMENT
Multiple Choice. Choose the letter of the best answer. Write the chosen letter on a
separate sheet of paper.
1. What do you call the attribute of a data which tells the computer on how it will
be handled during program execution?
a. Data Attribution
b. Data Sample
c. Data Type
d. Data Management
2. Which type of data accepts ASCII characters in order to create a text or
alphanumeric data?
a. Alpha Data
b. Character Data
c. Numeric Data
d. Logical Data
3. What type of data is used to perform arithmetic operations?
a. Alpha Data
b. Character Data
c. Numeric Data
d. Logical Data
4. Which of the following is not considered as a numeric data type?
a. String
b. Integer
c. Time
d. Currency
5. Which numeric data type consist of whole numbers without fractional part?
a. Counters
b. Currency
c. Dates
d. Integers
6. Which of the following statements below best describes “Real Numbers” as a
numeric data type?
a. These are whole numbers without fractional part.
b. These are numbers that may have a fractional part.
c. These are numbers used in database tables to form a primary key for the
table.
d. These are special numbers whose fractional part is restricted to two
decimal places.
7. Which numeric data type contains three numbers to represent the hour, the
minute, and the second, respectively?
a. Real Number
b. Time
Q2_STE_Computer_Programming_ Module 1 Page 2 of 21
lOMoARcPSD|46786555
c. Date
d. Auto Incremented Number
8. What is a string?
a. data type that holds letters.
b. type of variable that hold characters
c. type of variable that hold data values made up of ordered sequences of
characters
d. None of the above
9. What data type to store the firstname of a student?
a. Float
b. String
c. Integer
d. Boolean
10. What data type for a constant called: PI = 3.14
a. Date
b. String
c. Float
d. Integer
Q2_STE_Computer_Programming_ Module 1 Page 3 of 21
lOMoARcPSD|46786555
Learn
What is a Data Type
A Data Type is an attribute of data which tells the computer on how it will be
handled during execution.
Basic Data Types
1. The data that human beings use.
2. The data used solely by the computer and its I/O devices
As human beings, we are using two types of data:
1. Character data
2. Numeric data
Character Data
Character data includes any character that can be input to the computer. It can be
anything accepted by the computers. Character data is usually defined as a string
of words. A word is a contiguous set of characters and a string is a combination of
multiple words. Character data is generally used as:
1. Strings - A string can consist of multiple words.
Represents a sequence of characters
Examples: “ Hello World ! “
2. Memo or Long Text Matter – Used to store documents or long explanations
inside a database.
3. Special Strings - The URLs (Uniform Resource Locators) used for website
addresses and email addresses form part of this data type.
Numeric Data
Numeric data is numbers expressing the value of some attribute of an entity.
Computers subject numeric data to arithmetic manipulation, and it is possible to
perform all arithmetic operations on numeric data. Numeric data is further
classified into the following types:
1. Integers - Integers are whole numbers without any fractional part
Examples: -5,0,123
Q2_STE_Computer_Programming_ Module 1 Page 4 of 21
lOMoARcPSD|46786555
2. Real number - Real numbers are those that have a fractional part
Examples: -87.5, 0.0, 3.14159
3. Date - Dates contains three distinct parts, namely the day of the
month, the month, and the year.
4. Time – Time Contains three numbers for the hour, the minute, and
the second
5. Currency - A special number whose fractional part is restricted to 2
digits after the decimal point
6. Counters - integers and is used to count the number of iterations
7. Auto Incremented Number - These are used in database tables to
form a primary key for the table.
Special Data Types
There are data types that are used for special purposes in programs,
especially in developing system software.
1. Arrays - Arrays are tables of data. Usually, arrays are used in solving
mathematical problems in matrix algebra.
2. Pointers - Pointers are a special type of integer data. Pointers can
hold the address of any location inside the RAM.
3. Union - Union is a special data type used in the C family of
programming languages.
4. Boolean - This data has only two states, namely, 0 (true or yes) or 1
(false or no)
Q2_STE_Computer_Programming_ Module 1 Page 5 of 21
lOMoARcPSD|46786555
Engage
ACTIVITY 1: REVEAL ME
INSTRUCTION: Look for the fifteen (15) different terms related to Data
Types. Encircle the word/ words vertically, horizontally, backward, upward,
or downward.
O M T C V R J N O M C Z K J Q
C Y F N H B N U M B E R S T B
R M R V E A O U T P U T F M I
N O I T A M R O F N I O P N D
U J S G H R E A L R V T G L O
L U N T U R I T C E J V Z C E
N W S W R C K A A T A P A K I
F L O A T I N G B T E N H N S
C O N S T A N T S L S R T P E
F P Z Q V P T G E O E E S U K
E Y O N L W C N S S G S R T R
O S X A M V L N I E L T M U H
P O E B Y W K Y R O G A I P Z
M R Z J P Y C S M Y P D F N F
N S B Y H D E S X V R U D I Y
Q2_STE_Computer_Programming_ Module 1 Page 6 of 21
lOMoARcPSD|46786555
Apply
Activity 4.1: Identifying the different data types.
INSTRUCTION: Provide the correct data types for the items listed below:
1. Number of days until Christmas ______________
2. Mobile Phone Number ______________
3. Paragraph ______________
4. Date of Birth ______________
5. Bar code of a product ______________
6. Half of a pie ______________
7. Watch ______________
8. Name of the student ______________
9. Yes ______________
10. Middle Initial ______________
Q2_STE_Computer_Programming_ Module 1 Page 7 of 21
lOMoARcPSD|46786555
Assess
Multiple Choice. Choose the letter of the best answer. Write the chosen letter on a
separate sheet of paper.
1. What do you call the attribute of a data which tells the computer on how it will
be handled during program execution?
a. Data Attribution
b. Data Sample
c. Data Type
d. Data Management
2. Which type of data accepts ASCII characters in order to create a text or
alphanumeric data?
a. Alpha Data
b. Character Data
c. Numeric Data
d. Logical Data
3. What type of data is used to perform arithmetic operations?
a. Alpha Data
b. Character Data
c. Numeric Data
d. Logical Data
4. Which of the following is not considered as a numeric data type?
a. String
b. Integer
c. Time
d. Currency
5. Which numeric data type consist of whole numbers without fractional part?
a. Counters
b. Currency
c. Dates
d. Integers
6. Which of the following statements below best describes “Real Numbers” as a
numeric data type?
a. These are whole numbers without fractional part.
b. These are numbers that may have a fractional part.
c. These are numbers used in database tables to form a primary key for the
table.
d. These are special numbers whose fractional part is restricted to two
decimal places.
Q2_STE_Computer_Programming_ Module 1 Page 8 of 21
lOMoARcPSD|46786555
7. Which numeric data type contains three numbers to represent the hour, the
minute, and the second, respectively?
a. Real Number
b. Time
c. Date
d. Auto Incremented Number
8. What is a string?
a. data type that holds letters.
b. type of variable that hold characters
c. type of variable that hold data values made up of ordered sequences of
characters
d. None of the above
9. What data type to store the firstname of a student?
a. Float
b. String
c. integer
d. Boolean
10. What data type for a constant called: PI = 3.14
a. Date
b. String
c. Float
d. Integer
Q2_STE_Computer_Programming_ Module 1 Page 9 of 21
lOMoARcPSD|46786555
Reflect
Today, I have learned that__________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_______________________.
I have difficulty in
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
___________________________.
Q2_STE_Computer_Programming_ Module 1 Page 10 of 21
lOMoARcPSD|46786555
Answer Key
Explore Engage
1. c O M T C V R J N O M C Z K J Q
2. b C Y F N H B N U M B E R S T B
3. c
R M R V E A O U T P U T F M I
4. a
5. d N O I T A M R O F N I O P N D
6. b U J S G H R E A L R V T G L O
7. b L U N T U R I T C E J V Z C E
8. b N W S W R C K A A T A P A K I
9. b F L O A T I N G B T E N H N S
10. c C O N S T A N T S L S R T P E
F P Z Q V P T G E O E E S U K
E Y O N L W C N S S G S R T R
O S X A M V L N I E L T M U H
P O E B Y W K Y R O G A I P Z
M R Z J P Y C S M Y P D F N F
N S B Y H D E S X V R U D I Y
Apply Asses
1. integer 11. c
2. string 12. b
3. memo 13. c
4. date 14. a
5. currency 15. d
6. real 16. b
7. time 17. b
8. string 18. b
9. boolean 19. b
10. char 20. c
Q2_STE_Computer_Programming_ Module 1 Page 11 of 21
lOMoARcPSD|46786555
References
https://press.rebus.community/programmingfundamentals/chapter/data-
types/
Computer programming for beginners A step by step guide by Murali Chemuturi
Q2_STE_Computer_Programming_ Module 1 Page 12 of 21
lOMoARcPSD|46786555
For inquiries or feedback, please write or call:
Department of Education – Regional Office VIII – Curriculum and Learning
Management Division (CLMD) - Learning Resources Management Section (LRMS)
Government Center, Candahug, Palo, Leyte, 6501
Telefax: (053) 323-3156; 323-3854; 824-4627
*
[email protected] *
[email protected]