2.2.1) Programming techniques Flashcards

1
Q

what are the advantages of recursion?

A
  • can be represented if you line code, became a less different to errors
  • Elegant and compact
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

disadvantages of recursion

A

Inefficient use of memory, danger stack overflow, difficult to trace

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

What is tail recursion?

A

A form of recession which is implemented in a more efficient way so less stack space is required

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

what is a scope?

A

The section of a code in which a variable is available

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

What is a local variable?

A

A variable which can only be accessed within the block of code in which it was defined

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

Why is using local variables good practice?

A

Ensure functions are self-contained, no danger variables being affected by code outside subroutine

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

What is a global variable?

A

A variable that can be accessed across the whole program. Useful for values that need to be used by multiple parts of the program.

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

Why aren’t global variables recommended?

A

They can be overwritten by accident, they take up more memory.

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

What happens when a parameter is passed by value?

A

A copy of the value is passed to the subroutine and discarded at the end, therefore its value outside of the subroutine will not be affected.

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

what happens when something is passed by reference?

A

the address of the parameter is given to the subroutine so the value will be updated to the given address

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

What is an IDE?

A

A program which provides a set of tools to make it easier for programmers to write, develop and debug a code.

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

What are some common features of IDEs?

A

Stepping, Variable watch, Breakpoint, Source code editor, Debugging tools

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

What is Stepping?

A

monitoring the effect of each individual line of code

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

What is variable watch?

A

Feature to observe how the contents of a variable can change

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

What is Breakpoint?

A

A feature allowing users to set a point in the code where the code will stop

18
Q

What is a Source code editor?

A

Usability features like auto completion of words, indentation, syntax highlighting and automatic bracket completion

19
Q

What are debugging tools?

A

run time detection of errors that guide to the location of the error

20
Q

What is a class?