A simple procedure
IS:
a separate block
of
code
properly named. (two points)
A procedure call ensures
that:
ANSWERS
TO
SELF
TEST
ON
CHAPTER
7
1.
2.
3.
4.
We
normally break down large or complex jobs into smaller
tasks
until
they are
small
enough
to
be
completed.
This
principle can be applied
In
programming by breaking the
total
Job
down and
writing a procedure
for
each
task.
FOR SERVICE MANUALS
CONTACT:
MAURITRON
TECHNICAL
SERVICES
www.mauntron.co.uk
TEL: 01844 -
351694
FAX:
01844
-
352554
•
110
CHECK
YOUR
SCORE
the procedure
is
activated
control returns
to
Just
aher the calling pOint
(two
pOints)
5 Procedure names can be used
in
a main program before the procedures have
been written.
ThiS
enables you
to
think about the whole job and get
an
overview
without worrying about the. detail.
6.
It
you
write a procedure definition before
uSing
its
name
you
can test
it
and then
when
It
works properly forget the details.
You
need only remember
its
nar;e
and
roughly what
It
does.
7.
A programmer who can
write
up
to
thirty line programs can break down a complex
task into procedures
in
such a
way
that none
IS
more than thirty lines and most
are
much
less.
In
thiS
way
he need only worry about one bit
of
the
Job
at
a
time.
8.
The use
of
a procedure would
save
memory space
if
It
is
necessary
to
call
it
more
than once
from
different parts
of
a program.
The
definition
of
a procedure only
occurs once but
It
can
be
called as
ohen
as
necessary
9 A main program can place Information
,n
'pigeon-holes' by means
of
LET
or
READ
statements.
These 'pigeon-holes' can be accessed
by
the procedure. Thus the
procedure uses Information Originally
set
up
by
the main program.
A second method
is
to
use parameters
In
the procedure
call.
These values are
passed
to
variables
in
the
procedure definition which then uses them
as
necessary.
10
An
actual parameter
is
the actual value passed
from
a procedure call
in
a main
program
to
a procedure.
11.
A formal parameter
is
a variable
In
a procedure definition which receives the value
passed
to
the procedure by the main program.
This
is
a searching
test.
You
may need more experience
of
uSing
procedures before
the ideas can
be
tully appreciated. But they
are
very powerful and, when understood,
extremely helpful
Ideas.
They are worth whatever effort
is
necessary
12
to
14
excellent. Read on
with
confidence.
10
or
11
very good. Just check again
on
certain
points.
8 or 9 good but re-read some parts
of
chapter
seven.
6 or
7.
fair
but re-read some parts
of
chapter
seven.
Work carefully through the programs
writing down
all
changes
In
variable
values.
Then do the test again.
Under 6 read chapter seven again.
Take
It
slowly working
all
the programs. These ideas
may not be easy but they
are
worth the
effort.
When
you
are
ready,
take
the test again.
12/84
•
•
•