chapter 11 Flashcards
input
entering data into a system
process
manipulate or change data in some way, perform a calculation, find a result
output
send data out from the system, display or print data
variable
a variable is a storage location with an identifier. the value of the variable can change.
constant
a constant is a named storage location. the value of the constant can not change.
types of loops
count controlled
pre-condition
post-condition
count-controlled loop
Iterates a set number of times. A FOR loop.
post-conditional loop
a post-conditional loop must run at least once. the condition is evaluated at the end. A REPEAT…UNTIL loop
pre-conditional loop
the pre-conditional loop doesn’t always run. this evaluates the condition at the start. A WHILE loop
logic statement examples
- IF…THEN…ELSE…ENDIF
- CASE OF…OTHERWISE…ENDCASE
CASE statement
a selection of multiple pathways
each condition can be:
* a single value
* single values separated by commas
* range
CASE OF <expression>
<value1>: <statement(s)>
<value2>, <value3>: <statements(s)>
<value4> to <value5>: <statement(s)>
OTHERWISE <statement(s)> //optional; used for error trapping
ENDCASE</value5></value4></value3></value2></value1></expression>
modular programming
process of subdividing a computer program into separate sub-programs.
modules
separate software component
subroutine
a set of instructions that performs a specific task as part of a larger program.
procedure
a subroutine that doesn’t return a value
PROCEDURE <identifier> (<parameter1>: <dataType> …)
<statement(s)>
ENDPROCEDURE</dataType></parameter1></identifier>
CALL <identifier></identifier>
function
a subroutine that returns a value
FUNCTION <identifier (<parameter1>: <dataType> …) RETURNS dataType
<statement(s)>
ENDFUNCTION</dataType></parameter1>
call ← identifier()
types of passing parameters
by value and by reference
by value
a copy of the value is passed into the subroutine. the actual variable will not be affected.
BYVAL <identifier1> : <dataType></dataType></identifier1>
(inside heading) BYVAL <identifier1> : <dataType></dataType></identifier1>
by reference
a pointer to the memory location of the variable where the value is stored is passed into the subroutine. the actual data inside the variable will be affected by any changes made.
BYREF <identifier1> : <dataType></dataType></identifier1>
(inside heading) BYREF <identifier1> : <dataType></dataType></identifier1>