Vous êtes sur la page 1sur 15

1996 Question

1. (a) In the following diagram, the boxes represent the main hardware components of a computer
and the arrow lines represent the data flow between the components.

(i) Write down the name of the component represented by box X. Name one device which
is an example of this component
(ii). Write down the name of the component represented by box Y. Name one device which
is an example of this component.
(4 marks)
(b) In the following diagram, boxes A and B represent two registers in the central processing
unit of a computer.

(i) Write down the name of the register represented by box A.


(ii) Write down the name of the register represented by box B.
(iii) Give any three other registers that are present in the central processing unit.

1
1996 Question

(iv) Write down the main function of a control bus.


(v) If the register represented by box B consists of 16 bits, find the maximum
number of memory locations that can be accessed by the computer.
(8 marks)
2. CLASSA and CLASSB are files of the same structure as shown below:

Field Field Name Contents


1 NAME student name
2 STUDNUM student number
3 AGE age

The following records are stored in CLASSA:


Record NAME STUDNUM AGE
1 Wang Tai Man 39281 12
2 Wong Man Yi 12365 13
3 Li Tak Kin 98714 10
4 Law Sai Min 65217 12
5 Mak Mei Mei 34250 15

The following records are stored in CLASSB:


Record NAME STUDNUM AGE
1 Cheung Che Lin 23483 14
2 Wan Biu 53341 11
3 Tang Siu Kuen 13251 10
4 Leung Shing 62464 11
5 Mui Chan Chun 74313 13

(a) Suppose CLASSA has been sorted in alphabetical order of student names. Write down the
first record of CLASSA.
(1 mark)
(b) Suppose CLASSA and CLAASSB have been sorted in descending order of the student
numbers. If CLASSA and CLASSB are now merged together according to student numbers
to become one file, write down the fourth and eighth records of the merged file
(2 marks)
(c) The rightmost digit of each student number is calculated from using the following formula:
rightmost digit = remainder when the sum of the leftmost four digits is divided by 7
(i) What is the function of the rightmost digit of the student number?
(ii) Write down all the invalid student numbers in CLASSA and CLASSB.
(5 marks)

2
1996 Question

(d) CLASSA and CLASSB have the following two weaknesses:


weakness 1: there is no distinction between boys and girls;
weakness 2: the file have to be updated regularly even though there is no change in the
student lists.
Suggest two modifications of the file structure to remove the above weaknesses.
(4 marks)
3. A display board is composed of seven light bars (numbered 0, 1, 2, 3, 4, 5 and 6) as shown in the
diagram below:

Each light bar can be turned on or off.


A decimal digit (0, 1, …., 9) can be displayed on the board by turning on the appropriate light
bars. For example, the digit 0 is displayed when light bars numbered 0, 1, 2, 3, 4 and 5 are turned on, as
shown below.

A dedicated computer is now used to control the turning on and off of the display board light bars.
The computer will execute instructions of one byte long according to the following rules:
Rule 1: Bits 0 to 6 used to control the display of the pattern. The i-th light bar is turned on if the
i-th bit is 1; the I-th light bar is turned off if the i-th bit is 0
Rule 2: Bit 7 is used to control the display duration. If bit 7 is 0, the pattern will be displayed

3
1996 Question

for 2 seconds. If bit 7 is 1, the pattern will be displayed for 3 seconds.


bit 7 bit 0

(a) Study the following program:


0000 0110
1111 1101
1111 1111
(i) Write down the sequence of patterns displayed by the program.
(ii) What is the total time used by the program for displaying patterns?
(4 marks)
(b) (i) Write a program to display the digits 2 and 3 in sequence. Each digit should be
displayed for two seconds.
(ii) Write a program to display the digits 2, 3, 4, and 5 in sequence. Between the display of
every two digits, the program should turn off all the light bars for three seconds. The
total execution time of the program should be 17 seconds.
(8 marks)
4. A tourist information center has a computer system that allows visitors to make various enquiries.
The system has a touch screen for input (i.e. the computer is able to recognize the location of a
touch on the screen) and allows users to choose either English or Chinese as the language
medium.
The first menu displayed on the screen is:

After a language is chosen, the second menu displayed on the screen is shown below: (Note: The
second menu will be displayed in English or Chinese according to the language chosen.)

4
1996 Question

