Hkcee Comp 1997

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 12

1997 Question

1. The hardware components of a certain microcomputer are connected by a bus as shown in the
diagram below:

(a) Which of the above hardware components are output devices?


(2 marks)
(b) The bus consists of three groups of wires each group carrying a different type of information.
Write down the three types of information carried by the three groups of wires.
(3 marks)
(c) Give two advantage of using a hard disk instead of using a floppy disk.
(2 marks)
(d) A student has written a program. He wants to save his program for future use.
Explain why the program should be saved
(i) to the hard disk but not to RAM;
(ii) to the hard disk but not to ROM.
(2 marks)
(e) Each time the microcomputer is switched on, a program first will be run to start up the
computer. Explain why this program should be stored in ROM instead of on the hard disk.
(3 marks)
2. (a) John is a systems analyst in a computer company. John is currently in charge of designing
the
following systems for customers:
System A: a computer game of flight simulation
System B: a factory payroll system
System C: a point-of-sale system in a chain superstore
(i) John decides that System A should be a real-time system. Give one reason in support of
this decision of John’s.
(ii) John decides that System B should be a batch processing system. Give one reason in
support of this decision of John’s.
(iii) John decides that System C should be an interactive system. Give one reason in support
of this decision of John’s. Also suggest a suitable type of file organization for storing
the prices of products in System C and give one reason for your suggestion.

1
1997 Question

(8 marks)
(b) (i) In designing a system, a systems analyst needs to define the system objectives
accurately to ensure that the user’s needs are met. Describe briefly how a systems
analyst collects information from the user for defining the system objectives.
(ii) Besides a systems analyst, name two other computer-related jobs.
(4 marks)
3. A company uses a robot to move cargo from one location to another. The robot accepts 7-bit
instructions as follows:
bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0

Each instruction causes the robot to choose a direction (North, East, South or West), move in that
direction for a number of steps (0, 1, 2, or 3) and then perform an action (pick up an item of cargo,
release an item of cargo, or no action).
The direction, number of steps and action of the robot are determined by the contents of bits 6-5,
bits 4-3 and bits 2-1 respectively according to the following tables:
6-5 bits 00 01 10 11
direction North East South West

4-3 bits 00 01 10 11
no. of steps 0 1 2 3

2-1 bits 00 01 10
action No Action Pick Up an Item Release an Item
of Cargo of Cargo

Bit 0 is the even parity check bit.


The following diagram shows the area in which the robot moves.

Note: The direction towards the top of the page represents North and the direction towards the
right represents East. Each square represents one step. S is the starting point of the robot.
(a) Copy the above diagram in your answer book. On the diagram in your answer book, draw
the

2
1997 Question

route taken by the robot when it executes the following sequence of instructions: (Use the
character ‘p’ to indicate on the diagram where an item of cargo is picked up, ‘R’ to indicate
where an item of cargo is released and ‘E’ to indicate the final position of the robot.)
0010001
0111010
1001101
1110001
1001000
0101000
(5 marks)
(b) The diagram below shows a route for the robot.

The robot starts at S, picks up an item of cargo at P, releases the item of cargo at R and ends
its trip at E.
Write down a sequence of instructions for the above route and actions.
(2 marks)
(c) Write down a sequence of two instructions which causes the robot to pick up an item of
cargo at its starting position and then release the cargo after moving one step to the North.
(2 marks)
4. A programmer writes a high-level language program, Program A. He then uses a compiler to
translate Program A into an executable machine-code program Program B.

(a) A compiler translates high-level language program in a way different from that of an
interpreter. Describe one main difference between the translation method used by a compiler
and that used by an interpreter.

3
1997 Question

(2 marks)
(b) Why must Program A be translated into Program B before it can be run by the computer?
(2 marks)
(c) When the programmer writes Program A, he dose no start every line in the same column.
Give one reason for this.
(2 marks)
(d) Suppose after Program A has been translated into Program B, the programmer accidentally
erases Program A.
(i) Explain why the programmer can still run his program.
(ii) Explain why the programmer will find it difficult to debug his program.
(4 marks)
(e) When the programmer sells his program, he supplies only Program B to the buyer. Give one
reason why Program A is not supplied to the buyer.
(2 marks)
5. Mr Lee works in an advertising agency. His job is to design and produce magazine advertisements
for customers. He takes pictures and inputs the pictures into a computer by means of scanner.
By using a graphics software package, Mr Lee is able to process the input pictures as well as add
text or graphical images to the pictures.
(a) State three ways of changing the appearance of a graphical image by using a graphics
software package.

