Computer Programming Quarter 2 Week 1
Computer Programming Quarter 2 Week 1
10
Computer
Programming
Quarter II – Module 1:
Data Types
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.
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
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.
iii
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.
3. Observe honesty and integrity in doing the tasks and checking your
answers.
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
Explore
Introduction:
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
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
5. Which numeric data type consist of whole numbers without fractional part?
a. Counters
b. Currency
c. Dates
d. Integers
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
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
Learn
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:
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.
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.
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)
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
Apply
3. Paragraph ______________
7. Watch ______________
9. Yes ______________
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
5. Which numeric data type consist of whole numbers without fractional part?
a. Counters
b. Currency
c. Dates
d. Integers
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
Reflect
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
References
https://press.rebus.community/programmingfundamentals/chapter/data-
types/
Computer programming for beginners A step by step guide by Murali Chemuturi