PAPER 2 - Algorithms, Programming, Logic 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

22
Q

WHILE….__

23
Q

A <— 22 MOD 5
What is A?

A

2 (reminder)

24
Q

C <— 22 DIV 5

25
What is a sequence
**two or more statements** written and **executed one after the other in sequence**
26
What is a selection statement
Selection stemmet comprises an **IF**or **CASE** stement and a **logical expression**.
27
IF is what kind of statement
Selection statement
28
What are the 3 iterations:
- FOR … NEXT - WHILE … ENDWHILE - REPEAT … UNTIL
29
What is a nested if statement
An IF statement inside another IF statement : IF .. THEN ELSE IF … THEN ELSE ENDIF
30
What is a CASE statement
CASE statement - allow one of several branches of code to be executes, depending on the value of a variabel
31
Think of a CASE programme about member types
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
CASE …. ___________
OTHERWISE
33
Name a count-controlled loop
FOR … NEXT
34
Counter -
A counter is automatically incremented each time the loop is performed
35
A code to print out numbers from 1 - 10
FOR Count <— 1 TO 10 OUPUT COUNT NEXT Count
36
Code to print out numbers 2,5,8
FOR i <— 2 TO 10 STEP 3 OUPUT i NEXT i
37
Example of a pre-conditioned loop
WHILE…DO….ENDWHILE
38
What are pre-conditioned loops
Controlled by a Boolean condition white is checked **before** the loop is entered
39
What are post-conditioned loops
Controlled by a Boolean condition white is checked **at the end** the loop is entered. therefore performed at least once
40
Example of a post-conditioned loop
REPEAT….UNTIL
41
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.
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
What are the 4 string operations:
- LENGTH ( ) - LCASE ( ) - UCASE ( ) - SUBSTRING ( str, start, length)
43
What does LENGTH ( ) do?
Output number of char in string value
44
SUBSTRING (Ziqi Ding, 2, 5)
iqi D ,5: count 5 on from start char
45
How to declare what data type something is
DECLARE Name: STRING DECLARE Age: CHAR
46
In Pseudocode does the word number start with 0 or 1
1