Mr Lee also uses the scanner to input text into the computer. The text and the pictures are input are
in the same way but a special program is required so that the computer is able to recognize
individual characters in the text.
(3 marks)
(b) (i) Give the name of the above text inputting method.
(ii) Give one other real life application of this text inputting method.
(2 marks)
When Mr Lee is satisfied with his design, he uses a printer to produce a hard copy of his work.
(c) (i) Compare an inkjet printer and a laser printer in terms of printing quality, speed and
cost.
(ii) Is an inkjet printer a page printer? Is a laser printer a page printer?
(4 marks)
Mr Lee is thinking of upgrading his computer so as to improve his work efficiency.
(d) For each of the following hardware components, explain why an upgrade will improve work
efficiency:
(i) random access memory
(ii) central processing unit

4
1997 Question

(iii) hard disk.


(3 marks)
6. Suppose the Education Department has a large central computer in which a lot of freeware(i.e.
software that is distributed free of charge) has been installed. In order for the freeware to be
accessed by schools through public telephone lines, the Education Department gives each school a
microcomputer system installed which a modem and a communications package.

(a) (i) Explain why accessing through the public telephone lines requires the use of a modem.
(ii) In order to connect the microcomputer of a school to the central computer, do you think
it is necessary to install the same communications package in both computers? Briefly
explain your answer.
(4 marks)
(b) Suppose the Education Department buys a commercial application program and installs it
in the central computer. The Education Department allows schools to download a copy of the
program.
(i) Explain why this may be a violation of the copyright law.
(ii) Suggest a way for the Education Department to overcome the copyright problem in this
case.
(4 marks)
(c) Suppose the central computer is now linked to the computer of the Examinations Authority.
Describe two possible services that can be provided to students by the Examinations
Authority through this linkage.
(4 marks)

5
1997 Question

1. (a) Man Wah wants to write a program which:


- accepts a sorted sequence of names terminated by ‘*’;
- outputs the names in the sequence; repeated names are output once only.
Man Wah uses the following method for writing the program:
Accept and place the names one by one into an array.
Output the first element of the array.
For each of the remaining elements, output the element if it is not the same as the previous
element.

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.

6
1997 Question

Line Number Corrected Statement

(12 marks)
(b) The algorithm below calculates the greatest common divisor of two positive integers by
repeated subtraction and replacement,
1. Declare X, Y, D, and GCD to be integer variables.
2. Read in two integers and store them into X and Y respectively.
3. Assign 1 to variable D.
4. As long as the value of D is not equal to zero, repeat steps 5 to 6:
5. Assign the absolute value of X-Y to variable D.
6. If X is greater than Y,
Then assign the value of Y to variable X,
assign the value of D to variable Y,
else assign the value of X to variable Y,
assign the value of D to variable X,
7. If X is greater than Y,
then assign the value of x to variable GCD.
else assign the value of Y to variable GCD.
8. Display the value of GCD.
Convert the above algorithm into a Pascal program.
(12 marks)
2. A procedure is give below:

7
1997 Question

(a) For each of the following statements, write down the value of FLAG after execution of the
statement:
program statement value of flag after execution of the
statement
F1 (‘aabbccddee’, ’a’, FLAG)
F1 (‘abcjklrst’, ‘w’, FLAG)
(4 marks)
Procedure F1 is modified to become the following procedure:
procedure F2 (IPSTRING, XSTRING: strin; var P, FLAG: intefer);
begin
FLAG := 0;
while (FLAG = 0) and (P>0) and (P <= length(IPSTRING)) do
begin
if copy (IPSTRING, P, 1) = XSTRING then FLAG := 1;
P := P + 1
end
end;
(b) For each of the following program segments, write down the of P and FLAG after execution
of the segment:
Program segment Value of P after execution of Value of FLAG after execution
the segment of the segment

P:=2;

F2 (‘zxywlma’, ‘w’, P, FLAG)


P:=3;

F2 (abcjklrst’, ‘a’, P, FLAG)


P:=9;

F2 (‘abcabc’, ‘a’, P, FLAG)

(6 marks)
(c) (i) If the value of FLAG is 1 after execution of the statement F2(‘abcabcd’, ‘a’, P, FLAG),
find all possible value of P just before execution of the statement.
(ii) If the value of FLAG is 0 after execution of the statement F2(‘abcabcd’, ‘a’, P, FLAG)
find all possible values of P just before execution of the statement.
(iii) Suppose P = 5 and length(IPSTRING) = 10 just before execution of the statement
F2(‘IPSTRING’, ‘a’, P, FLAG), write down all possible positions of character ‘a’ in
IPSTRING.
(iv) Suppose length(IPSTRING) = 10. If the values of FLAG and P are 1 and 7 respectively
after execution of the statement F2(IPSTRING, ‘a’, P, FLAG), write down the position
of character ‘a’ in IPSTRING. (8 marks)

