SLR 23/ Programming Techniques Flashcards

1
Q

Define Global Variables

A

Global variables are declared outside any procedure or function and can be accessed by any routine in the program.​

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

Define Local Variables

A

Local variables are declared inside a procedure or function and can only be used inside that routine. It is possible to have local variables with the same name in different routines – they are not seen as the same variable in memory.​

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

Define the Scope

A

The scope of a variable refers to where it is accessible in the code. The scope is global or local.​

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

Factors of Global Variables

A

Global variables are kept in memory for the entire time the program is executing – this means the program is not using memory dynamically and is possibly using more memory than it needs.​

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

Factors of Local Variables

A

Local variables make it easier for different programmers to work on the same program, as their procedures will not conflict if they use same-named variables. This makes it easier to copy code from one program to another.​

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

Define the factors of Procedures (Subroutines)

A

Used to break a program down into manageable sections.​

Makes the program easier to read and debug.​

Facilitates use of local variables.​

Enables different programmers to work on different parts of the code.​

Allows routines to be reused in other programs.​

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

Define the factors of Functions

A

small routines that perform operations on input data (parameters) and return a result.​

Can be called as often as needed, reducing the need for duplicated code.​

Building blocks that enable larger programs to be written using reusable code routines.​

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