PAPER 2 - Algorithms, Programming, Logic Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is analysis

A
  • abstraction, decomposition of the problem, identification of the problem
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 4 main stages in the program development life cycle:

A

-ANALYSIS
- DESIGN
- CODING
- TESTING

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

What is design

A
  • decomposition, structure diagrams, flow charts, pseudocode
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is coding

A

Writing program code + iterative testing

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

what is testing

A

Testing program code with use of test data

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

What is abstraction

A
  • involves identifying the key parts of the problem
  • removing any unnecessary detail to make it easier to
    solve
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of structure diagrams

A
  • show structure of the problem, its subsections + links to other subsections
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is decomposition

A

The breaking down of 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
9
Q

What are the 4 steps of decomposition

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

In flow charts what is the symbol for input/output

A

Parallelogram

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

Flow chart symbol for process

A

Rectangle

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

Flow chart symbol for decision

A

Diamond

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

Flow chart symbol for terminator

A

Oval

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

What are the 5 data types

A
  • integer
  • real/float
  • Boolean
  • char
  • string
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a real/float

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

Either TRUE or FALSE

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

What is a char

A

A single alphabetic or numeric character
E.g. A,#, @, 6, !

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

What is a string

A

A sequence of one or more characterS
E.g. “yes”, “Hi John”

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

Explain the difference between a variable and a constant.

A
  • Variable – a storage container in memory that can hold information as a number, a person’s name or a whole sentence.
  • Constant – a variable, once defined , it cannot be changed during execution of program, You cannot declare a value as a constant in python.
    E.g. Value that never, or rarely changed : pi, speed of light
20
Q

Pi = 3.142
Radius = float(input(“Enter radius”)
Circle_area = pi*(radius^2)
Print(Circle_area)
What is a variable and what is a constant

A

Variable = radius
Constant = Pi

21
Q

What is the assign symbol operator un psuedocode

A

<—

22
Q

WHILE….__

A

DO

23
Q

A <— 22 MOD 5
What is A?

A

2 (reminder)

24
Q

C <— 22 DIV 5

A

C = 4

25
Q

What is a sequence

A

two or more statements written and executed one after the other in sequence

26
Q

What is a selection statement

A

Selection stemmet comprises an IFor CASE stement and a logical expression.

27
Q

IF is what kind of statement

A

Selection statement

28
Q

What are the 3 iterations:

A
  • FOR … NEXT
  • WHILE … ENDWHILE
  • REPEAT … UNTIL
29
Q

What is a nested if statement

A

An IF statement inside another IF statement :
IF .. THEN
ELSE IF … THEN
ELSE
ENDIF

30
Q

What is a CASE statement

A

CASE statement - allow one of several branches of code to be executes, depending on the value of a variabel

31
Q

Think of a CASE programme about member types

A

INPUT MemberType
CASE OF MemberType
“Junior” :EntryFee <—2.0
“Senior” :EntryFee <— 3.0
“Special” : EntryFee <— 0.0
OTHERWISE OUTPUT “Invalid member type” //Other conditions not net
ENDCASE

32
Q

CASE …. ___________

A

OTHERWISE

33
Q

Name a count-controlled loop

A

FOR … NEXT

34
Q

Counter -

A

A counter is automatically incremented each time the loop is performed

35
Q

A code to print out numbers from 1 - 10

A

FOR Count <— 1 TO 10
OUPUT COUNT
NEXT Count

36
Q

Code to print out numbers 2,5,8

A

FOR i <— 2 TO 10 STEP 3
OUPUT i
NEXT i

37
Q

Example of a pre-conditioned loop

A

WHILE…DO….ENDWHILE

38
Q

What are pre-conditioned loops

A

Controlled by a Boolean condition white is checked before the loop is entered

39
Q

What are post-conditioned loops

A

Controlled by a Boolean condition white is checked at the end the loop is entered. therefore performed at least once

40
Q

Example of a post-conditioned loop

A

REPEAT….UNTIL

41
Q

Write a pseudocode algorithm which allows a user to input numeric scores and prints how many of them are over 100. The program allows the user to enter any number of scores. If the user enters “-1” the program will end.

A

Count <- 0
Score <- 0
WHILE score<> -1 DO
OUPUT “Enter Score”
INPUT score
IF score > 100
THEN
Count = Count+1
ELSE
ENDIF
ENDWHILE
OUPUT Count

42
Q

What are the 4 string operations:

A
  • LENGTH ( )
  • LCASE ( )
  • UCASE ( )
  • SUBSTRING ( str, start, length)
43
Q

What does LENGTH ( ) do?

A

Output number of char in string value

44
Q

SUBSTRING (Ziqi Ding, 2, 5)

A

iqi D
,5: count 5 on from start char

45
Q

How to declare what data type something is

A

DECLARE Name: STRING
DECLARE Age: CHAR

46
Q

In Pseudocode does the word number start with 0 or 1

A

1