2.2 Flashcards

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
Q

What is a procedure?

A

A section of a program that performs a specific task, Doesn’t return a value

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

What is a parameter?

A

A placeholder representing data required by a function in order for it to run

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

What are the two ways to pass a parameter?

A

Value, Reference

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

What happens in passing by value?

A

A copy of the data is used by the function, The original data remains unchanged

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

What happens in passing by reference?

A

A location in memory is passed, changes to the data in the location remain

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

What does IDE stand for?

A

Integrated Development Environment

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

What is an IDE?

A

A program used for developing programs

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

What are the key features of an IDE?

A

Text editor, Translator, Debugging tools, Code completion, Pretty printing

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

Why is code completion useful?

A

Reduces syntax errors

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

Why is pretty printing useful?

A

Makes the code easier to read

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

What are the 5 debugging tools?

A

Inspection of variable values, break points, stepping, crash dump, stack contents

36
Q

How does stepping work?

A

Code is executed one line at a time

37
Q

How does a crash dump work?

A

IDE shows the variables state at crash point

38
Q

How do stack contents work?

A

Shows sequence occurring through a module

39
Q

What is data encapsulation?

A

Makes attributes private, but allows access through public methods

40
Q

What is a class?

A

A template from which objects are created

41
Q

What is inheritance?

A

A subclass can use the variables and methods of the super class

42
Q

What is polymorphism?

A

Using the same code to process different objects

43
Q

When can a problem be solved by computational methods?

A

Calculations, inputs and processes and outputs, logical reasoning

44
Q

What is decomposition?

A

The breaking down of a problem into smaller parts

45
Q

What are the benefits of decomposition?

A

More manageable, Easier debugging, Concurrent programming

46
Q

What is divide and conquer?

A

A technique that splits a big problem into smaller parts on each iteration

47
Q

What does abstraction involve?

A

Removing irrelevant data, Using symbols

48
Q

Why is abstraction used?

A

Reduces programming time

49
Q

Name an example of abstraction

A

Maps

50
Q

What is backtracking?

A

Where you fail to find a solution but you go back to the last successful step

51
Q

What programming paradigm is backtracking associated with?

A

declarative programming

52
Q

What is involved in declarative programming?

A

Centering around facts and rules

53
Q

What is data mining?

A

Examining large volumes of data to look for patterns and relationships

54
Q

What techniques does data mining use?

A

pattern matching, cluster analysis, anomaly detection

55
Q

Name an example of data mining

A

Reward cards in shops, banks, gene sequencing

56
Q

What are the benefits of data mining?

A

Fast, Effective use of data, No human error, increase sales

57
Q

What are the issues of data mining?

A

Needs powerful computers, risk of misuse, inaccurate storage causes inaccurate results, privacy issues

58
Q

What is heuristics?

A

Solving a problem with experience rather than analysing data

58
Q

What are the problems with heuristics?

A

Relies on past experiences, difficult to see alternative solutions

59
Q

What is performance modelling?

A

A simulation of how a system would work in real life

60
Q

Why are statistics used in performance modelling?

A

Models are based around existing relevant data

61
Q

Why is randomisation used in performance modelling?

A

Models uncertainty

62
Q

What are the benefits of performance modelling?

A

Cheaper, safer and faster than real life models

63
Q

What is pipelining?

A

A situation where the output of one process is the input of another

64
Q

Where is pipelining used?

A

In parallel processing, FDE cycle

65
Q

What happens in vertex processing?

A

Converts each vertex into a 2D screen position, lighting, vertex shader for transformations

66
Q

What are graphics pipelines?

A

Sequence of processing stages used to render graphics

67
Q

What happens in clipping?

A

Removing parts of the image that are not visible

68
Q

What is visualisation?

A

Presenting data in an easy to read format

69
Q

What is a linear search?

A

Each location is searched one after the other, starts at the beginning

70
Q

Where would a linear search be used?

A

Short lists, Unsorted data

71
Q

What are the disadvantages of a linear search?

A

Slower, less efficient

72
Q

What is a binary search?

A

Divide and conquer a list into two each time

73
Q

Where would a binary search be used?

A

Sorted data

74
Q

Which complexity is a binary search?

A

Logarithmic

75
Q

What is a ‘divide and conquer’ algorithm?

A

An algorithm that repeatedly breaks a problem down into smaller problems

76
Q

What are the sorting algorithms?

A

Bubble, Insertion, Merge, Quick

77
Q

How can a stack overflow error occur?

A

Recursive quick sort with a large data set

78
Q

What are the advantages of quick sort?

A

Efficient on large data sets, Efficient on completely unsequenced data

79
Q

What are the disadvantages of quick sort?

A

Hard to implement, Not good on partially sorted data, Not good with duplicate values

80
Q

What are the disadvantages of merge sort?

A

Slow on short lists, Uses more memory

81
Q

What are the advantages of merge sort?

A

Efficient and quicker than bubble and insertion, Consistent time

82
Q

What is a stack?

A

LIFO structure, Data added to the top

83
Q

What is a queue?

A

A FIFO structure

84
Q

What is a circular queue?

A

A queue that reuses memory

85
Q
A