Maintaining Programs Flashcards
What is a variable?
A named space in memory that can be referred to by an single identifier and that can be changed during execution of a program.
What is a constant?
A set value that can be referred to by a single identifier within the code, but cannot be changed.
This mean that the programmer only h as to change the value where the constant was declared, in order to alter it everywhere else in the code.
What is an identifier?
A meaningful name, by which things like variables, constants and functions are referred to within code.
What is a reserved word or keyword?
Reserved words or keywords are words that the programmer cannot use as identifiers because they are used by the actual programming language.
What things improve the design/understanding of the code of a program?
Comments Meaningful identifiers (variables, constants, functions) Indentation Line spacing Top down/modular design/programming
What is meant by the scope of a variable?
It refers to where in the code a variable that has been declared can be used.
A global variable is a variable declared in the main body of the source code, outside all functions, while a local variable is one declared within the body of a function or a block.
What is meant by intialisation?
This is where starting values are set for variables before it is used in the program.
This is because a declared variable that hasn’t had a value put into it may have garbage data in it which can cause an error. Often, it is simply a case of putting zero or an empty string into the variable using normal assignment statements.