Subroutines, local and global variables Flashcards

1
Q

What is a subroutine/procedure?

A

A named block of code designed to carry out a specific task

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

What is a local variable?

A

A variable that is available only in specified subroutines

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

What is a global variable?

A

A variable that is available anywhere in the program

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

What is a module?

A

A number of subroutines that form part of a program

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

What is a function?

A

A subroutine that returns a value

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

What is functional programming?

A

A programming paradigm that uses functions to create programs

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

What is an argument?

A

A value passed to a subroutine

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

What is a parameter?

A

The receiving variable of an argument in a subroutine

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

Give three advantages of using local variables over global variables

A
  • The value cannot inadvertently be changed somewhere else in the program
  • The same variable name can be used multiple times in different sections
  • Each time a local variable is finished with, it gets removed from memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is exception handling?

A

The process of dealing with events that cause the current subroutine to stop

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