Thinking abstractly. Flashcards

1
Q

What is recursion

A

A function that calls its self with a function

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

List 2 difference betwen global and local variables.

A

Global variables are visible throughout the program and can be accessed throughout the program. Whilst local variables are only visiable from within the module.

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

Why it is better practice not to use global variables?

A

Global variables make it difficult to integrate modules.

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

Why is it better to use parameters passes to the function rather than global variables?

A

Only a copy of the data is passed to the function. So no unforeseen changes will be made to the data.

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

Describe what is meant by a function?

A

A function is named section of a program that performs a specific task and returns a value oftern called inline.

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

What is a procedure?

A

A name section of a program that performs a specific task and does not return value, Most programming languages nowadays use functions.

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

What is a parameter?

A

A parameter is the name of the information we want to use in a function or procedure. The values passed in are called arguments and they are usally passed by value, so only a copy of the data is used within the function.

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

What is pass by reference

A

when a function points to the actual value in memory so if changes are made to the variable, they remain when the function ends.

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

What is pass by value?

A

When a function uses a copy of value so if changes are made only the local copy is amended.

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