paper 1 computer science Flashcards
what is a subroutine
‘out of line’ block of code that may be executed (called) by simply writing its name in a program statement.
what is the function of the parameters
allows data to be ‘ passed’ into a subroutine
what is a procedure
a subroutine that executes a specific task but DOES NOT RETURN A VALEUE
subroutines can either be ——- written or ————-
user written or pre - existing
what is a function
a subroutine that executes a specific task and DOES RETURN A VALEUE
what are pre existing / pre - defined subroutines
subroutines that are built in or imported from external libraries of code
what are examples of pre - existing / pre - defined subroutines
input () , len (), print()
what are libraries in subroutines
collections of pre- written subprograms for specific purposes that can be included in the program
what is a local variable
variable declared within a specific section of code eg as a function or procedure, and is accessible only within that subroutine = cannot be accessed / modified outside the subroutine where it was declared
AND ONLY EXIST WHILE THE SUBROUTINE IS EXECUTING
what is a global variable
variable that is declared outside of all subroutines or functions = accessible and modifiable throughout program, or within any subroutines.
what is the function of structured programming
helps to improve the quality and clarity of code
what are the 3 control structures
selection , iteration , sequencing
what are the advantages of subroutines
- code is more readable and easier to understand
- the flow ( the execution route ) is clear
- easier for programmers to work in parallel - they can code separate modules that don’t affect each other
- modules can be reused + code can come from different sources eg libraries
what is the purpose of testing
to find errors and determine ( then patch ) vulnerabilities
what is an error
an occurrence of unexpected result
what is a logic error
occurs when program’s execution appears to run as normal but not as the programmer intended
- hardest errors to detect / fix because they logic errors occurs when programmer has made a mistake while not realising
what is syntax
rules that influence the structure of sentences in language, specifically word order and punctuation/ grammar syntax
what is syntax error
the instructions written by the programmer do not meet the rules of the language). and so there is a mistake in the structure of the programming statements
what is a runtime error
errors that occur only during the execution of a program. eg running out of memory( run out of space in RAM )
what are the three categories which is used in test data
normal , boundary , erroneous
what is normal data
values that would be expected of a user to enter
what is boundary data
A pair of values at each end of a range: The data at the upper or lower limits of expectations that should be accepted.
what is erroneous data
test data that falls outside of what is acceptable and is invalid
what is an algorithm
sequence of instructions that perform a specific task when followed