2.2.1 - programming techniques Flashcards
11
algorithm
A set of rules or a sequence of steps specifying how to solve a problem.
variables
Identifiers (names} given to memory locations whose contents will change during the course of the program.
2 reasons why variable names should be standardised
- makes the program easy to follow and update when required.
- leaves less room for errors and
inconsistencies in the names in a large program
3 basic programming constructs
- sequence
- selection
- iteration
define sequence
just two or more statements executed one after the other
define selection
used to select which statement will be executed next, depending on some
condition
iteration
involves performing a
loop in the program to repeat a number of statements
3 types of loops
- while…endwhile
- repeat…until
- for…next
integrated development environment (IDE)
A single program used for developing programs made from a number of components.
compiler/ interpretor
Translates high level code into machine code.
3 IDE tools to spot logic errors
- breakpoint
- watch
- step through
subroutine
A named block of code which performs a specific task within a program.
2 types of subroutines
- functions
- procedures
function
A named section of a program that performs a specific task. Returns a value.
procedure
Performs a task but doesn’t return a value.
by value
A copy of the variable is passed to the subroutine. Changing a parameter inside the subroutine will not affect its value outside the subroutine.