2.2.1 Programming techniques- Callum Flashcards

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

What does sequence mean as a programming construct?

A

Code is executed line-by-line, top to bottom

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

What is selection?

A

when a certain block of code is run ONLY if certain conditions are met

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

what is iteration?

A

A block of code is repeated a certain number of times or until a condition is met

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

What loops are examples of iteration?

A

For, While, Repeat until

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

What is recursion?

A

A programming construct in which a subroutine calls itself over and over until a stopping condition is met.

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

What is an advantage of recursion?

A

Solutions can be represented in fewer lines of code that with iteration.

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

What are the downsides of recursion?

A

it has very inefficient memory usage due to creating copies of variables.

Recursion is also quite difficult to trace.

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

what is a local variable?

A

A variable that is accessible only in the subroutine in which it is defined.

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

Why is using local variables good programming practice?

A

It eliminates the danger of variables being affected by code outside of the subroutine.

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

What is a global variable?

A

A variable that is accessible throughout the whole program.

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

Why is using global variables not recommended in large programs?

A

They can be unintentionally altered by parts of the program.

They also take up more space in memory than local variables as they are not deleted after a subroutine is finished.

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

what is modular programming?

A

Modular programming is a technique used to split large, complex programs into
smaller, self-contained modules.

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

What are some advantages of modular programming?

A

makes it easier to split tasks between a team and manage projects.

simplifies the process of testing, as each component can be dealt with individually

improves the reusability of components

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

what is top-down design?

A

when a problem is continually broken down into sub-problems, until each can be represented as an individual, self-contained module which performs a certain task

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

What is another word for module in programming?

A

subroutine

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

What is passing by value?

A

when a copy of the value is
passed to a subroutine and discarded at the end. This ensures its value outside of the subroutine remains unaffected.

17
Q

What is passing by reference?

A

Passing by reference means that the
address of the parameter is given to the subroutine, so the value of the parameter will be updated at the given address.

18
Q

What is an IDE?

A

standing for Integrated Development Environment, it is a program which provides a set
of tools to make it easier for programmers to write, develop and debug code.

19
Q

By what process does a class make an object?

A

Instantiation

20
Q

What are some common features of an IDE?

A

*Stepping
This allows you to monitor the effect of each individual line of code by
executing a single line at a time.
*Variable watch
This allows users to observe how the contents of a variable change in
real-time.
*Breakpoint
IDEs allow users to set a point in the program at which the program will
stop.
*Source code editor
The editor provides features such as autocompletion of words,
indentation, syntax highlighting and automatic bracket completion.
*Debugging tools
Some IDEs also provide run-time detection of errors with a guide as to
where in the code they are likely to have occurred.