Maintaining Programs Flashcards

1
Q

What is a variable?

A

A named space in memory that can be referred to by an single identifier and that can be changed during execution of a program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a constant?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an identifier?

A

A meaningful name, by which things like variables, constants and functions are referred to within code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a reserved word or keyword?

A

Reserved words or keywords are words that the programmer cannot use as identifiers because they are used by the actual programming language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What things improve the design/understanding of the code of a program?

A
Comments
Meaningful identifiers (variables, constants, functions)
Indentation
Line spacing
Top down/modular design/programming
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is meant by the scope of a variable?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is meant by intialisation?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly