Sub Programs Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

2 types of sub programs

A

Procedures
Functions

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

Procedures

A

Set of instructions stored under 1 name

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

Functions

A

Set of instructions stored under 1 name
Always return a value

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

What are procedures and functions used for

A

To repeat a set of instructions throughout the program

Give program more structure + reliability

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

What are parameters?

A

Special variables used to pass values into a sub program
You can specify a name, data type, a default value

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

What are arguments?

A

The actual values that the parameters take when the sub program is called

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

What do all variables have?

A

Scope - tells you which parts of the program the variable can be used in

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

Local Variables

A

Only used within the structure that they are declared
Have a local scope

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

Global Variables

A

Can be used anytime after they are declared
Have a global scope

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

Where are local variables declared?

A

In sub program

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

Advantages of Local Variables

A

Do not affect anything outside the sub program

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

Disadvantages of Global Variables

A

Hard to keep track of its value in large programs

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