2.1 Flashcards
what are local varibles?
variables which are declared withina specific subroutine and can only be used within that subrotoutine
what are global variables?
variables that can be used anywhere in the whole of the programm
what are local variable advantages?
- saves memeory- only uses memory when varibale is needed
- easier to debug
- you can reuse subrotines with local variables
what are the global variable advantages?
- variables can be used anywhere in the whole programm
- makes maintenance easier
- can be used for constants (values that remain the same)
what is a disadvatage of global variable
- global variables use memory whether they are used or not
kinds wastes the memory then
what is MOD and what is DIV
DIV is the whole number(//)
MOD is the remainder (%)
15//2 = 7 15%2=5 15/2 =7.5
what is input sanitisation?
Checking and cleaning up data
what is anticipating Misuse?
Planning ahead to take steps against potential misuse
Maintainable code?
Allowing other programmers to easily read and quickly understand code
what is validation
Checking whether input data follows specific criteria and should be accepted
what is Verification
Checking whether data that has been entered is correct
what is Authentication
Ensuring only authorised users can gain access to a system
what is used in defensive designing?
- validation
- verification
- authentication
- input sanitization
- anticipating missues
- maintainable code
what is used in validation?
- range check
- type check
- length check
- presence check
what is maintainability?
this is maintable code basically
- appropriate varibale name- to make sure the prupose of varibale is understood.
- comments- so progammer can udertsand purpose of each line of code.
- indentation- to improve readability and clearly show each ‘block’ of code.
- constants- This keeps the program code consistent, which makes it easier to read and debug a program.
what is a sytax error
- a mistake in the grammatical rules
- will prevent programm from being executed
example prant(“hello) missing commas and speeled print wrong
what is a logical error?
- mistake made by the programmer
- the programm will still run
- this will display the wrong output.
what is boundary data
Data at the extreme boundary of any data ranges
what is normal data
sensible data that the program should accept and be able to process.
inavlid data
Data of the correct data type that does not meet the validation rules (e.g. outside of the range). It should not be accepted.
what is erroneous data
- Data of the wrong data type that the program cannot process and should not accept.
what is high level langauge?
- similar to a natural human language
- easier to understand and use
- leads to fewer errors
- must be translated into machine code and cannot be directly executed by the cpu
what is low level language?
do not closely resemble a natural human language, making it harder for humans to understand and write
machine code is a type of low level language what does it do?
- binary code that computers can directly process and execute.
- executed faster than high-level programs
- perform a very specific command