1/22
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a subroutine?
a set of instructions with a name
What is a function?
A subroutine that returns one or more values using the return keyworrkf
What is a prodecure?
does not return a value
What are built-in functions
built in functions that perform complex task
What is the module library?
•libraries of pre-defined subroutines
What are the arguments in parentheses used for?
•Arguments in parentheses are used to pass data to a subroutine
Where do parameters appear?
in subroutine definitions
Where do arguments appear?
in subroutine calls
What are local variables
variables that were declared inside a program
What are global variables
variables declared in the main program. They are not indented
What does pass by value mean?
•that the actual value of the argument in the calling statement is copied to the variable parameter in the subroutine
What does pass by reference mean?
the address of the argument in the calling statement is passed to the corresponding parameter in the subroutine
What is the difference between functions and procedures
a function can return the value of the variable whilst a procedure does not have a return function
Why do we try to make the subroutines to only complete one task
makes the code reusable by anyone
What is a variable scope
•When a variable is in scope
the values can be accessed
What is a global variable?
•is defined in the main program and can be used in any subroutine called from the main program
What is a local variable?
•A local variable can be used only in that subroutine
What is the scope of a local variable ?
is the subroutine in which it is declared in
what are the advantages of local variables?
the subroutine is independent of a particular program and can be re used in different programs
no chance of accidentally changing a variable
What is modular programming?
breaking down a major task into smaller sub tasks and doing so until each ‘module’ performs a single function
What are the advantages of modular programming?
•Programs are more easily and quickly written
•Large programs are broken down into sub tasks that are easier to program and manage
•Each module can be individually tested
•Modules can be re-used several times in a program
•Large programs are much easier to debug and maintain