Paper 2 Flashcards
variable
named locations that store data in which the contents can be changed during program execution
local variable
declared inside a function. They can only be accessed and used in that function.
global variable
declared outside of all the functions, they can be used throughout the whole program including inside functions.
advantages of functions
easier to create and test
subprogram
self-contained units of code that perform some well-defined purpose.
function
a subprogram that ALWAYS returns a single value
procedure
a subprogram that returns one or many values.
parameter
the data that is supplied to a subprogram so that they can be reused
passing by reference
the address of the variable is passed to the subprogram.
if the variable is changed it stays changed.
passing by value
a copy of the variable is passed to the subprogram. The original variable is unchanged no matter what the subprogram does.
binary search precondition
the list needs to be sorted
Insertion sort
works by dividing a list into two groups: sorted and unsorted. Elements are inserted one by one into their correct position in the sorted section.
thinking abstactly
represents reality by recognising what is important and blocking out other details
thinking ahead
planning input and outputs e.g. caching
caching
a temporary store where data and instructions or data that are likely to be needed are stored.
Thinking procedurally
writing in modules to split a problem up into manageable tasks
Thinking Logically
inferring things from what you already know and understanding where decisions need to be made and their consequences
Thinking concurrently
thinking about how a job might be done better if some parts were performed at the same time.
features of an IDE
- Auto-complete
- colour coding/ syntax highlighting
- stepping
- breakpoints
- watch window
- error diagnostics
features of an IDE: Auto-complete
recognises identifiers
features of an IDE: colouring syntax
identifies different features making the code easier and quicker to check
features of an IDE: stepping
runs one line at a time to check the result, good for error checking
features of an IDE: breakpoints
stops the code at set points to check the value of variables, good for error checking
features of an IDE: watch window
tracks how variables change during the execution