0% found this document useful (0 votes)
23 views32 pages

Gr 6.5 Psuedocode and flowchart_Trace table 5

Uploaded by

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

Gr 6.5 Psuedocode and flowchart_Trace table 5

Uploaded by

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

Grade 6

Pseudocode and
Flowchart
Pseudocode - is a sequence of instructions
to solve a problem, using simple words and
operators , and it can solve any problems
when it is used with the correct procedure.

A value is assigned to an item/variable using


the  operator. The variable on the left of
the  is assigned the value of the expression
on the right.
CLASS WORK

Examples of pseudocode assignment


statements:

1.Age has the value 10


2.Marks has the value 99
3.Cost has the value 20.4
4.Gender has the value M
5.Feespaid has the value True
Answers:

1.Age 10
2.Marks99
3.Cost20.4
4.Gender “M”
5.Feespaid True
FLOWCHART

A graphical representation of
data, information and workflow
using certain symbols that are
connected to flow lines to
describe the instructions done in
problem solving.
Example: - Draw a flowchart –Ask user to input three
quiz score. And find the total score of all three quiz.
HW:- Basics of Programming
Worksheet 3
SEQUENCE CONSTRUCT
Sequence is the first programming
construct.
In programming, statements are
executed one after another. Sequence is
the order in which the statements are
executed.
Class Work

Example :1

Draw a flowchart and write a pseudocode to input three


numbers find the total sum of three numbers and display
the result.
Keywords – are reserved words and always written in Upper case.
Example: - INPUT, OUTPUT, IF, ELSE etc

START
OUTPUT “Enter three numbers”.
INPUT num1,num2,num3
Sum num1+num2+num3
OUTPUT “The addition of three numbers”, Sum
END
Example 2:

Draw a flowchart and write a pseudocode to


find the square and cube of a number.

START
OUTPUT “Enter a number “
INPUT num
Square num*num
Cube num * num*num
OUTPUT “The square of a number is: “, Square
OUTPUT “ The cube of a number is: “, Cube
END
Example 3

Try to do this example.


Draw a flowchart and write a pseudocode to
display your name, age and grade.
START
OUTPUT “Enter your name”
INPUT name
OUTPUT “ Enter your age”
INPUT age
OUTPUT “ Enter your grade”
INPUT grade
OUTPUT “ Name of a student :”, name
OUTPUT “ Age of a student :”, age
OUTPUT “ Grade of a student :”, grade
END
HW:- Basics of Programming
Worksheet 4
FLOW CHART ACTIVITY
CLASS WORK
Write a pseudocode and draw a flowchart to
calculate the area of a triangle. Ask user to
input height and base of a triangle.

Formula for area of a triangle :


Area = ½ * base * height
Pseudocode

START
OUTPUT “ Enter the height of a triangle”
INPUT height
OUTPUT “ Enter the base of a triangle”.
INPUT base
Area ½ * height * base
OUTPUT “ Area of a triangle”, Area
END
REVIEW OF WORKSHEET 4
HW QUESTIONS:

1. Write a pseudocode and draw a flowchart that


converts from Celsius to Fahrenheit (multiply by 1.8
(or 9/5) and add 32).
Formula :
F = C*1.8+32
2.Write a pseudocode and draw a flowchart that ask
user to input four subject marks and calculates the
average. Print the average at the end.
FLOWCHART ACTIVITY 2
SELECTION CONSTRUCT

SELECTION
2. SELECTION

A selection statement causes the


program control to be transferred to
a specific flow based upon whether
a certain condition is true or not.
Example 1 :
Write a pseudocode and draw a flowchart to find
the eligibility to write IAS exam. If the age is less
than or equal to 32 then print “You are eligible to
write the exam” else print “Sorry, not eligible”.
START
OUTPUT “ Enter the age of a person”.
INPUT age
IF age<=32 THEN
OUTPUT “You are eligible to write the exam”
ELSE
OUTPUT “Sorry, not eligible”.
ENDIF
END
FLOWCHART
START

OUTPUT “ Enter the age of a person”

INPUT age

IF Yes OUTPUT “ You are


age<= eligible to write the
32 exam”
No
OUTPUT “ Sorry,
not eligible

STOP
Example 2 :
Write a pseudocode and draw a flowchart to find whether the
employee is eligible to take bonus or not. If the employee’s experience
is more than or equal to 5 years, then print “BONUS” else print “NO
BONUS”.
START
OUTPUT “ Enter the experience of a person”.
INPUT experience
IF experience >=5 THEN
OUTPUT “BONUS”
ELSE
OUTPUT “NO BONUS”.
END
FLOWCHART
START

OUTPUT “ Enter the experience of a


person”

INPUT experience

IF
experi Yes
ence OUTPUT “ BONUS”
>=5
No
OUTPUT “ No
Bonus”

STOP
TRACE TABLE

A trace table is a technique


used to test algorithms or
computer programs for logic
errors.
Quiz1 Quiz2 quiz3 Total_score
3 6 7 16
40 20 25 85
For the following pseudocode complete the Trace table.
START
OUTPUT “ Enter the age of a person”.
INPUT age
IF age<=32 THEN
OUTPUT “You are eligible to write the exam”
ELSE
OUTPUT “Sorry, not eligible”.
ENDIF
END
age IF age <=32 OUTPUT
42
15
32
Complete the trace table for the given flowchart

START

OUTPUT “ Enter the experience of a


person”

INPUT experience

IF
experie Yes
nce OUTPUT “ BONUS”
>=5

No
OUTPUT “ No
Bonus”

STOP

experience Experience>=5 OUTPUT


4
10
5
HW:
Basics of programming worksheet 5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy