0% found this document useful (0 votes)
110 views5 pages

Arellano University: SUBJECT Computer Programming I TOPIC Sequence and Selection Structure Reference Objectives

The document discusses different types of flowchart structures used in computer programming, including sequence, selection, and repetition structures. It defines binary and multi-way selection, as well as pre-test and post-test repetition loops. Examples are given using pseudocode and flowchart representations for each type of structure.

Uploaded by

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

Arellano University: SUBJECT Computer Programming I TOPIC Sequence and Selection Structure Reference Objectives

The document discusses different types of flowchart structures used in computer programming, including sequence, selection, and repetition structures. It defines binary and multi-way selection, as well as pre-test and post-test repetition loops. Examples are given using pseudocode and flowchart representations for each type of structure.

Uploaded by

gilbert manait
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

ARELLANO UNIVERSITY

Name: Date:
Grade/Section: Rating:
Teacher:

SUBJECT Computer Programming I


TOPIC Sequence and Selection Structure
REFERENCE  Computer Programming 1 Module

OBJECTIVES
a. Understand the Sequence and Selection Structure of Flowchart Program.
b. Identify the difference of Binary Selection and Multi-way Selection
Structure.

CONCEPTS SEQUENCE
In a computer program or an algorithm, sequence involves simple steps which are to
be executed one after the other. The steps are executed in the same order in which
they are written.
Below is an example set of instructions to add two numbers and display the answer.

Pseudocode example:

BEGIN AddTwoNumbers
get firstNumber
get secondNumber
total = firstNumber + secondNumber
Display "The sum of your two numbers is "; total
END AddTwoNumbers

Here is the same algorithm as a flowchart:

SELECTION
Selection is used in a computer program or algorithm to determine which particular
step or set of steps is to be executed. This is also referred to as a ‘decision’. A
selection statement can be used to choose a specific path dependent on a condition.
There are two types of selection: binary selection (two possible pathways) and multi-
way selection (many possible pathways).
Binary Selection
In binary selection, if the condition is met then one path is taken, otherwise the
second possible path is followed. In each of the examples below, the first case
described requires a process to be completed only if the condition is true. The
process is ignored if the condition is false. In the second case, there is an alternative
process if the condition is false.

Pseudocode example:
IF Raining THEN
Take umbrella
ENDIF
or
IF Raining THEN
Take umbrella
ELSE
Put on suncream
ENDIF
ARELLANO UNIVERSITY

Flowchart example:

Multi-way selection
Multi-way selection allows for any number of possible choices, or cases. The path
taken is determined by the evaluation of the expression. Multi-way selection is often
referred to as a case structure.
Pseudocode example:
CASEWHERE buttonPressed evaluates to
choice a : process1
choice b : process2
OTHERWISE : default process
ENDCASE

Flowchart example:

QUESTIONS/ACTIVITY QUESTIONS:
1. What is Sequence Structure in flowchart program?
2. What is Selection Structure?
3. What is Binary Selection Structure?
4. What is Multi-way Selection?
5. What is the difference between binary and multi-way selection
structure?
6-10 . Make a selection structure using Pseudocode = IPO Outline
ARELLANO UNIVERSITY

input

ASSESSMENT/ Analyze the problems below, create steps or procedure to solve each problem using
APPLICATION Flowchart program of selection structure.
Binary Selection
pseudocode: If then Else
If age > 17
Display a message indicating you can vote.
Else
Display a message indicating you can't vote.
Endif

Multi-way Selection
 then Else control structure
pseudocode: Case
Case of age
0 to 17 Display "You can't vote."
18 to 64 Display "You are in your working years."
65 + Display "You should be retired."
End case
ARELLANO UNIVERSITY

Name: Date:
Grade/Section: Rating:
Teacher:

SUBJECT Computer Programming I


TOPIC Repetition Flowchart Program Structure
REFERENCE  Computer Programming 1 Module

OBJECTIVES
a. Recognize repetition structure.
b. Determine the difference of types of repetition.

CONCEPTS REPETITION
Repetition allows for a portion of an algorithm or computer program to be executed
any number of times dependent on some condition being met. An occurrance of
repetition is usually known as a loop.An essential feature of repetition is that each
loop has a termination condition to stop the repetition, or the obvious outcome is that
the loop never completes execution. This is known as an infinite loop and is
obviously undesirable. The termination condition can be checked or tested at the
beginning or end of the loop, and is known as a pre-test or post-test, respectively.
Following is a description of each of these types of loop.
Repetition pre-test loop
A pre-tested loop is so named because the condition has to be met at the very
beginning of the loop or the body of the loop is not executed. This construct is often
called a guarded loop. The body of the loop is executed repeatedly while the
termination condition is true.

Pseudocode example:
WHILE condition is true
processes
ENDWHILE

Flowchart example:

Repetition post-test loop


A post-tested loop executes the body of the loop before testing the termination
condition. This construct is often referred to as an unguarded loop. The body of the
loop is repeatedly executed until the termination condition is true. An important
difference between a pre-test and post-test loop is that the statements of a post-test
loop are executed at least once, even if the condition is originally true, whereas the
body of the pre-test loop may never be executed if the termination condition is
originally true. A close look at the representations of the two loop types makes this
point apparent.

Pseudocode example:
REPEAT
process
UNTIL condition is true

Flowchart example:
ARELLANO UNIVERSITY

FOR NEXT or Counted loop


Counted loops or FOR NEXT loops can be regarded as special cases of repetition
and, depending on the language in which they are implemented, are implemented as
either pre-test or post-test repetitions.

To demonstrate a FOR NEXT loop as a flowchart it must have a purpose, our


example will print the 12 times table.

Pseudocode example:
FOR i = 1 to 12 STEP 1
Display "12 x " i " = " (12 * i)
NEXT i

Flowchart example:

QUESTIONS/ACTIVITY QUESTIONS:
1. What is repetition structure?
2. What repetition pre –test loop?
3. What is repetition post-test loop?
4. What is for next or counted loops?
5. What is the use of repetition loop?
6-10.Draw a flowchart which when you put any number will print your name the
same times the inputted number.
ASSESSMENT/ Analyze the problem below, create steps or procedure to solve each problem using
APPLICATION flowcharting symbols, following the guidelines and rules in flowcharting .Use the
appropriate symbols. Draw a flowchart that performs repetition within a program.
 Given the amount to be paid for some grocery items purchased by each ten
customers. If the amount exceeds P700, a 10% discount is given, otherwise ,
no discount is given. Print the appropriate amount.

You might also like