paper 2 theory part: Flashcards
How should variables and constans be used in a program?
have meaningful identifiers so future programmers understand their purpose
both used for data storage
constants store values that never change during the execution of a program
variables contain values that can change during the execution of the program
Explain why a programmer would use procedures writing a program.
store a collection of programming statements under a single identifier
to allow procedures to be re-used within the program
to make program creation faster
to make programs shorter with less duplicated code
Explain why a programmer would use parameters writing a program.
to pass values from the main program to a procedure / function to be used in the procedure/ function
allow the procedure / function to be re-used with different data.
Describe what happens when a function is called during the execution of a program.
A call statement is used, the function is called using its identifier
Parameters may be passed from the main program to the function to be used within the function
The function performs its task
returns a value to the main program
Explain why verification checks are used when data is input.
To ensure that data has been accurately copied
from one source to another
Purpose of test data
- check that the program works as expected
- check for logic errors
- check that the program rejects any invalid data that is input
- check that the program only accepts reasonable data
One dimensional array
one column of items
of the same data type
stored under a single identifier
with a single index to identify each element
purpose on indexing to search for value in array
- using a counter to index the array
- to check every element in the array using loop