Unit 4 Flashcards

1
Q

Identify inputs and outputs required in a solution

A

Cycle: Input; Processing; Output; Feedback

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

Sequential

A

Following in logical orders/sequences

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

Preconditions

A

Constrains the state of a system before the next sector of code starts

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

Post conditions

A

Conditions after code has been executed

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

What to do if there’s an exception?

A

Inform developer; then crash

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

What to do if there’s an error?

A

Inform user; but keep running

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

Concurrent

A

When two or more processes are using the same resources at the same time

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

Describe how concurrent processing can be used to solve a problem

A

Increases: Computation speed; Complexity of programming language and hardware. Reduces: Complexity of array operations within loops; matrix multiplication/ sorting/ merging files. I(CS; CPL; H) R(CAOL; MM; S; MF)

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

How do you evaluate the decision to use concurrent processing in solving a problem?

A

Saved or wasted time? Saved or spent money? Physically possible? Consequence of not doing it?

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

Advantages of concurrency

A

Time Cost

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

Disadvantages of concurrency

A

May get in each others way Harder to supervise

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

Abstraction

A

Removing characteristics from something in order to reduce it to a set of essential characteristics. It’s a technique for managing complexity.

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

Why is abstraction required?

A

Reduces complexity; enables concentration on essential; ignores distracting details and essential to problem solving.

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

How to distinguish between real and abstract?

A

DETAILS

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

IB assumptions about collections are

A

Unordered lists Unknown length

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

Operations (5 PseudoCode operations)

A

.addItem() .resetNext() .hasNext() .getNext() .isEmpty()

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

.addItem()

A

Adds an item to the collection

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

.resetNext()

A

Starts at the beginning of the collection

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

.hasNext()

A

To see if it has another item

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

.getNext()

A

retrieves next data point from collection

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

.isEmpty()

A

Checks whether its empty

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

Most efficient search algorithm?

A

Binary; Olog(N) notation; only works on sorted lists

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

Sequential search

A

Slower; O(N) notation

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

Bubble sort

A

Quits early if no swaps occur; but LOTS of swaps happen. O(N^2)

25
When bubble sorting on a list
Compares and swaps every two numbers
26
Selection sort
No quit early; always N passes. O(N^2)
27
Flow chart shapes (bubble; parallelogram; rectangle and diamond)
Bubble: Terminator Parallelogram: Input/ Output Rectangle: Process Diamond: Decision
28
What effects run time?
Hardware Abstract data types Compiler Efficiency Programmers skills Complexity Size of input (H; ADT; CE; PS; C; IS)
29
Worse case scenario
Max run time Number of times the principal activity of the algorithm is performed
30
Best case scenario
Specific instances of input size N
31
Average case scenario
Most useful General case
32
Fundamental operations of a computer
Add; Compare; Retrieve; Store.
33
Complex operation example
Finding the biggest number in an array
34
Low level language
Closer to binary; Machine code or Assembly
35
High level language
Java; C++; HTML
36
Natural language
Varying vocab Ambiguous Grammar & Syntax inconsistent
37
Computer language
Fixed vocab Unambiguous meaning Grammar & Syntax consistent
38
Why grammar and syntax is important
Easy to learn and use Less compilation and logical errors
39
Need for High Level languages
Similar to human language Needs for computer systems have expanded Time constraints - too long to write machine code (HL; NCS; T)
40
Need for Low Level languages
Close to binary code that's used to process instructions
41
Compiler
Translates from a high level language to a low level (in batches)
42
Interpreter
High level to intermediate; then executed by CPU
43
Why you need compliers and interpreters?
High level to low level langauge Translated into machine code for CPU to execute
44
Why do you need BOTH?
Interpreter is faster and warns about syntax errors; easier when debugging Compiler needed when there's a need to produce executable version of program
45
Assembler
Assembly to machine code (mnemonics -> binary)
46
Variables
Storage locations; naming memory locations with a name and data type that can't be changed.
47
Constant
Identifier with associated value that doesn't change.
48
Operator
Set of characters that represents an action (CRA)
49
Object
Instance of a class
50
Advantages of modular design
Code *reusability*; Eases program *organization* and makes future *maintenance* easier (CR; EPO; ME)
51
Need for sub programmes
Breaks down tasks into more manageable sections Distributes development Code Reusability Program readability (BM; DD; CR; PR)
52
Bubble sort algorithm
int temp; loop i from 0 to array.length-1 loop j from 0 to array.length-1 if array[i] > array[i+1] then temp = array[i] array[i] = array[i+1] array[i+1] = temp end if end loop end loop
53
Selection sort algorithm
int temp; loop i from 0 to array.length-1 loop j from i+1 to array.length if array[i] > array[j] then temp = array[i] array[i] = array[j] array[j] = temp end if end loop end loop
54
Sequential search algorithm
loop for i from 0 to array.length if searchkey == array[i] then ouput searchkey; 'has been found!'break; end loop
55
Finding the minimum and maximum in an array
int min = array[0] int max = array[0] loop i from 0 to array.length if min > array[i] then min = array[i] end if else if max < array[i] then max = array[i] end else if end loop output 'min ='; min; 'max ='; max
56
Binary Search Algorithm
input key low = 0 high = array.length-1 found = -1 loop i while found == -1 && low <= high mid = (low + high) div 2 if array[mid] == key then found = mid else if key < array[mid] then high = mid - 1 else low = mid + 1 end if end while if found >= 0 then output key; ' was found!'else output key; ' was not found!'end if
57
Hours given minutes
Div 60
58
Minutes remaining
Mod 60 (This was a past paper question!)