(a) Give one advantage and one disadvantage of using a touch screen as the input device for the
system.
(2 marks)
(b) When a user has made his choice in the second menu, the system will present the relevant
tourist information. After the presentation of information, the second menu will appear again
on the screen.
(i) Information can be presented to users in text, in graphics or in other forms.
Besides text and graphics, suggest two forms of information presentation for this
system.
(ii) For each answer in (b)(i), suggest one suitable output device to present the
information
(iii) Suggest what the system should do if the screen has not been pressed for a long
time. Give one reason for your suggestion.
(8 marks)
(c) Besides the tourist information center, name two suitable places for using this type of
computer system.
(2 marks)
5. A hospital has a computer system that handles the information about all is patients.
(a) When a patient is admitted to the hospital, the hospital staff will enter the patient’s identity
card number into the computer.
(i) Why should the patient’s identity card number be recorded?
(ii) Suggest one verification method and one validation method to ensure that identity card
numbers are correctly entered.
(3 marks)
(b) When a new patient is admitted to the hospital, the hospital staff will enter the patient’s
identity card number, name, address, telephone number, data of entry etc, into the computer.
(i) Why should the date of entry be recorded?
(ii) Name three other pieces of personal information that should be entered into the

5
1996 Question

computer.
(5 marks)
(c) The hospital sets up a password system in order to prevent unauthorized access to the file of
personal information.
Describe two ways in which personal information stored in the file may still leak out.
Suggest a preventive measure for each way.
(4 marks)
6. (a) For each of the following persons, name one type of application program that would best
facilitate the person’s work:

(i) a writer;
(ii) an accountant;
(iii) a personnel manager;
(iv) an architect;
(4 marks)
(b) “An application program cannot run when an operating system is absent.”
Is the above statement correct? Explain why.
(3 marks)
(c) Software companies normally produce new versions of their software products from time to
time.
(i) Give two reasons why software companies frequently make new versions of their
software products.
(ii) A person using the existing version of software product needs to consider several
factors before he buys the new version of the product. Name three factors that he
should consider.
(5 marks)

6
1996 Question

1. (a) A program is to be written to perform the following tasks:


- to accept a sequence of character terminated by ‘!’
- to output the sequence (excluding ‘!’) in reverse order
Below is a sample run of the program:
[Enter a sequence of characters terminated by !]
abcde!
The sequence in reverse order is: edcba
Chi Keung uses the following method for writing the program:
Accept and place the characters one by one into an array.
Print the array elements in reverse order.
The program written by him is shown below:

However, there are several mistakes in the main program. Fill in the following table to show the
locations of all the mistakes and their corrections.
Line Number Corrected Statement

(12 marks)

7
1996 Question

(b) Convert the following algorithm into a Pascal program:


1. Declare DFILE to be a text file.
2. Declare CNT to be an integer variable.
3. Declare XCHAR to be a character variable.
4. Set CNT to 0.
5. Associate DFILE with disk file FDATA.
6. Prepare DFILE for reading.
7. As long as the end of file is not reached, do the following:
Read a character from DFILE and assign it to XCHAR:
if XCHAR equals ‘A’, increase CNT by 1.
8. Display CNT.
9. Close the file DFILE.
(13 marks)
2. Functions KR and KL are given below:
Function KR (IPSTRING: string) : string;
begin
KR:=copy(IPSTRING, 1, length(ISPTRING)-1)
end;
Function KL(IPSTRING: string) : string;
begin
KR:=copy(IPSTRING, 2, length(ISPTRING)-1)
end;
(a) Write down the output following statements:
(i) writeIn (KR(‘123456’))
(ii) writeIn (KL(‘123456’))
(iii) writeIn (KR(KL(‘123456’)))
(3 marks)
(b) Describe the purpose of each of the following functions:
(i) KR
(ii) KL
(2 marks)
Functions KRN and KLN are given below:

8
1996 Question

(c) Write down the output of the following statements.


(i) writeIn (KRN(‘123456’, 2))
(ii) writeIn (KLN(‘123456’, 4))
(4 marks)
(d) What will be the result of the function KRN(IPSTRING, N) for each of the following cases?
(i) N≤ 0
(ii) 0<N<length(IPSTRING)
(iii) N ≥ length(IPSTRING)
(6 marks)
The following program contains the functions KR, KL, KRN and KLN:

9
1996 Question

(e) Write down the output the program if the input string is ‘1234567’.

