Anda di halaman 1dari 8

Chapter 1 Program Development Procedures Question Bank

Chapter 1 Program Development Procedures


Multiple Choice Questions

(U02C01L01Q001)
Which of the following is NOT the three basic control structures?
A. sequence control structure
B. selection control structure
C. iteration control structure
D. reverse control structure
Answer
D

(U02C01L01Q002)
Which control structure is used in the following algorithm?

Get the first number.


Get the second number.
Calculate the sum of the two numbers.
Display the sum of the two numbers.

A. sequence control structure


B. selection control structure
C. iteration control structure
D. reverse control structure
Answer
A

Computer & Information Technology for HKCEE 1 © Pearson Education Asia Limited 2004
(Module A1)
Chapter 1 Program Development Procedures Question Bank

(U02C01L01Q003)
What control structure is used in the following algorithm?

If age is greater than 11


then bus fee is $5
else bus fee is $2.5

A. sequence control structure


B. selection control structure
C. iteration control structure
D. reverse control structure
Answer
B

(U02C01L01Q004)
What control structure is used in the following algorithm?

DoWhile there is another cup


Put water into the cup
EndDo

A. sequence control structure


B. selection control structure
C. iteration control structure
D. reverse control structure
Answer
C

Computer & Information Technology for HKCEE 2 © Pearson Education Asia Limited 2004
(Module A1)
Chapter 1 Program Development Procedures Question Bank

(U02C01L01Q005)
Consider the following algorithm which finds out the mean of two numbers.

Step 1: Get the first number.


Step 2: Get the second number.
Step 3: Calculate the mean of the two numbers.
Step 4: Display the mean of the two numbers.

Which two steps can be exchanged without affecting the result of the algorithm?
A. Steps 1 and 2
B. Steps 2 and 3
C. Steps 3 and 4
D. Steps 2 and 4
Answer
A

(U02C01L01Q006)
Which of the following types of errors can be detected by the computer?
(1) logic errors
(2) run-time errors
(3) syntax errors
A. (1) and (2) only
B. (1) and (3) only
C. (2) and (3) only
D. (1), (2) and (3)
Answer
C

(U02C01L01Q007)
An algorithm finds out the mean of two numbers by dividing the sum of the two numbers by 3.
What type of error is it?
A. syntax error
B. run-time error
C. logic error
D. no error
Answer
C

Computer & Information Technology for HKCEE 3 © Pearson Education Asia Limited 2004
(Module A1)
Chapter 1 Program Development Procedures Question Bank

(U02C01L01Q008)
Which of the following is NOT an advantage of modular approach?
A. We can concentrate on a small and manageable function at a time.
B. Each module can be tested and debugged independently.
C. Different modules can be written in different programming languages.
D. A module can be reused by another program.
Answer
C

(U02C01L01Q009)
Which of the following statements about the function of an algorithm is INCORRECT?
A. It is a set of step-by-step procedures.
B. It solves a specific problem in a finite number of steps.
C. It indicates the order of the steps.
D. It breaks down a complicated problem into a number of simpler subproblems.
Answer
D

(U02C01L01Q010)
What is program coding?
A. The process of converting an algorithm into a computer program.
B. The process of choosing a suitable programming language.
C. The process of testing a program by different sets of test data.
D. The process of preparing documents that describe the program.
Answer
A

(U02C01L01Q011)
Which of the following is a program design tool that is a visual representation of the logic in a
function within a program?
A. program map
B. structure chart
C. flowchart
D. waterfall model
Answer
C

Computer & Information Technology for HKCEE 4 © Pearson Education Asia Limited 2004
(Module A1)
Chapter 1 Program Development Procedures Question Bank

Conventional Questions

(U02C01L02Q001)
What are the differences between top-down design and bottom-up design?
(2 marks)
Answers
Top-down design is started by identifying the major task to be performed and then dividing it into
sub-tasks. Bottom-up design is started by identifying the sub-tasks first. Then the sub-tasks are used
as building blocks and put together to build up the solution.

