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"```?
คำตอบ(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?
คำตอบ(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?
คำตอบ(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?
คำตอบ(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?
คำตอบ(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"?
คำตอบ(C)
The expected functionality of the algorithm.
9
Which of the following is NOT a step typically included when writing an algorithm?
คำตอบ(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?
คำตอบ(B)
Calculating the total of the marks.
12
What does top-down design involve?
คำตอบ(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?
คำตอบ(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?
คำตอบ(B)
The loop's start and end values, and the increment value.
18
What is the purpose of a 'count-controlled' loop?
คำตอบ(A)
To repeat a set of instructions a specific number of times.
19
What is the main goal of the testing phase?
คำตอบ(B)
To identify and fix any errors in the code.
20
What is the objective of a type check?
คำตอบ(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?
คำตอบ(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?
คำตอบ(C)
Running the program with various test cases.
24
In the context of validation, what is the primary function of a 'type check'?
คำตอบ(B)
To ensure that the data entered is the correct type.
25
What is one of the advantages of using pseudocode?
คำตอบ(B)
It is easy to learn and use.
26
What is the main purpose of 'data validation' in a software application?
คำตอบ(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?
คำตอบ(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?
คำตอบ(B)
To show the direction of the steps.
36
What is the output message when the 'CASE OF' algorithm reaches the default option?
คำตอบ(D)
Please enter a valid choice
37
What is the primary function of a type check?
คำตอบ(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?
คำตอบ(A)
To execute a specific task in a systematic way.
40
What characteristics determine which data values are compared by the bubble sort algorithm?
คำตอบ(A)
Whether they are adjacent to each other.
41
Why are trace tables useful in debugging an algorithm?
คำตอบ(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?
คำตอบ(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?
คำตอบ(B)
A variable to store the final total.
46
What is the primary purpose of a structure diagram?
คำตอบ(B)
To show top-down design in a diagrammatic form.
47
What is the main purpose of using a trace table?
คำตอบ(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?
คำตอบ(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?
คำตอบ(D)
It implements a WHILE loop to check continuously.