2.2.1 Programming Techniques Flashcards
What is a procedural programming language?
High level language
Given a series of instructions in a logical order
Explain parameter passing? [5 marks]
Parameters passed by value or by reference
By value, local copy of data is used then discarded… so value of original data is unchanged
By reference, location of data is used….so changes may be made to value of data
Describe the use of local variables
Defined within one module…accessible only in that module
Can be used as parameters
Data is lost at the end of the module
Same variable name can be used in other modules without overwriting
Can overwrite global variables
What are 3 differences between global and local variables?
Global are defined at the start of a program
Exist throughout program
Allows data to be shared by modules
What is a variable?
Identifier of a memory location used to store data
What is meant by scope in relation to global and local variables?
Range of procedure/function that variable is valid for
A local variable takes precedence over a global variable with the same identifier to be used for different purposes without conflict
What are the advantages of writing an application in a modular approach? [6 marks]
Work is easier to divide between a team
Each team member just needs to know what values go into their sub routine
Saves time as work takes place in parralel
Each team member can work on their area of expertise
Breaks problems into smaller areas
Easier to test and debug
Each subroutine can be tested before integration
Code can be reused in future projects
What are 6 features of IDEs?
Auto complete
Colour coding text
Stepping
Breakpoints
Variable watch
Error diagnostics
What does auto complete allow programmers to do?
Can view identifiers and avoid spelling mistakes
What was colour coding text allow programmers to do?
Can identify features quickly to check if code is correct
What does stepping allow programmers to do?
Run one line of code at a time and check results
What does breakpoints allow programmers to do?
Stop the code at a set point to check value of variables
What does variable watch allow programmers to do?
Check values of variables and how they change during the execution
What do error diagnostics allow programmers to do?
Locate and report errors and give details on errors