Paper 2 Module 2 Flashcards

1
Q

What is recursion?

A

Recursion is when a subroutine (often a function) calls itself from within its own subroutine.

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

What should a recursive subroutine have?

A
  1. Contain a stopping condition
  2. For any input value other than the stopping condition, the subroutine should call itself (recursion).
  3. The stopping condition should be reachable within a finite number of times.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

4 Properties of a local variable.

A
  1. Declared inside a subroutine
  2. Only accessible by that subroutine.
  3. Created when the subroutine is called.
  4. Destroyed when the subroutine ends.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

4 Properties of a global variable.

A

1.Declared at the top of a program, outside any subroutine.
2. Accessible throughput the program.
3. Created when the program starts.
4. Destroyed when the program ends.

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

What is the definition of modularity.

A

Modularity is the concept of breaking a large program or problem down into smaller chunks.

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

What the difference between a procedure and a function?

A

A funtion returns a value and a procedure doesn’t

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

2 Properties of a procedure.

A
  1. Performs a set task.
  2. Takes in zero, one or more parameters.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

3 properties of a function.

A
  1. Performs a set task.
  2. Takes in zero, one or more parameters.
  3. Returns a value.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is a parameter?

A

A parameter is a special kind of variable used in a function to refer to one of the pieces of data provided as input to the function.

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

When passing data into a subroutine, what two methods can be used to do this.

A

Passing by value
Passing by reference.

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

what happens when you “pass by value”?

A

When a parameter is passed by value, the value created for the subroutine being called is a copy of the original.

This means that the value stored in original will not be edited by the subroutine.

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

what happens when a “passed by reference” method is used?

A

When a parameter is passed by reference, a pointer that contains the memory address of the original variable is created.

This means that any change to that value from within the called subroutine will also affect the value of the original variable.

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

What is the 5 letter statement in the exam for passed by value?

A

byVal

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

what is the 5 letter statement in the exam for passing by reference?

A

byRef

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

Common features of an IDE.

A
  1. Code editors
  2. Error disgnostics
  3. Run-time evironments
  4. Translators
  5. Auto-documentation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Name the 4 features that make a problem solvable.

A
  1. Abstraction and decomposition
  2. Enumeration
  3. Theoretical approach
  4. Simulation and automation
17
Q

What does abstraction and decomposition do when in context of making a problem solvable?

A

Applying techniques like abstraction and decomposition to simplify the complexity of a problem and break it down makes it far easier to write an algorythm to solve the problem.

18
Q

What does Enumeration do when in context of making a problem solvable?

A

Many problems, especially puzzles, can be solved using a method known as enumeration, which involves designing an algorithm that performs an exhaustive search and attempts all possible solutions until the correct one is found.

19
Q

What does Theoretical approach do when in context of making a problem solvable?

A
  1. if a problem can be boiled down to pure theory, it becomes easy to represent using mathematic equations.
  2. Of course, computers are great at maths, so these kinds of problems are great candidates for being solved by an algorithm.
20
Q

What does Simulation of automation do when in context of making a problem solvable?

A
  1. Simulation is the process of designing a model of a real system in an attempt to understand its behaviour.
  2. In computer science, automation is about building problem-solving models and puting them into action.
  3. Both simulation and automation tend to make heavy use of abstraction and are ways of turning complex problems into ones that can be more easily solved by algorithms.
21
Q

What is back tracking?

A

Backtracking is the process of incrementally building towards a solution, abandoning partial success when the solution can’t be completed and going back to a previously successful match.

22
Q

what is performance modelling?

A

It is the processes of approximating how well models perform using mathematics.