Algorithms and pseudocode Flashcards

1
Q

what is the program development cycle

A

analysis - abstraction, decomposition, identification
design - decomposition, structure diagrams, flowcharts, pseudocode
coding - writning code
testing - testing code with test data

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

define decomposition

A

breaking down a complex problem into smaller, manageable parts which are easier to solve

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

what are the steps of decomposition

A
  • identify main problem
  • identify the componenet parts of inputs, processes, outputs and storage
  • list the main sub-problems, sub-systems or sub-tasks
  • break these down into smaller sub-problems and sub-tasks which can be completed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is a structure diagram used for

A

to show the structure of a problem, its subsections and links to other subsections

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

what is abstraction

A

simplifing a porblem so it is easier to be deal with

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

what are flowcharts used for

A

to develop solutions to a problem

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

what is the problem with using flowcharts

A

they di not usually translate very easily into program code

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

why do programmers use pseudocode

A

because it is easier for someone to understand - they can focus on the process needed rather than the coding itself

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

what is the assingment operator for pseudocode

A

an arrow
<-

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

what is this <

A

less than

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

what is this >

A

greater than

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

what is this <>

A

not equal to

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

what are the data types

A
  • integer
  • real
  • boolean
  • char
  • string
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is an integer

A

a whole number

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

what is a real

A

a number with a decimal point

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

what is a boolean

A

true or false

17
Q

what is a char

A

a single alphabetic or numeric character

18
Q

what is a string

A

a sequence of one or more characters

19
Q

what is the difference between a variable and constant

A

a variable can be changed/updated/edited after exercution but a constant stores a value that cannot be changed after exercution

20
Q

what are the 3 types of code

A
  • sequence (inputs, outputs, assignment)
  • iteration (loops)
  • selection (conditions)
21
Q

what is stepqise refinement

A

when the code happens in order of it being written

22
Q

in pseudocode if statements what do you particually need

A

IF …
THEN
ELSE IF
THEN
ELSE
END IF

23
Q

what are the three iteration statements

A
  • for … next
  • while … endwhile
  • repeat … until
24
Q

when are case statements used

A

if there are several possible options ot be tested

25
Q

how are case statements written

A

CASE OF ….
1 : …
2 : …
OTHERWISE
ENDCASE

26
Q

what is MOD

A

the remainder of

27
Q

what is DIV

A

quotient (normal division)

28
Q

what is sequence

A

two or more statements written and executed one after the other

29
Q

what are the string operations

A

LENGTH()
LCASE()
UCASE()
SUBSTRING()

30
Q

how do you write a min algorithm from an array list

A

ages -> [99, 15, 25, 55, 61]
min -> 100
FOR index -> 1 TO 5
IF ages[index] < min
THEN
min -> age[index]
ENDIF
NEXT index
OUTPUT “The lowest age is “, min

31
Q

how do you write a max algorithm from an array list

A

ages -> [99, 15, 25, 55, 61]
max -> 0
FOR index -> 1 TO 5
IF ages[index] > max
THEN
max -> age[index]
ENDIF
NEXT index
OUTPUT “The highest age is “, max

32
Q

what is the RLE algorithm

A

RLE uses frequency/data pairs to encode each run length of the same coloured pixle