Paper 2 Module 2 Flashcards
What is recursion?
Recursion is when a subroutine (often a function) calls itself from within its own subroutine.
What should a recursive subroutine have?
- Contain a stopping condition
- For any input value other than the stopping condition, the subroutine should call itself (recursion).
- The stopping condition should be reachable within a finite number of times.
4 Properties of a local variable.
- Declared inside a subroutine
- Only accessible by that subroutine.
- Created when the subroutine is called.
- Destroyed when the subroutine ends.
4 Properties of a global variable.
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.
What is the definition of modularity.
Modularity is the concept of breaking a large program or problem down into smaller chunks.
What the difference between a procedure and a function?
A funtion returns a value and a procedure doesn’t
2 Properties of a procedure.
- Performs a set task.
- Takes in zero, one or more parameters.
3 properties of a function.
- Performs a set task.
- Takes in zero, one or more parameters.
- Returns a value.
what is a parameter?
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.
When passing data into a subroutine, what two methods can be used to do this.
Passing by value
Passing by reference.
what happens when you “pass by value”?
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.
what happens when a “passed by reference” method is used?
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.
What is the 5 letter statement in the exam for passed by value?
byVal
what is the 5 letter statement in the exam for passing by reference?
byRef
Common features of an IDE.
- Code editors
- Error disgnostics
- Run-time evironments
- Translators
- Auto-documentation
Name the 4 features that make a problem solvable.
- Abstraction and decomposition
- Enumeration
- Theoretical approach
- Simulation and automation
What does abstraction and decomposition do when in context of making a problem solvable?
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.
What does Enumeration do when in context of making a problem solvable?
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.
What does Theoretical approach do when in context of making a problem solvable?
- if a problem can be boiled down to pure theory, it becomes easy to represent using mathematic equations.
- Of course, computers are great at maths, so these kinds of problems are great candidates for being solved by an algorithm.
What does Simulation of automation do when in context of making a problem solvable?
- Simulation is the process of designing a model of a real system in an attempt to understand its behaviour.
- In computer science, automation is about building problem-solving models and puting them into action.
- 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.
What is back tracking?
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.
what is performance modelling?
It is the processes of approximating how well models perform using mathematics.