Programming Q2 Weeks1to4
Programming Q2 Weeks1to4
Technical-Vocational
Education - ICT
Computer Programming
Quarter 2
Modules 1 - 4
8
Technical-Vocational
Education - ICT
Computer Programming
Quarter 2 – Module 1:
Overview of Programming
TVE – ICT (Computer Programming) 8
Alternative Delivery Mode
Quarter 2 – Module 1: Overview of Programming
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.
Management Team:
ii
What I Need to Know
Hello, Grade 8 Learners! This module is designed to help you fully understand
the Overview of Programming and some basic programming terms. Feel free to explore
each part and accomplish each activity at your own pace.
This module is here to guide you through this lesson. In case you were not able
to follow and understand some instances, you can always go back to that part.
Are you ready? Let us start.
The module is composed of one (1) lesson, namely:
• Lesson 1 – Overview of Programming
After going through this module, you are expected to:
1. familiarize oneself with the origin of programming;
2. create simple program logic;
3. describe program logic;
4. describe program syntax;
5. recognize syntax errors from logical errors.
What I Know
Choose the letter of the best answer. Write the chosen letter on a separate sheet of
paper.
1. One of the major tasks of a computer programmer is to write instructions to
create a computer program. Which of the following terms is also known as a
computer program?
A. Data
B. Hardware
C. Information
D. Software
1
Lesson
Overview of Programming
1
What’s In
Let us have a quick recap on our last module on Computer Network and
Network devices by answering these guide questions.
What’s New
2 G M Q W
3 C H R X
L O V E 4 D I N S Y
5 E J O T Z
1. 13 35 32 40 24 31 15 43 Source Code Table
2. 31 24 34 30 15 43
3. 44 54 34 45 10 53
4. 31 35 22 24 13
5. 54 50 30 24 23 24 43 35
What is It
2
machine code, the specific instructions
needed to tell the computer what to do.
1952 Autocode Alick Glennie • generic term for a family of early computer
programming languages
• for the Mark 1 computer at the University
of Manchester in the U.K
1958 Algol A Committee • Algol stands for Algorithmic Language.
• Algol served as a starting point in the
development of languages such as Pascal,
C, C++, and Java
1959 COBOL Dr. Grace • It is used in ATMs, credit card processing,
(COmmon Murray Hopper telephone systems, hospital and
Business government computers, automotive
Oriented systems, and traffic signals.
Language) • In the movie The Terminator, pieces of
COBOL source code were used in the
Terminator’s vision display.
1959 LISP (LISt of John McCarthy • It was originally created for artificial
Processing intelligence research but today can be
language) used in situations where Ruby or Python
are used.
1964 BASIC John G. Kemeny • for students who did not have a strong
(Beginner’s A and Thomas E. technical or mathematical understanding
ll- Kurtz so that they could still use computers
purpose Sym • A modified version of BASIC was written by
bolic Instruct Bill Gates and Paul Allen. This was to
ion Code become the first Microsoft product
1970 Pascal Niklaus Wirth • named in honor of the French
mathematician, physicist, and philosopher
Blaise Pascal.
• It is easy to learn and was originally
created as a tool for teaching computer
programming.
1972 Smalltalk Alan Kay, Adele • allowed computer programmers to modify
Goldberg, and code on the fly and introduced other
Dan Ingalls aspects now present in common computer
programming languages including Python,
Java, and Ruby.
1972 C Dennis Ritchie • considered by many to be the first high-
level language
• was created so that an operating system
called Unix could be used on many
different types of computers. It has
influenced many other languages,
including Ruby, C#, Go, Java, JavaScript,
Perl, PHP, and Python
1972 SQL Donald D. • It is used for viewing and changing
(Structured Chamberlin and information that is stored in databases.
Query Langu Raymond F. SQL uses command sentences called
age) Boyce queries to add, remove, or view data
1978 MATLAB Cleve Moler • it is one of the best computer
(Matrix Labo programming languages for writing
ratory) mathematical programs and is mainly
used in mathematics, research, and
education.
• it can also be used to create two- and
three-dimensional graphics
1983 Objective C Brad Cox and • is the main computer programming
Tom Love language used when writing software for
macOS and iOS, Apple’s operating
systems
1983 C++ Bjarne • an extension of the C language used in
Stroustrup game engines and high-performance
software like Adobe Photoshop.
3
• Most packaged software is still written in
C++.
1987 Perl Larry Wall • a scripting language designed for text
editing. Its purpose was to make report
processing easier.
• it is now widely used for many purposes,
including Linux system administration,
Web development, and network
programming
1990 Haskell Haskell Brooks • a purely functional computer
Curry programming language, which basically
means that it is mostly mathematical.
• it is used by many industries, especially
those that deal with complicated
calculations, records, and number-
crunching
1991 Python Guido Van • easier to read and requires fewer lines of
Rossum code than many other computer
programming languages
• it was named after the British comedy
group Monty Python. Popular sites like
Instagram use frameworks that are
written in Python
1991 Visual Basic Microsoft • allows programmers to choose and
change pre-selected chunks of code in a
drag-and-drop fashion through a
graphical user interface (GUI).
1993 R Ross Ihaka and • named after the first names of the first
Robert two authors
Gentleman • it is mostly used by statisticians and
those performing different types of data
analysis.
1995 Java Sun • Originally called Oak
Microsystems • it was intended for cable boxes and hand-
held devices but was later enhanced so it
could be used to deliver information on
the World Wide Web
• Java is everywhere, from computers to
smartphones to parking meters. Three
billion devices run Java!
1995 PHP Rasmus Lerdorf • used mostly for Web development and is
(Personal Ho usually run on Web servers now widely
me Page) used to build websites and blogs.
• WordPress, a popular website creation
tool, is written using PHP.
1995 Ruby Yukihiro “Matz” • combined parts of his favorite languages
Matsumoto to form a new general-purpose computer
programming language that can perform
many programming tasks
• it is popular in Web application
development.
• Ruby code executes more slowly, but it
allows for computer programmers to
quickly put together and run a program
1995 Javascript Brendan Eich • mostly used to enhance many Web
browser interactions
• Almost every major website uses
Javascript.
2000 C# Microsoft • combining the computing ability of C++
with the simplicity of Visual Basic, C# is
based on C++ and is like Java in many
aspects
• it is used in almost all Microsoft products
and is primarily used for developing
desktop applications.
4
2003 Scala Martin Odersky • a computer programming language that
combines functional programming, which
is mathematical, with object-oriented
programming, which is organized around
data that controls access to code
• Its compatibility with Java makes it
helpful in Android development.
2003 Go Google • address problems that can occur in large
software systems. Since computer and
technology use is much different today
than it was when languages such as C++,
Java, and Python were introduced and
used, problems arose when huge
computer systems became common.
• it was intended to improve the working
environment for programmers so they
could write, read, and maintain large
software systems more efficiently.
2014 Swift Apple • replacement for C, C++, and Objective-C,
Swift is supposed to be easier to use and
allows less room for mistakes
• It is versatile and can be used for desktop
and mobile apps and cloud services.
Table 1. History of Programming Languages
Programming Defined
Program Defined
• A program is written as a series of human understandable computer
instructions that can be read by a compiler or interpreter.
1. Input – data items enter the computer system and are placed in memory, where they
can be processed
2. Processing – data items are organized or sorted, checked for accuracy and performs
calculations
3. Output – after data items have been processed, the resulting information usually is
sent to an output or storage devices
Example 1 shows a simple program logic that includes the three (3) major operations
in programming. A program Logic is defined as a specific sequence of program
instructions. Incorrect sequence of instructions produces incorrect output or logical
error/s. These instructions written using a programming language is called program
Code. Coding a program is also known as writing instructions. The instructions
written in a specific programming language is called source code. This source code is
translated into a machine-readable language (object code) in the form of on/off
5
circuits (Os and 1s) within the computer by a compiler/interpreter. In writing a
program, there are rules governing its word usage and punctuation. This is called the
language’s syntax. Any mistake in a language’s use will return a syntax error. Syntax
errors are easy to locate and correct because the complier/interpreter highlights them.
On the other hand, a program with no syntax error is translatable and can execute,
but still might contain logical errors. Table 2 gives a quick view of this concept.
What’s More
Activity 2. Matching Game. Accomplish the activity by drawing a line from the
Timeline column to the Programming Language column to match the correct
items based on the History of Programming Languages discussed.
1995 Scala
1983 C++
1959 Javascript
1991 COBOL
Activity 3. Analysis Check. Identify what error is produced for each situation.
Draw a single underline on the Logic segment and double underline on the syntax
segment.
2. Added two numbers instead of multiplying and no misspelled word nor incorrect
punctuation was used.
3. The sequence and operation used is correct and no misspelled word nor incorrect
punctuation was used.
4. Typed niput instead of input and the sequence and operation are correct.
5. Used colon instead of semicolon after the statement and used the correct operator in
dividing.
6
What I Have Learned
What I Can Do
Activity 4. Evaluation Check. Simply put a check (√) mark if the column identifier
applies to the case. Put a cross (x) mark if otherwise.
Assessment
Multiple Choice. Choose the letter of the best answer. Write the chosen letter on a
separate sheet of paper.
1. This programming language served as a starting point in the development of languages
such as Pascal, C, C++, and Java. What is this programming language?
a. Algol b. Autocode c. C++ d. Pascal
2. In 1991, a programming language was developed by Microsoft that allowed
programmers to choose and change pre-selected chunks of code in a drag-and-drop fashion.
a. Python b. Ruby c. Swift d. Visual Basic
3. Javascript is mostly used to enhance many Web browser interactions today. Who developed
this programming language?
a. Brendan Eich b. Martin Odersky c. Rasmus Lerdorf d. Yukihiro Matsumoto
4. Go was developed by Google in 2003 for a specific purpose. Which of the following statements
describes the intention of developing this language?
7
a. it was intended to improve the working environment for programmers so they could write,
read, and maintain large software systems more efficiently
b. it combines functional programming, which is mathematical, with object-oriented
programming, which is organized around data that controls access to code
c. it executes more slowly, but it allows for computer programmers to quickly put together
and run a program
d. it was intended for cable boxes and hand-held devices but was later enhanced so it could
be used to deliver information on the World Wide Web
5. COBOL was the programming language used in ATMs, credit card processing, telephone
systems, hospital and government computers, automotive systems, and traffic signals. What
does the acronym COBOL stand for?
a. Code of Basic Operating Language
b. Common Business Oriented Language
c. Comprehensive Business Oriented Language
d. Credit Operating Business Oriented Language
6. Which of the following terms is defined as the process of developing and implementing various
sets of instructions to enable a computer to do a certain task.
a. Coding b. Encoding c. Programming d. Writing
7. Regardless of programming language used, they follow the three (3) major operations in
programming. What are these operations in correct order?
a. input, processing, output
b. input, storing, output
c. processing, input, storing
d. storing, input, processing
8. From the three (3) major operations, data items are organized or sorted, checked for accuracy
and performs calculations, which operation is described?
a. input
b. output
c. processing
d. all the above
9. All programming languages are governed by rules. What term in programming is used for these
rules?
a. format
b. logic
c. options
d. syntax
10. What is the most important task of a compiler or interpreter?
a. creates the rules for a programming language
b. executes the object code to perform necessary tasks
c. translates the English statements into a programming language
d. translates the language statements into machine language
8
8
Technical-Vocational
Education - ICT
Computer Programming
Quarter 2 – Module 2:
Program Development Cycle
TVE – ICT (Computer Programming) 8
Alternative Delivery Mode
Quarter 2 – Module 2: Program Development Cycle
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.
Management Team:
ii
What I Need to Know
Hello, Grade 8 Learners! This module is designed to help you fully understand
the Program Development Cycle and some more basic programming terms. Feel free to
explore each part and accomplish each activity at your own pace.
This module is here to guide you through this lesson. In case you were not able
to follow and understand some instances, you can always go back to that part.
Are you ready? Let us start.
The module is composed of one (1) lesson, namely:
• Lesson 1 – Program Development Cycle
After going through this module, you are expected to:
1. familiarize oneself with the Program Development Cycle;
2. recognize the importance of each phase in the Program Development Cycle.
What I Know
Choose the letter of the best answer. Write the chosen letter on a separate sheet of
paper.
1. Programmers write program to satisfy the needs of others, called the users. They
just do not sit down and start typing. They follow a program development cycle
which is broken into seven steps. Which of the following items shows the correctly
sequenced program development cycle?
a. Understand the Problem ->Plan the Logic ->Write the Code->Translate the
Code->Test the Program->Put the Program into Production->Maintain the
Program
b. Understand the Problem ->Test the Program ->Write the Code->Translate
the Code->Plan the Logic->Put the Program into Production->Maintain the
Program
c. Understand the Problem ->Translate the Code ->Maintain the Program-
>Test the Program->Plan the Logic->Put the Program into Production->Write
the Code
d. Understand the Problem ->Write the Code ->Maintain the Program-
>Translate the Code->Plan the Logic->Put the Program into Production-
>Test the Program
2. Planning the logic is considered as more difficult than actually coding the
program. Which pair shows the two most common planning tools?
a. ASCII and EBCDIC
b. FLOWCHARTS and PSEUDOCODE
c. IPO and TOE
d. TOE and UML
3. Which of the following statements best describe the goal why programmers write
program?
a. Good programs can be made better over time.
b. To earn money by creating various programs for different purposes.
c. To prove that programmers can create impossible things.
d. To satisfy the needs of organizations, agencies, and other entities.
4. Of the phases in the Program Development Cycle, which phase is considered the
heart of programming?
a. Planning the Logic
b. Testing the Code
c. Understanding the Problem
d. Writing the Code
5. When can the programmer only write the code?
a. after the program has been tested
b. anytime in the program development process
c. when the logic is planned
d. when the problem is fully understood
1
Lesson
Program Development Cycle
1
What’s In
Let us have a quick recap on our last module on Overview of Programming devices
by answering these guide questions.
1. What is Programming
2. Can you enumerate at least five (5) programming language with their respective
creator or developer?
3. What is the difference between logic and syntax and logical error with syntax
error?
What’s New
Assembly Alick
1991 Ada Lovelace 1959
Language Glennie
Nicklaus
COBOL 1964 Pascal Smalltalk
Wirth
Bjarne
C SQL FREE Larry Wall
Stroustrop
Guido Van
Haskell Microsoft 1995 PHP
Rossum
Yukihiro
Ruby C# Scala Google
Matsumoto
2
What is It
3
2. Planning the Logic
During this phase, the programmer plans the sequence (logic) of the program,
deciding what operations to include and how to order them. This makes this phase
considered as the heart of programming. This phase is also referred to by other
programmers as “developing an algorithm”. An algorithm is the sequence of steps or
rules a programmer follows to solve the problem. Planning the logic includes planning
tools. The most common planning tools are: 1) Pseudocode and 2) Flowcharts. Other
planning tools includes IPO (Input Process Output) chart, TOE (Tasks Objects Events)
chart, and UML (Unified Modelling Language). These are frequently used in interactive,
object – oriented applications.
To check if the logic is correct by providing the correct output, a programmer conducts
desk-checking.
Once the program logic is developed, coding the program starts. It is also termed as
writing instructions. In coding, hundreds of programming languages are available. The
preference in choosing what language to be used depends primarily on the purpose of
the software to be developed. Programming languages are different in terms of their
capabilities to handle certain types of operations and their level of efficiency.
Nevertheless, they are quite alike in their basic capabilities, that is to handle the three
(3) major operations in programming and other standard functions.
It also in this phase where learning the syntax of a programming language to be
used is necessary.
The code is translate using a software called compiler or interpreter. This software
translates the program English-like high – level programming language (source code)
to a low – level machine language (object code) in form of on/off switchers (Os and 1s).
Although there are many programming languages, only one language can the computer
understand, and this is the object code.
After translating, the programmer receives syntax errors in cases of misspellings,
missing punctuation marks and other violations on the language’s syntax. These errors
are never considered difficult for programmers since the compiler highlights the part of
the program where a syntax error exists.
In module 1, it is presented there the instances when a program is executable or
not. The diagram below shows how to create an executable program.
Data the
program
uses
if no syntax
Write and correct Compile the error Executable
the program code program program
if syntax
errors exist
List of
Program
syntax error
messages output
In this phase, the logic of the program is of utmost importance. As discussed in the
previous module, a program with no syntax error, although executable, may not mean
free from logical errors.
To do this, a programmer uses different sets of data to test the program. Let us use
the Number – doubling program to do some testing.
input anyNumber
set doubledNumber = anyNumber * 2
output doubledNumber
When the program executes and you provided the value 3 as input to the program, and
the output displayed is 6. Your program is correct. However, if the output displayed is
66, there seems to be a logical error. Your program maybe written as follows:
This scenario is an example of logical error because the desired output is not achieved.
Once the program has been tested thoroughly, no syntax error and more importantly
no logical error, it is now ready for the end user to use. Part of this phase is to run the
program once for the end user to check if all specifications were followed. Also, the
people who will be using may undergo training on the use of the program.
5
What’s More
Activity 2. Drag & Drop. The box below contains the seven (7) phases in the
Program Development Cycle. Place each phase on the diagram correspondingly.
Activity 3. Scenario Identification. For each scenario given, identify what phase in
the Program Development Cycle it belongs.
1. The programmer inputs series of data to check if the result desired is correct.
3. The end user runs the program at once and checks if the desired specifications were
followed.
6
What I Have Learned
What I Can Do
start
input length, width
set area = length * width
output area
stop
Assessment
True or False. Read and understand each statement. Write the word TRUE if the
statement is correct. Otherwise, write the word FALSE on the space provided before
each item.
_____ 1. Understanding the problem that must be solved can be one of the most
difficult aspects of programming.
_____ 2. The two most commonly used logic planning tools are IPO chart and
Flowchart.
_____ 3. Flowcharting a program is a very different process if you use an older
programming language instead of a newer one.
_____ 4. If the end user wants to add more specifications to an existing program, the
programmer will maintain the program. In this case, the programmer will
repeat the whole Program Development Cycle.
_____ 5. High – level programming language is the only language the computer
understands.
7
References
Webliography
Joyce Farrell. 2015. Programming Logic and Design Comprehensive Version, Eighth Edition. United States of
America: GEX Publishing Services
8
8
Technical-Vocational
Education - ICT
Computer Programming
Quarter 2 – Module 3:
Planning Program Logic by
Writing Pseudocode
TVE – ICT (Computer Programming) 8
Alternative Delivery Mode
Quarter 2 – Module 3: Planning Program Logic by Writing Pseudocode
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.
Management Team:
ii
What I Need to Know
Hello, Grade 8 Learners! This module is designed to help you fully understand
how to plan a program logic using Pseudocode statements and some more basic
programming terms. Feel free to explore each part and accomplish each activity at your
own pace.
This module is here to guide you through this lesson. In case you were not able
to follow and understand some instances, you can always go back to that part.
Are you ready? Let us start.
The module is composed of one (1) lesson, namely:
• Lesson 1 – Planning Program Logic by Writing Pseudocode
After going through this module, you are expected to:
1. define the term Pseudocode;
2. apply Pseudocode standards;
3. recognize the different preserved Pseudocode terms and their functions;
4. familiarize oneself with the mathematical operations and operators in processing
data;
5. desk – check pseudocode statements;
6. plan a program logic by writing Pseudocode.
What I Know
Choose the letter of the best answer. Write the chosen letter on a separate sheet of
paper.
1. When programmers plan the logic for a solution to a problem, planning tools are
often used. Which of the following planning tools is described as an English – like
representation of the logical steps?
a. Flowchart
b. IPO Chart
c. Pseudocode
d. TOE Chart
a. b.
start start
input anyNumber input anyNumber;
set doubledNumber = anyNumber * 2 set doubledNumber = anyNumber * 2;
output doubledNumber output doubledNumber;
stop stop
c. d.
start start
input anyNumber Input: anyNumber
set doubledNumber = anyNumber * 2 set: doubledNumber = anyNumber * 2
output doubledNumber output: doubledNumber
stop stop
1
3. What preserved Pseudocode term/word is used to display data or information?
a. input
b. output
c. set
d. start
4. If the preserved Pseudocode word input is good as read, which of the following
preserved Pseudocode word is good as compute?
a. display
b. get
c. print
d. set
e.
5. Problem 1. The program allows the user to input any name and outputs the text
“Hello, ”, the name that has been input by the user and an exclamation point.
Refer to Figure 2. Rearrange the Pseudocode statements in Figure 1 to get the
correct output.
1 - start
2- input yourName
3- output “Please enter your name:”
4- output “Hello, ”,yourName,“!”
5 - stop
Figure 1 Figure 2
a. 1, 4, 2, 3, 5
b. 1, 3, 2, 4, 5
c. 1, 2, 3, 5, 4
d. 1, 5, 3, 4, 2
What’s In
Let us have a quick recap on our last module on Program Development Cycle by
answering these guide questions.
1. What are the seven (7) phases in the Program Development Cycle?
2. Which of these phases you think is the most difficult? Why?
3. When can we say that a program is executable and when will a program be not
executable?
What’s New
Activity 1. Fact or Bluff. Invite one or two members of the family as bluffers. Bluffers
role is to give their own opinion regarding each statement. After stating their opinions,
determine whether each statement is a FACT or a BLUFF. If you answered correctly, the
point is yours. Otherwise, the bluffers will own the point.
(Note: Each statement was adapted from various fact sites/vlogs on the internet.)
2
1. Cows do not have upper front teeth.
2. A diamond will break if you hit it with a hammer.
3. A person can live without food for about a month, but only about a week
without water.
4. Not all our taste buds are on our tongue; about 10% are on the palette and the
cheeks.
5. Toenails grow nearly 4 times faster than fingernails.
What is It
In Module 2, one of the most commonly used planning tools is Pseudocode. Pseudocode
is defined as an English – like representation of the logical steps it takes to solve a
problem. Pseudo is a prefix that means false, and to code a program means to write it
using a programming language. Therefore, pseudocode simply means false code, or
statements that seems to be written using a computer programming language but do
not follow all the syntax rules of any specific language. Instead, it follows the Pseudocode
standards as follows:
Pseudocode Standards
1. Programs begin with start and end with stop; these two words are always
aligned.
3. Modules begin with the module name and end with return. The module name
and return are always aligned.
4. Each program statement performs one action—for example, input, processing,
or output.
5. Program statements are indented a few spaces more than start or the module
name.
6. Each program statement appears on a single line if possible. When this is not
possible, continuation lines are indented.
7. Program statements begin with lowercase letters.
These standards will be one of the measures in identifying syntax errors in your
Pseudocode programs later.
Preserved Pseudocode
Operation Other terms
English word
START to begin a program BEGIN
STOP to terminate a program END
INPUT to enter data GET, READ
SET to process data using CALCULATE,
mathematical operations COMPUTE
OUTPUT to display the processed data DISPLAY, PRINT,
or information WRITE
Table 1. Preserved Pseudocode English words
3
Pseudocode is a planning tool and not the final code to run using a programming
language. This will serve as a guide for the programmer in writing the codes using a
specific programming language’s syntax.
Notice the third column of Table 1. These terms can also be used alternately with the
words in the first column. Both denote same operation. For the meantime, as beginners,
use the terms in the first column to avoid confusion.
Let us have again the Number – doubling program as an example. Examine each
statement with the help of the labels.
Figure 1 also shows an error – free Pseudocode program because it followed the
Pseudocode standards and uses the correct preserved Pseudocode word for each
operation.
This time let us check if a Pseudocode program is correct or not. With the process of
desk – checking, let us see if the desired output is achieved in the Number – doubling
program.
start
input anyNumber
set doubledNumber = anyNumber * 2
output doubledNumber
stop
In desk – checking, you will need an imaginary monitor to display the outputs,
processor to compute and memory to store input and processed data.
input anyNumber
3
In input operation, the computer will let the user enter data. In this case, the user
input the value 3. Once the enter key is pressed on the keyboard, the memory will
store the data using the variable name as identification.
3 anyNumber
3
For the processing operation, notice what will happen inside the devices.
In this event, the processor (Figure 14) calculates for the value of variable
doubledNumber by multiplying (*) the entered value 3 by the constant value 2. Thus,
giving value 6 as the result that is assigned to variable doubledNumber (Figure 13).
Notice the use of equal sign (=) as assignment operator. This operator does not equate
the two sides of the operation like mathematics do, but it assigns the value on the right
side to the variable on the left side.
output doubledNumber
3 anyNumber doubledNumber doubledNumber = 3 * 2
3 6
6 doubledNumber = 6
Since output statements display any value a variable holds, Figure 17 shows that the
calculated value assigned to variable doubledNumber is displayed on the monitor
(Figure 15). This also shows if your logic is correct or not. In this case, the number –
doubling program is correct since the goal is to double any input data. The value 3 if
doubled is 6.
Always remember that only the monitor can a user or even a programmer see. Memory
(RAM) and Processor (CPU) are inside the System Unit. We can only interact with these
devices using input (keyboard & mouse) and output (monitor) devices. It is then very
important to visualize how the former two devices work according to the instructions
written using Pseudocode statements.
5
The last statement in the Number – doubling program is stop and this signifies
termination of the program.
What’s More
Activity 2. Fill in the Table. Below is a table that contains the different preserved
Pseudocode terms. Accomplish by filling in the missing items.
start 1.begin
2. end
input get
3. or read
output 5.
Activity 3. Fill in the Table. Below table contains the Mathematical operations.
Accomplish by providing the missing items.
begin
1. ()
Grouping
2. ^
Caret
Multiplication Asterisk 3. *
5. =
Equal sign
6
What I Have Learned
What I Can Do
Activity 4. Plan the Logic. Plan the logic by writing Pseudocode statements of a
program that allows a user to enter two (2) values. The program outputs the
product of the two values.
Assessment
Identification. Read and understand each statement. Identify the item being described
and write your answers on a separate sheet of paper.
7
References
Bibliography
Joyce Farrell. 2015. Programming Logic and Design Comprehensive Version, Eighth Edition. United
States of America: GEX Publishing Services
8
8
Technical-Vocational
Education - ICT
Computer Programming
Quarter 2 – Module 4:
Planning Program Logic by
Drawing Flowcharts
TVE – ICT (Computer Programming) 8
Alternative Delivery Mode
Quarter 2 – Module 4: Planning Program Logic by Drawing Flowcharts
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.
Management Team:
ii
What I Need to Know
Hello, Grade 8 Learners! This module is designed to help you fully understand
how to plan a program logic using Flowcharts and some more basic programming terms.
Feel free to explore each part and accomplish each activity at your own pace.
This module is here to guide you through this lesson. In case you were not able
to follow and understand some instances, you can always go back to that part.
Are you ready? Let us start.
The module is composed of one (1) lesson, namely:
• Lesson 1 – Planning Program Logic by Drawing Flowcharts
After going through this module, you are expected to:
1. define the term Flowchart;
2. recognize the different flowchart shapes;
3. appreciate the advantages of using flowchart in planning a program logic;
4. plan a program logic by drawing flowcharts.
What I Know
Choose the letter of the best answer. Write the chosen letter on a separate sheet of
paper.
2. Which of the following shapes is used to show the flow line in a flowchart?
a.
b.
c.
d.
1
5. What shape is used to indicate a computation or calculation operation?
a. b.
c. d.
What’s In
Let us have a quick recap on our last module on Planning Program Logic by Writing
Pseudocode by answering these guide questions.
What’s New
Activity 1. DIY Exercise. Invite one member of the family as your trainer. Before
starting the activity, cut the following shapes on a cardboard or any slightly hard paper
and write on them the instructions accordingly. The cut cardboards must be arranged
also in correct order as shown below. To start the activity, have your trainer flash the
cards one by one and you will do as instructed.
5. IF NO, STRETCH
4. ARE YOU 5. IF YES, WALK TO
BOTH ARMS
THE LEFT (8X), WALK
ENJOYING? FORWARD THEN
TO THE RIGHT (8X)
BACKWARD (16X)
6. INHALE – EXHALE
(8X)
2
What is It
While some programmers prefer writing Pseudocode to plan program logic due to its
similarity to writing actual codes, others prefer drawing flowcharts to plan program logic
because it allows them to visualize more easily how the program statements will
connect. For beginning programmers, flowcharts are excellent tool to interrelate
program statements. Flowchart is pictorial representation of a Pseudocode.
MS
Visual
MS Word Powerpoint MS Visio Pencil
Logic
In drawing flowcharts, several geometric shapes are drawn. Each shape contains the
individual statements and are connected with arrows. Table 1 summarizes the geometric
shapes used in drawing flowcharts and are called the flowchart symbols.
Arrow Flowline
Input / Output
Parallelogram
Rectangle Process
Diamond Decision
3
Let us take again the Number – doubling program. on Figure 2, notice how the
Pseudocode statements are presented using Flowchart.
Pseudocode Flowchart
start
input anyNumber
start
input anyNumber
set doubledNumber = anyNumber * 2
set doubledNumber =
output doubledNumber
stop anyNumber * 2
output doubledNumber
stop
Programmers seldom plan a program logic using both tools. You may use Pseudocode
or Flowchart, whichever seems easier and more comfortable for you to use. It is then a
must to understand each tool.
start
input anyNumber
set doubledNumber = anyNumber * 2
output doubledNumber
input anyNumber
set doubledNumber = anyNumber * 2
output doubledNumber
input anyNumber
set doubledNumber = anyNumber * 2
output doubledNumber
input anyNumber
set doubledNumber = anyNumber * 2
output doubledNumber
input anyNumber
set doubledNumber = anyNumber * 2
output doubledNumber
input anyNumber
…and so on for 95 more times
4
This is called repeating instructions. In such case, drawing flowcharts is best to use as
planning tool. Look at the next figure (Figure 3) to see how flowchart offers a better
solution for the problem.
start
input anyNumber
set doubledNumber =
anyNumber * 2
output doubledNumber
Notice that no statement was repeatedly written like Pseudocode does while producing
same output. Figure 4 shows a solution for repeating instructions. The repetition of
series of steps is called loop. Loops will be discussed more thoroughly on Quarter 4 –
Module 3. Comparing Figure 3 with Figure 4, you would most likely use Flowchart for
repeating instructions.
While Figure 4 solved the inefficiency of Pseudocode in this case, it also introduces
another problem that is a never-ending sequence of instructions. We call this situation
as Infinite Loop. You will learn one way of handling this problem in Module 5.
Desk – checking a flowchart works exactly as desk – checking a Pseudocode program.
With the help of the arrows, you will be guided with the flowline of the program.
5
What’s More
Activity 2. Fill in the Table. Below is a table that contains the flowchart symbols.
Accomplish the by filling in the missing items.
Arrow 2
Diamond 3
5 Process
Activity 3. Draw the Flowchart. Draw the flowchart of the Pseudocode program
that allows the user to enter the length and the width of a lot and returns the lot
area.
Pseudocode
start
input anyLength, anyWidth
set lotArea = anyLength * anyWidth
output lotArea
stop
6
What I Can Do
Activity 4. Plan the Logic. Plan the logic by drawing a flowchart statements of a
program that allows users to enter length and width of a rectangle and
calculates the Perimeter using the formula P = 2(Length + Width). The
program displays the Perimeter after.
length – anyLength
width – anyWidth
perimeter - lotPerimeter
Assessment
Truth or Lie. Read and understand each statement. Evaluate if the statement is a Truth
or a Lie. Put a check (√) mark on the space provided for Truth statements and cross (x)
mark on Lie statements.
7
References
Bibliography
Joyce Farrell. 2015. Programming Logic and Design Comprehensive Version, Eighth Edition. United
States of America: GEX Publishing Services