Tutorial 1
School of Computing
ST0502: Fundamentals of Programming
Tutorial 1
Problem Solving Concepts
1. Name the following Symbols in the Raptor tool and briefly explain how they are used.
Symbol Name Description
Start
Allow the user to enter a date. Data
Input statement will be stored as variable
Start
Start Design fr user to input values that
the program need
Change the value of the variable by
Assignment using mathematical calculation
statement Design to place values computed in
the program into the variables.
(a variable is a memory location
assigned to hold a particular value.)
Display the output, can be display in
Output statement variable
Design for program to show or
End deliver some values.(Values can be
numeric or string.)
End
End Allow you to make a decision about
Selection control some conditions of the program’s
data to determine whether to
executed some statement.
Design for program to follow a
certain course of action based on a
value selected by the user.
Loop control Allow you to repeat some statement
or a statement untill some condition
become false
Design for program to repetitively
follow a course of action until some
constraint puts a stop to it
FOP/ST0502 1 September 2018
Tutorial 1
2. Variables are computer memory locations that hold a data value. At any given time a
variable can only hold a single value. The value of a variable can vary (change) as a
program executes.
(i) State the value of X when each of the steps in the program is executed. What is
the program output?
Program Value of X
(1) 100
(2) 500
(1)
(3) 501
(2)
(4) Y=1002, X=501
(3)
(5) 501
(4) Output is
X=501 y=1002
(5)
(ii) State the value of X when each of the steps in the program is executed. What is
the program output?
Program Value of X
(1) 100
(2)101
(1)
(3)505
(2)
(4)y=1010
(3)
(5)505
(4)
(5)
FOP/ST0502 2 September 2018
Tutorial 1
3. Identify and fix the error in each of the Raptor flowcharts below:
(i)
Start
radius ← 1
area ← 3.14 * radius * radius
PUT "area="+area¶
End
(ii)
Start
radius ← 1
area ← 3.14 * radius * radius
PUT "area="+area¶
End
(iii)
Start
radius ← 1
area ← 3.14 * radius * radius
PUT "area="+area¶
End
FOP/ST0502 3 September 2018