(3
marks)
The main program is now modified as follows:

(f) Write down the output of the modified program if the input string is
(i) ‘123456’

(ii) ‘123456789’

10
1996 Question

(7 marks)
3. A long-distance bus company runs 40 bus routes.
Each bus route joins the central bus terminus C to a bus terminus represented by Bi
(where i=1,2,….,40), as shown below:

The manager of the bus company wants to write a Pascal program to calculate the bus fees.
Each bus route has:
- a route name;
- a distance (km) from C to Bi, which is an integer;
- a rate ($/km), which is an integer.
The bus fee for each route is calculated by the following formula:
Bus fee = distance × rate
The following program segment is written to declare a data structure which will be used to store
the bus route information.
type BL = record
BNAME: ;
BDIST: ;
BRATE:
end;
var BR: [1..40] of ;
In this data structure, BNAME, BDIST and BRATE will be used respectively for storing the name,
distance and rate of a bus route,
(a) Fill in the following blanks to complete the above data structure.
(1)
(2)
(3)
(4)
(5)
(5 marks)

11
1996 Question

Assume that the variable BR has already been defined in the variable declaration part of the
program, and that all bus route information has been stored in BR.
(b) Write a procedure which outputs the name, distance, rate and fee of each route as shown
below:
Route Name Distance (km) Rate ($/km) Bus Fee($)
NORTH TOWN 30 3 90
WEST POINT 25 2 50
EAST PARK 28 3 84
‥ ‥ ‥ ‥

(5 marks)
(c) Write a procedure which accepts a string (using the prompt “Enter the name of a route:”),
finds the route whose name equals the input string, and then outputs the name, distance and
fee of the route found. If no route is found, the procedure outputs the message “No such
route found”.
Below are sample output of the procedure:
[Sample 1]
Enter the name of a route: NORTH TOWN
Rout name: NORTH TOWN
Distance: 30 km
Bus fee: $90
[Sample 2]
Enter the name of a route: NORTH ROOM
No such route found
(8 marks)
(d) Write a procedure which finds the bus route with the minimum fee and outputs the name and
fee of the route as shown below:
Route name: HIGH STREET
Bus fee: $5
(7 marks)
4. (Note: In this question, you will be awarded up to 4 marks for effective communication.)
An alumni association collects membership fees from members once every year and sends
newsletter to its members from time to time.
The association does not use a computer for its operation. In its manual system, there are
- a mailing list,
- member registration cards, and
- a fee record list

12
1996 Question

The mailing list consists of address labels as shown below:


Mr Chan Tai Man
136 High Street
3/F, Hong Kong

Miss Cheung Siu Ling


149 Prince Edward Road
2/F, Kowloon

The registration cards are stored in alphabetical order of members’ names. Each card is in the
following format:

Name:
Sex:
Address:
Telephone Number:
HK ID Number:
Year of Graduation:
Occupation:
Membership Number:

The fee record list is used to keep a record of the payment of fees. It has the following format:

( =membership fee paid)

13
1996 Question

When a person applies for membership in the association, he needs to fill in a registration card and
pay the membership fee. After verifying the information on the card, the association will place the
card in the right place and add the necessary information to the mailing list and the fee record list
for the new member.
A member is classified as inactive if
- the member has not paid the membership fee for three consecutive years;
or - the member has not paid the membership fee for one year and is out of contact with the
association.
The association removes the membership of all inactive members at the end of each years.
The association is now planning to computerize its manual system.
(a) The person applying for membership should be required to produce some relevant
documents for the verification of information on this registration card. Name two such
documents and explain how they can be used for verification.
(4 marks)
(b) Name two serious problems in the design of the fee record list. Suggest how to overcome
these problems.
(4 marks)
(c) Describe the operations that are involved in removing all inactive members from
membership.
(5 marks)
(d) Suppose the association has computerized its system and a computer file called MEMBER is
now used to hold members’ information required for the running of the system.
Complete the following table to show a structure for MEMBER.
Field Name Description of Contents

(6 marks)
(e) It happens that the chairman of the association is the manager of a credit card company. The
company has printed pamphlets for the promotion of the company’s credit card.
Explain why it is an invasion of privacy for the chairman to make use of the association’s

14
1996 Question

mailing list to send pamphlets directly to the association.


(2 marks)

15

Vous aimerez peut-être aussi