8
1997 Question

Based on procedure F2, another procedure is written below:

(d) (i) Write down the output obtained when the statement when the statement
F3(‘abcijk’, ‘abk’) is executed.

(ii) Write down the output obtained when the statement when the statement
F3(‘abk’, ‘abcijk’) is executed.

(7 marks)
3. A company has 70 employees and several departments.
The company manager wants to write a Pascal program to handle matters concerning the
employees’ salaries.
The following information about each employee will be stored in the computer:
- Hong Kong identity card number
- name
- department name (i.e. name of the department to which the employee belongs)
- salary (in whole numbers)
The program segment below declares a data structure which will be used to store the above
information.

9
1997 Question

type EL = record
ENUM: (1) ;
ENAME: (2) ;
EDPT: (3) ;
ESALARY: (4) ;
end;
var ER: (5) [1..70] of (6) ;
In this data structure, ENUM, ENAME, EDPT and ESALARY will be respectively for storing the Hong
Kong identity card number, name, department name and salary of an employee.
(a) Fill in the following blanks to complete the above data structure.
(1)
(2)
(3)
(4)
(5)
(6)
(6 marks)
Assume that the variable ER has already been defined in the variable declaration part of a
program, and that all employee information has been stored in ER.
(b) Write a procedure which counts the number of employees whose salaries are more than
$7000 but less than $25000. The procedure should also display the names and department
names of those employees. Below is a sample output of the procedure:
Wong Tai Ming (Finance)
Lee Wing Tat (Sales)
Chan Kin Kei (Finance)
Law Mei Ling (Administration)
Total number: 4
(c) Write a procedure which accepts the name of a department (using the prompt ‘Enter the
name of a department:’) and then calculates and outputs the average salary of the employees
in that department, correct to the nearest integer. You may assume that the input name is
valid. Below is a sample output of the procedure:
Enter the name of a department: Finance
The average salary is $11047.
(9 marks)
(d) Suppose the salaries are to be adjusted in the following way:
Increase the salary of employees in the sales department by $500 each.
Increase the salary of all other employees by $200 each.

10
1997 Question

Write a procedure which updates the employees’ salaries in the above way. (Assume that the
department name of the sales department is ‘Sales’.)
(4 marks)
4. (Note: In this question, you will be awarded up to 4 marks for effective communication.)
Siu Ming is treasurer of a class association. He keeps records of the money received and the
money paid out the association.
Each time an amount of money is received or paid by the association, Siu Ming records the
following information for the transaction made:
- a reference number assigned by Siu Ming
- the transaction amount
- an account name to tell from where the amount is received or to where the amount
is paid
- a remark, which is a short paragraph giving details about the transaction
Siu Ming’s way of assigning the reference numbers is as follows:
The reference number is formed by combining a character ‘R’ or ‘P’ with the date of
the transaction. The characters ‘R’ and ‘P’ are used to indicate whether the amount is
received or paid. For example, if an amount for ‘class Fee’ is received on 8th October
1996, the reference number assigned will be ‘R08/10/96’.
At the end of the year, Siu Ming produces the following reports for the association:
- cash report for the year
- budget for the coming year
Both of these reports use the format as shown below:

Siu Ming has a computer with the following application software packages installed:
- a database package
- a spreadsheet package
Siu Ming uses the database package for recording transactions. A file called CLASS is used to
store the transaction records.

11
1997 Question

(a) Suggest two pieces of information that should be included in the remark of a transaction
record. (2 marks)
(b) State two problems in Siu Ming’s way of assigning reference numbers. Suggest a method of
overcoming each of the problems. (4 marks)
(c) Complete the following table in order to design a suitable list of fields for CLASS.
Field Name Description of Contents

(5 marks)
At the end of the year, Siu Ming uses the database package to find the total amount of money in
each account. He then enters the total amount in each account into a spreadsheet as shown below:

(d) (i) Which numbers in the above spreadsheet are entered by Siu Ming?
(ii) If the formula for calculating the total received is C2+C3+C4 write down each of the
following:
(I) the formula for calculating the total paid;
(II) the formula for calculating the net total received.
(iii) If Siu Ming changes the amount of Class Fee, describe the changes observed in the
spreadsheet. (6 marks)
In preparing the budget for the coming year, Siu Ming decides that
- all amounts of money paid out should be increased by 10%
- all amounts of money received should remain unchanged except for the Class Fee
- the net total received should be as close to $500 as possible.

(e) Describe how Siu Ming could use the spreadsheet to produce a budget for the coming year
satisfying the above criteria. (4 marks)

12

You might also like