Functions and procedures Flashcards

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

Procedure

A

A procedure is a piece of code that you can run whenever you want

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

Function

A

A function is just like a procedure but one that sends an answer back

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

Subroutine

A

A seperate block of code that can be re=used

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

call

A

A line of code that runs a subroutine

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

Parameter

A

A value that a subroutin expects to be given when called

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

Why use subroutine?

A

They are useful to break up large programs into self-contained chunks

Each subroutine can be tested seperatley to make sure it works correctly

Many programmers can work on large program at the sae time, cutting development time

some subroutines can be re-used in other programs

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

2 key differences between procedures and functions

A

A function uses parameters to transfer data from the main program into the functiom
A function returns a value into the main program

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

Subroutines benefits

A

Make programs easier to read

  • They reduce the duplication of code
  • complex problems are broken down into smaller chunks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly