Subroutines Flashcards

1
Q

What is a subroutine?

A

Subroutines are smaller, named sections of code that are written within a larger program

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

What are the advantages of sub routines?

A

Avoid duplicating code and can be reused throughout a program.
Improve the readability and maintainability of code.
Perform calculations, to retrieve data, or to make decisions based on input.

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

Why is it good practise to use local variables?

A

Using local variables rather than global variables makes it easier to debug a program as the value of that variable can only be read or changed within one subroutine.

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

What are the advantages of structured programming?

A

allows other programmers to easily follow the code that you have written.
less likely to contain logic errors.
Errors are more easily identified.

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