Programming techniques Flashcards

1
Q

what is a subprogram and what is its purpose?

A

small programs written inside of a larger, main program
-to perform a specific task

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

what are the 2 types of subprograms?

A

functions and procedures

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

why is a subprogram being small in size a benefit? (2)

A

-meaning they are much easier to write, test and debug.
-easy for someone else to understand.

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

why can saving a subprogram as a separate module be beneficial? (2)

A

-used again in other programs.
-saves time because the programmer can use code that has already been written, tested and debugged.

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

how can subprograms make programs more efficient? (2)

A

-may be used repeatedly at various points in the main program.
-the code only has to be written once, resulting in shorter programs

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

similarities and differences between procedures and functions?

A

similarities: performs a specific task
difference: functions return values/ data back to the main program, procedures do not

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