Computer Science for IGCSE & O level - Algorithm Design And Problem Solving (Section 9)

1
What is the purpose of the following algorithm: ```IF PercentageMark < 0 OR PercentageMark > 100 THEN OUTPUT "Fail" ELSE OUTPUT "Pass"```?
Answer
(B)
To validate the input of percentage marks.
2
A check digit typically uses which set of operations?
Answer
(C)
Multiply, add, divide
3
What does the testing stage ensure in the program development life cycle?
Answer
(B)
All the tasks work together as specified
4
What are some of the key steps to implement a linear search algorithm?
Answer
A
B
D
5
In the linear search example, what does the 'Found' flag help to achieve?
Answer
(B)
Indicate if the target item was located within the list.
6
In the context of programming and algorithm design, what is the purpose of a loop?
Answer
(B)
To repeat a set of instructions multiple times.
7
In the given text, what is the difference between a format check and a type check?
Answer
(B)
A format check ensures the data is in the correct format, while a type check checks the data type.
8
What is tested by "normal data"?
Answer
(C)
The expected functionality of the algorithm.
9
Which of the following is NOT a step typically included when writing an algorithm?
Answer
(B)
Creating a user interface.
10
Which of the following is most commonly associated with checking the content for a particular pattern?
Answer
(B)
Format check
11
In an algorithm designed to find the average of a set of marks, which of the following steps is essential?
Answer
(B)
Calculating the total of the marks.
12
What does top-down design involve?
Answer
(B)
Breaking down the problem into a set of smaller sub-systems.
13
Which is the best way to represent the data in an algorithm?
Answer
(A)
By using variables.
14
What type of symbol would you use in a flowchart to represent a decision?
Answer
(B)
Diamond
15
What does the analysis stage of the program development life cycle focus on?
Answer
(C)
Understanding and defining the problem.
16
What is required to compute the average of a set of values using an algorithm?
Answer
A
B
17
In a 'FOR...TO...NEXT' loop, what dictates the number of times the loop body executes?
Answer
(B)
The loop's start and end values, and the increment value.
18
What is the purpose of a 'count-controlled' loop?
Answer
(A)
To repeat a set of instructions a specific number of times.
19
What is the main goal of the testing phase?
Answer
(B)
To identify and fix any errors in the code.
20
What is the objective of a type check?
Answer
(B)
To verify that the data entered is the appropriate data type (e.g., integer, string).
21
What does the WHILE...DO...ENDWHILE loop structure do?
Answer
(D)
It checks the condition at the beginning and continues to execute the loop's actions while the condition is TRUE.
22
Which of the following is a good practice when creating a trace table?
Answer
A
B
C
23
What does the testing stage of the program development life cycle involve?
Answer
(C)
Running the program with various test cases.
24
In the context of validation, what is the primary function of a 'type check'?
Answer
(B)
To ensure that the data entered is the correct type.
25
What is one of the advantages of using pseudocode?
Answer
(B)
It is easy to learn and use.
26
What is the main purpose of 'data validation' in a software application?
Answer
(B)
To prevent errors by checking the quality of user-provided data.
27
Which type of data helps to test the resilience of a program to incorrect input?
Answer
(B)
Abnormal Data
28
In what ways can data be invalid?
Answer
A
B
C
D
29
When should you employ a `WHILE...DO...ENDWHILE` loop?
Answer
(C)
When the repetition depends on a specific condition.
30
What are some possible ways to verify that a user's email address has been entered correctly?
Answer
A
B
C
31
In a flowchart, which shape is used to represent a decision (e.g., an IF statement)?
Answer
(C)
Diamond
32
What do you represent in a flowchart by using a rectangle?
Answer
(B)
An action or process.
33
What should be done after you have tested your algorithm?
Answer
(B)
Refine and edit it.
34
What does a trace table help you to see?
Answer
A
C
D
35
What is the purpose of using flow lines in flowcharts?
Answer
(B)
To show the direction of the steps.
36
What is the output message when the 'CASE OF' algorithm reaches the default option?
Answer
(D)
Please enter a valid choice
37
What is the primary function of a type check?
Answer
(B)
To verify the data type of an input.
38
Which of the following is NOT an example of a validation check?
Answer
(D)
Compilation check.
39
What is the purpose of an algorithm?
Answer
(A)
To execute a specific task in a systematic way.
40
What characteristics determine which data values are compared by the bubble sort algorithm?
Answer
(A)
Whether they are adjacent to each other.
41
Why are trace tables useful in debugging an algorithm?
Answer
(B)
To illustrate how the values of variables change throughout the execution of the algorithm.
42
Which of the following is an example of a format check?
Answer
(C)
Checking that a postcode is in the format NNX 9NN.
43
When implementing a 'Linear Search' algorithm, what aspects characterize the search process?
Answer
A
D
44
Which aspects of an algorithm's operation can be shown using a trace table?
Answer
A
B
D
45
In the 'totaling' algorithm, what variable is typically initialized before the loop starts?
Answer
(B)
A variable to store the final total.
46
What is the primary purpose of a structure diagram?
Answer
(B)
To show top-down design in a diagrammatic form.
47
What is the main purpose of using a trace table?
Answer
(B)
To trace the flow of an algorithm and observe how the variables change.
48
In a bubble sort algorithm applied to a list of temperatures, what does `Temperature[Index] > Temperature[Index + 1]` represent?
Answer
(B)
Comparing the temperature at the current index with the next one.
49
What type of diagram is used to visually represent an algorithm?
Answer
(B)
Flowchart
50
What is the key characteristic of the algorithm represented in the alarm clock example that relates to control flow?
Answer
(D)
It implements a WHILE loop to check continuously.