Unit 4 Flashcards

You may prefer our related Brainscape-certified 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
Q

When bubble sorting on a list

A

Compares and swaps every two numbers

26
Q

Selection sort

A

No quit early; always N passes. O(N^2)

27
Q

Flow chart shapes (bubble; parallelogram; rectangle and diamond)

A

Bubble: Terminator Parallelogram: Input/ Output Rectangle: Process Diamond: Decision

28
Q

What effects run time?

A

Hardware Abstract data types Compiler Efficiency Programmers skills Complexity Size of input (H; ADT; CE; PS; C; IS)

29
Q

Worse case scenario

A

Max run time Number of times the principal activity of the algorithm is performed

30
Q

Best case scenario

A

Specific instances of input size N

31
Q

Average case scenario

A

Most useful General case

32
Q

Fundamental operations of a computer

A

Add; Compare; Retrieve; Store.

33
Q

Complex operation example

A

Finding the biggest number in an array

34
Q

Low level language

A

Closer to binary; Machine code or Assembly

35
Q

High level language

A

Java; C++; HTML

36
Q

Natural language

A

Varying vocab Ambiguous Grammar & Syntax inconsistent

37
Q

Computer language

A

Fixed vocab Unambiguous meaning Grammar & Syntax consistent

38
Q

Why grammar and syntax is important

A

Easy to learn and use Less compilation and logical errors

39
Q

Need for High Level languages

A

Similar to human language Needs for computer systems have expanded Time constraints - too long to write machine code (HL; NCS; T)

40
Q

Need for Low Level languages

A

Close to binary code that’s used to process instructions

41
Q

Compiler

A

Translates from a high level language to a low level (in batches)

42
Q

Interpreter

A

High level to intermediate; then executed by CPU

43
Q

Why you need compliers and interpreters?

A

High level to low level langauge Translated into machine code for CPU to execute

44
Q

Why do you need BOTH?

A

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
Q

Assembler

A

Assembly to machine code (mnemonics -> binary)

46
Q

Variables

A

Storage locations; naming memory locations with a name and data type that can’t be changed.

47
Q

Constant

A

Identifier with associated value that doesn’t change.

48
Q

Operator

A

Set of characters that represents an action (CRA)

49
Q

Object

A

Instance of a class

50
Q

Advantages of modular design

A

Code reusability; Eases program organization and makes future maintenance easier (CR; EPO; ME)

51
Q

Need for sub programmes

A

Breaks down tasks into more manageable sections Distributes development Code Reusability Program readability (BM; DD; CR; PR)

52
Q

Bubble sort algorithm

A

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
Q

Selection sort algorithm

A

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
Q

Sequential search algorithm

A

loop for i from 0 to array.length if searchkey == array[i] then ouput searchkey; ‘has been found!’break; end loop

55
Q

Finding the minimum and maximum in an array

A

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
Q

Binary Search Algorithm

A

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
Q

Hours given minutes

A

Div 60

58
Q

Minutes remaining

A

Mod 60 (This was a past paper question!)