(U02C01L02Q002)
(a) What is a block diagram?
(b) What are the advantages of using block diagrams?
(c) The task of preparing a cup noodle for lunch is broken down as follow:
1 Prepare hot water
1.1 Fill water into kettle
1.2 Turn on the fire
1.3 Heat until water boils
2 Prepare the noodle
2.1 Open the cover
2.2 Add hot water into the cup noodle
2.3 Wait for 3 minutes
Draw a block diagram to represent the modules
(7 marks)
Answers
(a) A block diagram uses rectangular boxes to represent the problem and subproblems, and
connects the related ones with lines.
(b) Programmers can visualize the relationship among the subproblems and how they cooperate to
solve the problem.
(c)
P re p a re C u p N o o d
F or L unch

P re p a re H o t W a te r P re p a re th e N o o d le

F ill w a te r T u rn o n H e a t u n til O p e n th e A d d h o t w a te r W a it fo r
in to k ittle th e fire w a te r b o ils cover in to c u p n o o d le 3 m in u te s

Computer & Information Technology for HKCEE 5 © Pearson Education Asia Limited 2004
(Module A1)
Chapter 1 Program Development Procedures Question Bank

(U02C01L02Q003)
A candidate can get a certificate in a computer course if he fulfills the following requirements:
(1) Pass in at least 3 assignments out of 4 assignments.
(2) Pass in the average marks for the 4 assignments.
(3) Have at least 75% of attendance.
(Note that the passing mark is 50 and the course lasts for 8 days)

A student designs an algorithm to check whether a candidate can get a certificate. The design
requires a candidate to enter the results of the 4 assignments and the number of days absent. Suggest
different sets of test data to test the algorithm and state the objective for each set of test data.
Assignments Number of Objective
1 2 3 4 days absent

(8 marks)
Answers
Assignments Number of Objectives
1 2 3 4 days absent
100 80 45 49 0 Test the first requirement
50 52 55 20 0 Test the second requirement
60 70 65 75 3 Test the third requirement
50 60 55 70 2 Get a certificate

Computer & Information Technology for HKCEE 6 © Pearson Education Asia Limited 2004
(Module A1)
Chapter 1 Program Development Procedures Question Bank

(U02C01L02Q004)
The following algorithm finds out the passing rate of a class in a CIT test.

1 Set the number of pass and the total number of students to 0


2 DoWhile there is test result to input
3 Get test result of the student
4 If the student passes the test
5 Then increment the number of pass
6 Increment the total number of students
7 EndDo
8 If the total number of students is greater than 0
9 Then divide number of pass by the total number of students times 100%
10 Else the passing rate is undefined
11 Display the passing rate

(a) (i) What is selection control structure?


(ii) How many selection control structures are there in the algorithm above?
(iii) Identify steps that construct selection control structure in the algorithm above.
(b) (i) What is iteration control structure?
(ii) How many iteration control structures are there in the algorithm above?
(iii) Identify steps that construct iteration control structure in the algorithm above.
(7 marks)
Answers
(a) (i) The selection control structure is the representation of a condition and the choice between
two actions, the choice depending on whether the condition is true or false.
(ii) two
(iii) steps 4 to 5 and steps 8 to 10.
(b) (i) The iteration control structure can be defined as the presentation of a set of instructions to
be performed repeatedly, as long as a condition is true.
(ii) one
(iii) steps 2 to 7

Computer & Information Technology for HKCEE 7 © Pearson Education Asia Limited 2004
(Module A1)
Chapter 1 Program Development Procedures Question Bank

(U02C01L02Q005)
An algorithm is designed to find out the average weight of a class of 40 students. The steps of the
algorithm are as follows:
A. Add the weight to the weight of all the students
B. Display the average weight
C. Divide the weight of all the students by the total number of students to calculate the average
weight of the students.
D. DoWhile there is another student
E. EndDo
F. Get the weight of the student
G. Set the total number of students to 40
H. Set the weight of all the students to 0
(a) However, the order of the steps is not corrected. Rearrange the steps in the correct order.
1 ( )
2 ( )
3 ( )
3.1 ( )
3.2 ( )
4 ( )
5 ( )
6 ( )
(b) The positions of two of the above steps can be exchanged. What are they?
(6 marks)
Answers
(a)
1 (G)
2 (H)
3 (D)
3.1 ( F )
3.2 ( A )
4 (E)
5 (C)
6 (B)
(b) steps G and H

Computer & Information Technology for HKCEE 8 © Pearson Education Asia Limited 2004
(Module A1)

Anda mungkin juga menyukai