Problem Solving (Ch7) (M2) Flashcards

1
Q

What are the three key components to computational thinking?

A

Three key components of computational thinking:
Abstraction, decomposition, algorithmic thinking

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

What is abstraction?

A

Abstraction is where you ignore unnecessary information and focus only on the important facts.

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

Why is abstraction used?

A

Abstraction is used because it simplifies a problem to make it less complex. This makes it more straightforward to understand the problem and create a solution.

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

What is decomposition?

A

Decomposition is when you break a problem down into smaller tasks so that it is easier to solve.

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

Give three advantages of decomposition

A

Advantages of decomposition:

• Smaller problems are easier to solve
• They can be created independent of the other problems
• They can be tested independently
• Then combined to produce the full problem
• Each individual problem can be separately tested and solved

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

What does algorithmic thinking do?

A

Algorithmic thinking will put the tasks into a step-by-step process to solve to problem.

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

How does algorithmic thinking approach a problem?

A

The problem is broken down using decomposition into smaller problems. The required data and relevant data structures are considered using abstraction.

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

Give one difference between functions and procedures

A

Procedures:
Carry out a task
Provide structure to code

Functions:
Carry out a task AND return a value
Create reusable program components

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

Give one advantage of a sub program

A

Advantages of sub programs:

The program is easier to write The program is easier to debug
We are creating reusable components
The program is easier to test
Functions could be gathered together into a library for easy reuse across multiple programs

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

What is the advantage of structuring code into sub-programs?

A

Structuring code into sub-programs makes the code easier to read and debug.

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

What do functions do?

A

Functions return values and create reusable program components.

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

What do procedures do?

A

Procedures create a modular structure to a program, making it easier to read.

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

Pre-defined subroutines don’t have to be written by the programmer. Why?

A

Pre-defined subroutines don’t have to be written by the programmer, they are built into the IDE and already exist.

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

Who are user defined subroutines written by?

A

User defined subroutines are written by the programmer.

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

Give an example of where random numbers would/could be used

A

Random numbers could/would be used in:
A random number generator
A game

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

What is concatenation?

A

Concatenation is where strings are joined together to form new strings

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

What operator is concatenation usually performed with?

A

Concatenation is often done using the + operator

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

What does .length do?

A

.length returns the length of a string

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

What does .upper and .lower do?

A

.upper returns the string in uppercase
.lower returns the string in lowercase

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

What does .substring(x, i) do?

A

Returns part of a string, starting at the character of the first parameter and counting up by the number in the second parameter.

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

What does ASC() and CHR() do?

A

ASC() returns the ASCII value of a character
CHR() returns a character from its ASCII number

22
Q

What does .left and .right do?

A

We can find a substring at the start of a string by using .left(i)
We can find a substring at the end of a string by using .right(i)

23
Q

What is string manipulation?

A

String manipulation is the act of manipulating, extracting, or changing the chaarcters in a string variable

24
Q

What are two of the four main reasons a program should be tested?

A

There are four main reasons why a program should be tested:

To ensure there are no errors (bugs) in the code
To check that the program has an acceptable performance and usability
To ensure that unauthorised access is prevented
To check the program meets the requirements

25
Q

Describe iterative testing

A

Iterative testing:

Each new module is tested as it is written
Program branches are checked for functionality
Checking new modules do not introduce new errors in existing code
Tests to ensure the program handles erroneous data and exceptional situations

26
Q

Describe final/terminal testing

A

Final/Terminal testing:

Testing that all modules work together (integration testing)
Testing the program produces the required results with normal, boundary, invalid and erroneous data
Checking the program meets the requirements with real data
A beta test may find more errors

27
Q

What is test data used for?

A

Test data is used to test whether a program is functioning correctly.

28
Q

What should test data cover a range of?

A

Test data should cover a range of possible and incorrect inputs, each designed to prove a program works or to highlight any flaws.

29
Q

What is no data?

A

No data is where nothing has been entered
This isn’t strictly invalid or erroneous data, but it certainly isn’t what you want the user to do

30
Q

What is erroneous data?

A

Erroneous data is data of the incorrect type which should be rejected by a computer system

31
Q

What is invalid data?

A

Invalid data is data of the correct data type but outside the accepted validation limit

32
Q

What is normal data?

A

Normal data is data which should be accepted by a program without causing errors

33
Q

What is boundary data?

A

Boundary data is data of the correct type which is on the edge of accepted validation limits

34
Q

What are the three key types of data?

A

Normal, boundary and erroneous are the 3 key types of data.

35
Q

What is the Systems Development Life Cycle?

A

The Systems Development Life Cycle is a step-by-step process for planning, creating, testing, deploying and maintaining a system.

36
Q

Give three reasons programmers test their code

A

Programmers also test their code to:

Ensure it works as intended
Ensure it works efficiently
Ensure it meets the client requirements
Ensure outputs are accurate
Ensure it is free from errors
Check any interfaces are clearly visible and perform in a user friendly way

37
Q

Give three things that a test plan sets out

A

Testing is often completed in a test plan, which sets out:

The test number
The data entered
The type of test data
The expected outcome
The result of the test
Action required as a result of the test

38
Q

Why is a test plan useful?

A

A test plan is useful because it allows programmers to see what the expected outcome of the code is, and if that differs, then it is easy to pinpoint the error in the code and fix it.

39
Q

What will a good test plan do?

A

A good test plan will anticipate all of the potential issues with the program and select appropriate test data to test for these issues.

40
Q

What is an algorithm?

A

An algorithm is a logical, step-by-step process for solving a problem

41
Q

What does algorithm production focus on?

A

Algorithm production is part of algorithmic thinking. It focuses on how a desired solution can be reached by identifying the steps needed to get there.

42
Q

What two things are algorithms usually written as?

A

Algorithms are usually written as:
Pseudocode
A flow diagram

43
Q

What should be considered about an algorithm before designing it?

A

These things should be considered about an algorithm before designing it:

What are the inputs into the problem?
What will be the outputs of the problem?
In what order do instructions need to be carried out in?
What decisions need to be made in the program?
Are any areas of the problem repeated?

44
Q

When testing a larger program, what will a tester often use?

A

When testing a larger program, the tester will often use debugging tools.

45
Q

What is a syntax?

A

A syntax is a set of rules

46
Q

What are syntax errors usually pointed out by?

A

Syntax errors are usually pointed out by the IDE

47
Q

What happens to programs with syntax errors?

A

Programs with syntax errors will not run

48
Q

Give one example of a syntax error

A

Examples of syntax errors include:

Wireline instead of writeline
Missing bracket or speech mark
Forgetting to end an IF statement

49
Q

What is a logic error?

A

A logic error is a mistake in the code that causes it to perform in an unexpected way.

50
Q

What happens to programs with logic errors? Why is this a problem?

A

Programs with logic errors will still run. This makes logic errors hard to spot and makes them sometimes go unnoticed

51
Q

Give one example of a logic error

A

Examples of logic errors include:

Using and instead of or
Using > instead of >=
Forgetting to add VAT if calculating a total cost that should include
VAT