Unit 2 - Problem Solving Flashcards

(34 cards)

1
Q

What is computational thinking?

A

The ability to think logically about a problem and apply techniques for solving it.

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

What are some methods of problem solving?

A

Simulation,
Enumeration – list all cases,
Trial and error,
Theoretical approach,
Creative solution.

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

What is simulation?

A

The process of designing a model of a real system in order to understand the behaviour of the system, and to evaluate various strategies for its operation.

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

What is ennumeration?

A

Listing all possible answers to a problem.

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

What is decrease/divide and conquer?

A

A strategy for algorithm design focused on finding a solution to a sequence of smaller, related problems until the instance is small enough to be solved directly.

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

What is structured programming?

A

Structured programming is a method of writing a computer program which uses:
- Top-down analysis for problem-solving,
- Modularisation for program structure and organisation,
- Structured code for the individual modules.

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

What is structured code?

A

Code which follows the following characteristics:
- Sequence: Ordered statements or subroutines executed in sequence,
- Selection: One of a number of statements is executed depending on the state of the program, typically using if/then/else constructs,
- Iteration: A statement or block is executed repeatedly until a certain condition is met, using constructs like while, for, or do/until.

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

What is modularisation?

A

Splitting a program into various modules which have various functions and can be reused.

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

What is top-down design?

A

Looking at the goal of a program, and splitting that up repeatedly into differing tasks, each being its own module and performing a single function.

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

What are the benefits of structured programming?

A
  • Large programs are broken down into subtasks that are easier to program and manage,
  • Each module can be individually tested
    Modules can be re-used several times in a program,
  • Frequently used modules can be saved in a library and used by other programs,
  • Several programmers can simultaneously work on different modules, shortening development time,
  • Programs are more reliable and have fewer errors,
  • It is easier to find errors in small self-contained modules,
  • Programs take less time to test and debug,
  • Programs are easier to maintain,
  • A well-organised, modular program is easier to follow,
  • It is easier to find which module needs to be changed,
  • Self-contained modules mean that the change should not affect the rest of the program,
  • New features can be added by adding new modules.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are some examples of good programming practice?

A
  • Use meaningful names for variables and subroutines,
  • Add lots of comments to explain each module,
  • Each module should perform a single task,
  • Selection and iteration structures should have single entry and exit points,
  • Keep each module self-contained by passing parameters and using local variables in subroutines.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are some problems solved by algorithms?

A
  • Routing problems such as routing packets of data around the Internet by the shortest route and finding the shortest route for a salesman to cover his territory,
  • Timetabling commercial aircraft crews so that they do not exceed their permitted flight hours,
  • Searching information on the Internet or from a database,
  • Encrypting communications so that they cannot be hacked,
  • Sorting large amounts of data,
  • Writing a compiler program to translate a high level language to machine code.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the properties of a good algorithm?

A

A good algorithm:
- has clear and precisely stated steps that produce the correct output for any set of valid inputs,
- should allow for invalid inputs,
- must always terminate at some point,
- should execute efficiently, in as few steps as possible,
- should be designed in such a way that other people will be able to understand it and modify it if necessary.

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

What is bubble sort?

A

A simple sorting algorithm which works by passing through a list repeatedly, and swapping items around when the former is larger than the latter.

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

What is merge sort?

A

A complex sorting algorithm which works by splitting a list into multiple sublists each containing one individual item, and then merging these sublists, placing the items in order as the lists are merged.

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

What is linear search?

A

A simple searching algorithm which passes through each item in a list in order and checks each one for what it is looking for, stopping when it finds what it is looking for or when the list ends.

17
Q

What is binary search?

A

A complex searching algorithm which requires a sorted list. It examines the middle item, sees whether it is smaller or larger than the desired value, and discards the side which the value is not on. This repeats until the value is found or there is no more list to search.

18
Q

What is the purpose of testing?

A

The purpose of testing software is to reveal errors.

19
Q

What are the typical stages of testing?

A

The typical stages of testing are:
- Module testing: make sure each subroutine works correctly,
- Program testing: make sure each program in the system works correctly,
System testing: make sure the whole system works as expected, and does what the original specification required.

20
Q

What is normal data?

A

The data that would typically appear in a programs typical use.

21
Q

What is boundary data?

A

The data that could work with the program, but is on the limits of what should work and likely won’t appear in typical use.

22
Q

What is erroneous data?

A

The data which will not work with a program and will cause an error.

23
Q

What is hand-tracing?

A

Going through a program manually and figuring out what each step will do.

24
Q

What is a trace table?

A

A table used to write down the contents of each variable as it changes during execution.

25
What are the uses of hand-tracing?
- Figuring out how an algorithm works, - Finding out why an algorithm is not working properly.
26
What is abstraction?
The simplification of a problem or algorithm to only the necessary details needed for it.
27
What is automation?
The building models of real world objects or phenomena in order to solve a particular problem.
28
What is decomposition?
The process of breaking a problem into a number of sub-problems, so that each sub-problem accomplishes an identifiable task.
28
What is composition?
The process of combining procedures to form a compound procedure or combining data objects to form compound data objects.
29
What is procedural abstraction used for?
Procedural abstraction is used to keep the actual values used in a computation separate from the overall design.
29
What is a finite state machine?
It is an abstract representation of how something changes from one state to another in response to a condition or event. In a finite state machine (FSM): - The machine can only be in one state at a time, - It can change from one state to another in response to an event or condition; this is called a transition, - The FSM is defined by a list of its states and the conditions for each transition, - There can be outputs linked to the FSM’s state.
30
What are some applications of FSMs?
- Robotics, - Video games industry, - Design of digital hardware systems, - Design of compilers and network protocols, - Definition of languages, and to decide whether a particular word is allowed in a language.
30
What is a finite state automaton?
A FSM which has no output is known as a finite state automaton, it has a start state and a set of end or accept states, If the automaton can reach a final state, it is said to accept the input. Starting in an initial state, the automaton processes a sequence of symbols and follows it to the target state, the symbols depend on the application – they usually represent events.
31
What is a state transition table?
An alternative representation of a FSM, showing the states, inputs and outputs linked together in a table.