Component 2 Flashcards Textbook

1
Q

What is an algorithm?

A

A series of instructions that solves a problem in a finite number of steps

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

What three criteria lead to a successful algorithm?

A
  • Accuracy
  • Consistency
  • Efficiency
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does unambiguous mean?

A

Written in a way that makes it completely clear what is meant

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

What are the two ways to plan and design an algorithm?

A
  • Visual (Using flow chart symbols)
  • Text (Using a written sequence of instructions)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the difference between an algorithm and a problem?

A

Before you can write a program to solve a problem, you have to work out the algorithm first

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

What is a variable?

A

A storage location used to store a value; this could be text or a number. The value stored in the variable may change as the program is run.

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

What are the rules for a variable name?

A
  • Must be written before a value is assigned to it
  • Cannot start with a number
  • Must not have spaces
  • Must make sense in algorithm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is ‘=’ in OCR pseudocode?

A

Assignment of a value to a variable

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

What is ‘==’ in OCR pseudocode?

A

Shows equality

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

What is the flow chart symbol for a terminator and what does it show?

A
  • Oval / Rounded Rectangle
  • Start or end of algorithm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the flow chart symbol for a process and what does it show?

A
  • Rectangle
  • Process in algorithm e.g. Calculating price
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the flow chart symbol for a decision and what does it show?

A
  • Diamond
  • Have one of two answers; yes or no, true or false
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the flow chart symbol for an input or output and what does it show?

A
  • Parallelogram
  • Shows data into algorithm or outputs from it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does an arrow show in a flow chart?

A
  • Sequence of steps in the algorithm
  • Usually vertical or horizontal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a flow chart?

A

Visual representation of the sequence of steps in an algorithm

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

What is assignment?

A

Giving a variable or constant a value by linking a value to the identifier

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

What is an identifier?

A

A unique name given to a variable or constant in your algorithm which makes your algorithm easier to read and understand

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

What is pseudocode?

A

A structured, code-like language that can be used to describe an algorithm

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

What are keywords?

A

Used in pseudocode for common operators; written in capital letters

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

What are some example keywords?

A

INPUT- Getting values into the algorithm from user via keyboard
OUTPUT- Messages or results displayed on screen

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

What are the pseudocode arithmetic operators for addition, subtraction, multiplication and division?

A

+ , - , * , /

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

What are the pseudocode arithmetic operators for integer division and modulus?

A

DIV (only evaluates quotient which is the integer)
MOD (only evaluates remainder)

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

List all the comparison operators (and what they evaluate to)

A

< - Less than (True)
> - Greater than (False)
== - Same as (True)
!= - Not equal to (True)
<= - Less than or equal to (True True)
>= - Greater than or equal to (True False)

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

True or False: Arithmetic Operators are evaluated AFTER comparison operators

A

False, evaluated BEFORE.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
What are the three Boolean operators?
AND - Checks both conditions are true or false OR - Checks EITHER conditions is true NOT - Reverses Boolean Value (e.g x>y = False, NOT reverses evaluation to True)
25
What is an operator?
Symbol that shows an operation
26
What are the three basic programming constructs ?
- Sequence - Selection - Iteration
27
What is an exponentiation?
Base integer is raised to power of exponent integer, Operator is ^
28
What are the two types of iteration?
- Condition- controlled loop - Count-controlled loop
29
What is nesting?
Combining code together, putting a while loop inside a while loop
30
What is an array?
Data structure that allows storage of multiple items in a single variable
31
What is a subprogram?
Clear, independent blocks of code within a computer program which can be called and accessed by main program
32
What is 'call'?
Starting the subprogram
33
What are subprograms which return values known as?
Functions
34
What are subprograms which don't return values known as?
Procedures
35
What is decomposition?
Breaking problem down into smaller sub-problems until these tasks are solved
36
What is a string?
A sequence of characters surrounded by quotation marks
37
What is concatenation?
Merging or joining two strings together using a concatenation operator (+)
38
What is abstraction?
Process of removing unnecessary details from a problem
39
What is time efficiency?
The number of steps to complete the algorithm
40
What is space efficiency?
The amount of memory required to complete the algorithm
41
What is brute force?
Process that tries all possible alternatives to find a solution
42
What is an input?
Data that a program receives and processes
43
What sources can inputs come from?
- User Input - Files - Sensors - Networks
44
What is an output?
Results of a program's processing
45
How can an output be presented?
- On Screen - Printed Out - Sent to other devices or programs
46
How do you make use of data retrieved by an input function?
- Assign a return value to a variable which allows program to store and manipulate input data
47
What is a sequence?
Executing a series of statements in a specific order, following linear flow
48
What is selection?
Enables program to make decisions based on conditions
49
What is iteration?
Allows a set of instructions to be repeated multiple times as long as certain condition is true
50
What happens when sequence fails and instructions are executed in wrong order?
- Program's behavior can deviate from intended logic causing logic errors, unexpected results or crashes
51
What are the two types of iteration?
Count-controlled Condition-controlled
52
What is count-controlled iteration?
Number of times the loop is executed is predetermined before the loop starts
53
What is condition-controlled iteration?
Loop continues until a certain condition is met
54
What are the arithmetic operators and what do they do?
+ - Addition - - Subtraction * - Multiplication / - Division ^ - Exponentiation (raises to the power) DIV - Quotient (returns integer) % - Modulus (also MOD, returns remainder)
55
What are the comparison operators and what do they do?
== - equal to != - not equal to < - less than <= - less than or equal to > - greater than >= - greater than or equal to
56
What are the Boolean operators and what do they do?
AND - Returns true if both operand are true OR - Returns true if either operands are true NOT - Reverses logic state of its operand
57
What are the 5 common data types?
Integer - Whole Numbers Float - Decimal Numbers Boolean - True/False Values Character - Single alphanumeric character String - Sequence of characters
58
What is string concatenation?
Process of joining two strings together using the '+' operator
59
How can you convert other variables into string for string concatenation?
Create a new string variable and assign it to to_string(variable_name)
60
How to use substrings?
Use the variable.substr(num1, num2) in which num1 is the index you should start at, including 0, and num2 is the number of characters to include afterwards