Problem solving and programming 2.2 Flashcards
Name the three programming constructs
- Sequence
- Selection
- Iteration
What is sequence?
Sequence is the order in which instructions occur and are proccessed
What does selection do?
Selection determines which path the program takes
What is iteration?
iteration is the repeated excecution of a section of code when a program is running
Which two categories of loop are iteration split up into?
- Count controlled(for loop)
- Condition controlled(while loop)
What is recursion?
Where a subroutine call itself during excecution until the stopping condtion is met
State two advantages of recusion
- Can be represented in fewer lines of code
2.Easier to express some functions recursively than using iteration
State two disadvatages of recursion
- Inefficent use of memory
2.Difficult to trace - Danger of stack overflow
Define scope
The section of the program in which a variable is accessible
Give two advantages of using local variables over global variables
- Less memory is used
2.Take priority over global variables with the same name - uneffected by code outside of the subroutine
What is the difference between a procedure and a function?
Functions must always return a single value, while procedures do not always need to return a value
What does it mean to pass in a parameter (to a subroutine) by reference?
The address in memory of the parameter is passed to the subroutine so the value outside the subroutine will be updated
The value in the parameter is changed
What does it mean to pass in a parameter (to a subroutine) by value?
The value stored inside memory location is passed into the function
The variable outside the function does not change
What are IDE’s?
Integrated development environment is a software application that provides a comprehensive set of tools. They are useful tools for software developers
What does IDE stand for?
Integrated Development enviornment
State two features of IDEs
- Debuggin tools
- Source code editior
- Breakpoint
- Variable watch
What is encapsulations in OOP?
When attributes and methods are declared as private so they can only be accessed by setters and getters
What is the purpose of encapsulation in OOP?
Program complexity is reduced by protecting data from being accidentally editied from other parts of the program
What is Inheritance in OOP?
Inheritance is when a child class inherits its methods and attributes from the parent class
What is polymorphism?
When two mehods in two different classes share the same name and purpose
What is it meant by a computable problem?
A problem that can be solved using an algorithm
Give three limiting factors of computable problems
- Time
- Proccessing power
- Processor speed
- Computer memory
Describe how divide and conquer techniques work
The problem size is halfed with each iteration. Each individual subroutine is solved recursively. Then they are recombined
Give two applications of divide and conquer
- Quick sort
- Merge sort
- Binary search
State 4 problem solving techniques
- Abstraction
- pipelining
- Divide and Conquer
- Data Mining
- Backtracking
- Visualisation
- Decomposition
Describe how backtracking work
It works by visiting each path and building a solution based on the paths found to be correct. if a path is invalid, it backtracks to the previous stage and visits an alternative path
Backtracking is useful in computer science because it allows you to efficiently find a solution to a problem by exploring all possible options and discarding those that are not valid.
When may heuristics be used in problem solving
when the standard way is time and resource consuming
State two advantages of using performace modelling
- Safe
- less time consuiming
- inexpensive
What is performace modelling?
The process of evaluating if a system or a program works as expected, before it is released.
What is pipelining
Pipelining is the process of completing the fetch, decode, and execute cycles of three separate instructions simultaneously
What is Data mining?
The process of finding meaningful patterns and valuable information within large data sets.
What is a class in OOP?
A class is a blueprint for creating objects
What is a method in OOP?
Methods define the behaviour and functionality of objects in the class
What is an attribute in OOP?
Attibutes define the characteristics of objects in a class
What is a constructer?
A special method that is called when an object is created from a class. It is used to initalize the objects attributes
What are IDE’s?
IDE’s is a software application that provides a comprehensive set of tools. They are useful tools for software developers