2.2 Flashcards

(86 cards)

1
Q

What are the 3 programming constructs?

A

Sequence, selection, iteration

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

What is a sequence construct?

A

All code is executed once, one after the other

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

What is a selection construct?

A

A boolean expression is used to determine which block of code to execute next

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

What are the 2 types of selection constructs?

A

IF, CASE

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

What is a iteration construct?

A

A block of code repeated a set number of times, or until a boolean expression is met

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

What are the 4 main types of iteration construct?

A

FOR, WHILE, DO WHILE, REPEAT UNTIL

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

What is a for loop?

A

Counter controlled loop, repeats fixed number of times

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

What is a while loop?

A

Condition controlled loop, Repeats until condition is FALSE

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

What is a do while loop ?

A

Condition controlled loop, Condition checked after execution

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

What is a repeat until loop?

A

Same as do while

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

What is a recursive statement?

A

A subroutine that includes a call to itself

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

What is an advantage of iteration?

A

Memory efficient

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

What is an advantage of recursion?

A

Code is shorter and easier to read

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

What are the disadvantages of recursion?

A

Lots of memory used, Harder to trace

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

What is a variable?

A

An identifier that refers to a particular location in memory

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

What are the 2 types of variable?

A

Global, Local

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

What is a global variable?

A

Declared at the beginning of a program, Used in all subroutines in the program

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

What is a local variable?

A

Declared within a module, Can only used in that module

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

What happens if a local variable shares the same name as a global variable?

A

The local variable overrides the global variable

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

What are the disadvantages of global variables?

A

Duplicate names, Accidental overwriting, Increases complexity

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

What does modular mean?

A

A program broken up into individual modules

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

What are the benefits of modularity?

A

Easier to write/test/debug, Reusable, Collaboration

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

What are the two types of modules?

A

Functions, Procedures

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

What is a function?

A

A block of code with its own identifier that performs a specific task, returns a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is a procedure?
A section of a program that performs a specific task, Doesn't return a value
26
What is a parameter?
A placeholder representing data required by a function in order for it to run
27
What are the two ways to pass a parameter?
Value, Reference
28
What happens in passing by value?
A copy of the data is used by the function, The original data remains unchanged
29
What happens in passing by reference?
A location in memory is passed, changes to the data in the location remain
30
What does IDE stand for?
Integrated Development Environment
31
What is an IDE?
A program used for developing programs
32
What are the key features of an IDE?
Text editor, Translator, Debugging tools, Code completion, Pretty printing
33
Why is code completion useful?
Reduces syntax errors
34
Why is pretty printing useful?
Makes the code easier to read
35
What are the 5 debugging tools?
Inspection of variable values, break points, stepping, crash dump, stack contents
36
How does stepping work?
Code is executed one line at a time
37
How does a crash dump work?
IDE shows the variables state at crash point
38
How do stack contents work?
Shows sequence occurring through a module
39
What is data encapsulation?
Makes attributes private, but allows access through public methods
40
What is a class?
A template from which objects are created
41
What is inheritance?
A subclass can use the variables and methods of the super class
42
What is polymorphism?
Using the same code to process different objects
43
When can a problem be solved by computational methods?
Calculations, inputs and processes and outputs, logical reasoning
44
What is decomposition?
The breaking down of a problem into smaller parts
45
What are the benefits of decomposition?
More manageable, Easier debugging, Concurrent programming
46
What is divide and conquer?
A technique that splits a big problem into smaller parts on each iteration
47
What does abstraction involve?
Removing irrelevant data, Using symbols
48
Why is abstraction used?
Reduces programming time
49
Name an example of abstraction
Maps
50
What is backtracking?
Where you fail to find a solution but you go back to the last successful step
51
What programming paradigm is backtracking associated with?
declarative programming
52
What is involved in declarative programming?
Centering around facts and rules
53
What is data mining?
Examining large volumes of data to look for patterns and relationships
54
What techniques does data mining use?
pattern matching, cluster analysis, anomaly detection
55
Name an example of data mining
Reward cards in shops, banks, gene sequencing
56
What are the benefits of data mining?
Fast, Effective use of data, No human error, increase sales
57
What are the issues of data mining?
Needs powerful computers, risk of misuse, inaccurate storage causes inaccurate results, privacy issues
58
What is heuristics?
Solving a problem with experience rather than analysing data
58
What are the problems with heuristics?
Relies on past experiences, difficult to see alternative solutions
59
What is performance modelling?
A simulation of how a system would work in real life
60
Why are statistics used in performance modelling?
Models are based around existing relevant data
61
Why is randomisation used in performance modelling?
Models uncertainty
62
What are the benefits of performance modelling?
Cheaper, safer and faster than real life models
63
What is pipelining?
A situation where the output of one process is the input of another
64
Where is pipelining used?
In parallel processing, FDE cycle
65
What happens in vertex processing?
Converts each vertex into a 2D screen position, lighting, vertex shader for transformations
66
What are graphics pipelines?
Sequence of processing stages used to render graphics
67
What happens in clipping?
Removing parts of the image that are not visible
68
What is visualisation?
Presenting data in an easy to read format
69
What is a linear search?
Each location is searched one after the other, starts at the beginning
70
Where would a linear search be used?
Short lists, Unsorted data
71
What are the disadvantages of a linear search?
Slower, less efficient
72
What is a binary search?
Divide and conquer a list into two each time
73
Where would a binary search be used?
Sorted data
74
Which complexity is a binary search?
Logarithmic
75
What is a 'divide and conquer' algorithm?
An algorithm that repeatedly breaks a problem down into smaller problems
76
What are the sorting algorithms?
Bubble, Insertion, Merge, Quick
77
How can a stack overflow error occur?
Recursive quick sort with a large data set
78
What are the advantages of quick sort?
Efficient on large data sets, Efficient on completely unsequenced data
79
What are the disadvantages of quick sort?
Hard to implement, Not good on partially sorted data, Not good with duplicate values
80
What are the disadvantages of merge sort?
Slow on short lists, Uses more memory
81
What are the advantages of merge sort?
Efficient and quicker than bubble and insertion, Consistent time
82
What is a stack?
LIFO structure, Data added to the top
83
What is a queue?
A FIFO structure
84
What is a circular queue?
A queue that reuses memory
85