4.1 Fundamentals of Programming Flashcards

Cover all of topic 4.1

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

What is the difference between a variable and a constant?

A

A variable has a value that can be changed during execution, a constant’s value stays the same.

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

What are advantages of using named constants in programming?

A

Avoid repetition of important values.

Easier to remember the constant name than its value.

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

What is a subroutine?

A

A named ‘out of line’ block of code that may be executed by writing its name in the program

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

What are advantages of using subroutines in programs?

A

Decomposes the program into several parts making it easier to solve problems.
Easier to debug.
Easier to understand the code.

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

What is the scope of a local variable?

A

Within its subroutine.

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

When does a local variable exist?

A

Only when the subroutine it is in is running.

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

Why is it good practise to use local variables (instead of global ones)

A

Local variables only take up memory space whilst their subroutine is run.

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

Describe a class

A

Something that defines methods and properties which capture the behaviour and common characteristics of objects.

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