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"```?
Trả lời(B)
To validate the input of percentage marks.
2
A check digit typically uses which set of operations?
3
What does the testing stage ensure in the program development life cycle?
Trả lời(B)
All the tasks work together as specified
4
What are some of the key steps to implement a linear search algorithm?
5
In the linear search example, what does the 'Found' flag help to achieve?
Trả lời(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?
Trả lời(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?
Trả lời(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"?
Trả lời(C)
The expected functionality of the algorithm.
9
Which of the following is NOT a step typically included when writing an algorithm?
Trả lời(B)
Creating a user interface.
10
Which of the following is most commonly associated with checking the content for a particular pattern?
11
In an algorithm designed to find the average of a set of marks, which of the following steps is essential?
Trả lời(B)
Calculating the total of the marks.
12
What does top-down design involve?
Trả lời(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?
14
What type of symbol would you use in a flowchart to represent a decision?
15
What does the analysis stage of the program development life cycle focus on?
Trả lời(C)
Understanding and defining the problem.
16
What is required to compute the average of a set of values using an algorithm?
17
In a 'FOR...TO...NEXT' loop, what dictates the number of times the loop body executes?
Trả lời(B)
The loop's start and end values, and the increment value.
18
What is the purpose of a 'count-controlled' loop?
Trả lời(A)
To repeat a set of instructions a specific number of times.
19
What is the main goal of the testing phase?
Trả lời(B)
To identify and fix any errors in the code.
20
What is the objective of a type check?
Trả lời(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?
Trả lời(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?
23
What does the testing stage of the program development life cycle involve?
Trả lời(C)
Running the program with various test cases.
24
In the context of validation, what is the primary function of a 'type check'?
Trả lời(B)
To ensure that the data entered is the correct type.
25
What is one of the advantages of using pseudocode?
Trả lời(B)
It is easy to learn and use.
26
What is the main purpose of 'data validation' in a software application?
Trả lời(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?
28
In what ways can data be invalid?
29
When should you employ a `WHILE...DO...ENDWHILE` loop?
Trả lời(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?
31
In a flowchart, which shape is used to represent a decision (e.g., an IF statement)?
32
What do you represent in a flowchart by using a rectangle?
33
What should be done after you have tested your algorithm?
34
What does a trace table help you to see?
35
What is the purpose of using flow lines in flowcharts?
Trả lời(B)
To show the direction of the steps.
36
What is the output message when the 'CASE OF' algorithm reaches the default option?
Trả lời(D)
Please enter a valid choice
37
What is the primary function of a type check?
Trả lời(B)
To verify the data type of an input.
38
Which of the following is NOT an example of a validation check?
39
What is the purpose of an algorithm?
Trả lời(A)
To execute a specific task in a systematic way.
40
What characteristics determine which data values are compared by the bubble sort algorithm?
Trả lời(A)
Whether they are adjacent to each other.
41
Why are trace tables useful in debugging an algorithm?
Trả lời(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?
Trả lời(C)
Checking that a postcode is in the format NNX 9NN.
43
When implementing a 'Linear Search' algorithm, what aspects characterize the search process?
44
Which aspects of an algorithm's operation can be shown using a trace table?
45
In the 'totaling' algorithm, what variable is typically initialized before the loop starts?
Trả lời(B)
A variable to store the final total.
46
What is the primary purpose of a structure diagram?
Trả lời(B)
To show top-down design in a diagrammatic form.
47
What is the main purpose of using a trace table?
Trả lời(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?
Trả lời(B)
Comparing the temperature at the current index with the next one.
49
What type of diagram is used to visually represent an algorithm?
50
What is the key characteristic of the algorithm represented in the alarm clock example that relates to control flow?
Trả lời(D)
It implements a WHILE loop to check continuously.