You are on page 1of 16

1992 Question

1. (a) For each of the following input devices, name one example of real life application and also
give a reason why the device is chosen:
(i) the bar code reader,
(ii) the image scanner,
(iii) the mouse.
(6 marks)
(b) Give two distinction between using a magnetic disk and a magnetic tape as a data storage
medium.
(2 marks)
(c) There are several differences between RAM and ROM. Name two of them.
(2 marks)
(d) A computer has 1 Kbyte memory with 10 address lines. RAM and ROM share an equal
portion of memory space as described by the diagram below.

If the memory space of RAM expands to ten times its original size, how many additional
address lines are required?
(2 marks)
2. A factory collects old glass of bottles of different sizes for recycling. A bottle will be rejected if it
is composed of substances other than glass. The accepted glass bottles are classified into two types
of different sizes, namely smell bottles and large bottles. The estimated profits for each small
bottle and large bottle are P1 and P2 respectively.
(a) The factory manager wants to have a daily report to show the number of accepted bottles of
each type and the total profit. He refines the daily working procedure as follows:
1992 Question

Complete the chart by matching the following tasks with the modules A-E.
(1) Calculate the daily profit
(2) Print the daily report
(3) Classify the bottles
(4) Count the number of bottles for each type
(5) Examine the bottles
(5 marks)
(b) Draw a flowchart to describe the daily working procedure in (a). Your flowchart should
contain three decision boxes.
(7 marks)
1992 Question

3. Here is a program written in assembly language with the operands represented in binary codes.
Address Instruction Code Operand Meaning
0001 LDA 1110 Replace the contents of the accumulator by the contents
of address 1110
0010 BLE 1010 Branch to address 1010 if the contents of the
accumulator are smaller than or equal to zero
0011 LDA 1111 Replace the contents of the accumulator by the contents
of address 1111
0100 MUL 1110 Multiply the contents of the accumulator by the contents
of address 1110, leaving the result in the accumulator
0101 STO 1111 Replace the contents of address 1111 by the contents of
the accumulator
0110 LAD 1101 Replace the contents of accumulator by the contents of
address 1101
0111 DEC 1110 Decrease the contents of address 1110 by 1
1000 CMP 1110 Compare the contents of accumulator with the contents
of address 1110
1001 BNE 0001 Branch to address 0001 if the contents of accumulator
and contents of address 1110 are not equal
1010 STP 0000 Stop

Assume that the contents of memory addresses 1101, 1110 and 1111 are 2, 5 and 6 respectively.
(a) Complete the following table to show the contents of the memory addresses 1101, 1110,1111
and the accumulator immediately after the execution of the instruction at address 0111 for
the first three passes.
Address 1101 Address 1110 Address 1111 Accumulator
1 st pass 2 2
2 nd pass
3 rd pass
(5 marks)
(b) How many passes will be executed before the program stops?
(2 marks)
(c) What will be the contents of address 1111 after the execution of the program if the initial
contents of address 1101 are changed to
(i) 1?
(ii) -1?
(3 marks)
(d) What is the purpose of the program?
(2 marks)
th
4. Characters are transmitted from Computer A to Computer B using 6 data lines. The i (i = 0, 1, …,
5) data line transmits the i th bit of the binary ASCII code of the character. On receiving a bit
pattern, Computer B converts it back into the corresponding ASCII character according to
its binary value. For example, the character ‘4’ is transmitted as 110100 and converted
back into ‘4’.
1992 Question

(a) The following three character are transmitted from Computer A to Computer B in
sequence:
(i) “2”,
(ii) “z”,
(iii) “8”.
Write down the bit pattern received by Computer and its corresponding character
after conversion for each of the above characters.
(5 marks)
(b) On receiving each sequence of three characters, the interpreter inside Computer B
translates it into an instruction according to the following.
Step 1: The first and third characters are interpreted as integers N1, N2, respectively,
and stored as 8-bit binary numbers.
Step 2: If the second character is a “:”, N2 will be replaced by its two’s
complement.
Step 3: Add N1 and N2.
(i) What is the result of the instruction corresponding to the sequence in (a)?
(ii) Due to transmission error, it is found that bit 0 of every pattern received by
Computer B is always 1. If the same sequence in (a) is sent, write down the
result of the erroneous instruction.
Show your working briefly.
(7 marks)
1992 Question

5. A company sells N type of goods (with stock numbers 1 to N) to M customers (with


customer number 1 to M). The company uses a computer to update its stock file and print
invoices. The sequence of activities involved is shown by the following system flowchart:

(a) Write down three pieces of information which must be input in box 1. Also give one
example of input data which will give rise to an error reported in R1.
(4 marks)
(b) Of the five files F1, F2, …, F5 shown, which is/are transaction file(s)?
(2 marks)
(c) What is the purpose of sorting the file F1 in box 2?
(1 mark)
(d) It can be traced from the system flowchart that three function are performed in Box 3. List
them.
(2 marks)
1992 Question

6. (a) Match each item in Group A with one item in Group B according to the correct
classification:
Group A Group B
1. computer vision I. graphics
2. page composition II. robotics
3. text justification III. desktop publishing
4. speech synthesis
5. computer-aided design
6. artificial intelligence
(3 marks)
(b) Give two methods of discouraging people from marking unauthorized copies of copyrighted
software.
(2 marks)
(c) List three software techniques to maintain the privacy of stored data in a computer.
(3 marks)
(d) The check digit is used to detect error in a sequence of digits due to typing mistakes by an
operator. A validation procedure for an 8-difit sequence is shown below:

Step 1: Add up all the digits of the 7-digit data.


Step 2: Divide the sum by a predefined divisor and get the remainder.
Step 3: Check whether remainder is the same as the check digit. If it is not, then the digit
sequence has been wrongly typed by the operator.
(i) If the predefined divisor is 7, validate the following 8-digit sequences. Show your
working
3 2 1 7 8 9 1 3 briefly.
(1)
1 0 1 1 2 1 1 2 (2)

(ii) Describe when the above validation procedure may fail to detect errors.
(4 marks)
1992 Question

1. A student writes the following program for retrieving railway ticket information:
1992 Question

The program should produce the output on the VDU. (In the output, all the information following
the question marks is entered though the keyboard by the user. All other items are output from the
program.)
1992 Question

Use the following table to show corrections required for the program to produce the above output.

Line Number Correction(s) Required

(25 marks)
1992 Question

2. Below is the program flowchart of a computer game using matches:


1992 Question

Before the game start, the computer generates two random integers N and F, where 10 ≤ N ≤ 50
and F is either 0 or 1. N is number of matches displayed, and F is used to decide who has the first
move. In this game, the player and the computer take turns at removing M matches away
0<M ≤ N/2. The one who has to take last match loses.
(a) Assume the BASIC function RND(1) a return number x such that 0 ≤ x<1. Write a BASIC
statement corresponding to each of boxes 2 and 3:
Box BASIC statement
2
3

(4 marks)
(b) On what condition will the computer give the player the first move?
(2 marks)
(c) The BASIC statement corresponding to box 7 is of the following form:
700 IF NOT ( ) THEN 600
where 600 is the line number corresponding to box 6.
Complete the above BASIC statement by filling in the blank
(3 marks)
(d) Describe the strategy the computer uses to remove matches.
(2 marks)
(e) Explain why box 8 is needed.
(2 marks)
(f) What is the purpose of box 11?
(2 marks)
(g) Write down the content of box 14.
(2 marks)
(h) In box 4, the matches are displayed on the screen using the following symbols:
Symbol Meaning
* ten matches
# five matches
o one match
e.g. 28 matches are displayed as**# o o o, and 32 as *** o o.
Using lines 400-499, write a BASIC program segment corresponding to box 4.
(8 marks)
1992 Question

3. The following program simulates the spelling checking function of a word processor.
1992 Question

(a) Match the variable names in Group A with the meanings in Group B:

(6 marks)
(b) Describe the function of line 90.
(1 marks)
(c) Before SENT$ in line 80 undergoes spelling checking, a space is added to it in line 100.
Explain why this step is needed.
(2 marks)
(d) Just before the execution of line 300, write down the content of the variable SEWORD$ if
the content of EWORD$ is “Abc8Zt”
(2 marks)
(e) There are two loops in the spelling checking subroutine in lines 290-400.
(i) Write down the function of the first loop.
(ii) Write down the function of the second loop.
(iii) J is the loop control variable. Can it be replaced with I? Explain.
(5 marks)
(f) Write down the output of the program if the following sentence is input in lines 80:
“The library is a treasure hoouse of knowledge”
(4 marks)
(g) Suppose line 300 is change to:
300 REM
Write down the output of the program if the following sentence is input in line 80:
“I am a boy.”
(5 marks)
1992 Question

4. a student writes a BASIC program for a newsagent to arrange for four different newspapers to be
despatched daily. The program should produce the output below on the VDU. (In this output, all
the information following the question marks is entered through the keyboard by the user. All
other items are output from the program.)
1992 Question

The main part of the program has already been written as follows:
1992 Question

The file “CUST” consists of 6 records listed below:


Record N$ AD$ CD$ TP MP OP SP
1 Wong SW 14B, 530 Nathan Road 1 0 0 1 1
2 Law CW 18E, 230 Kings ROAD 2 0 0 1 1
3 Tang GT 21A, 125 Electric Road 2 0 1 0 1
4 Chan ET 3C, 650 Prince Road 1 0 1 0 0
5 Chu TS 8B, 265 Causeway Bay 2 1 0 0 0
6 Lee CW 5A, 23 Boundary Street 1 1 0 0 0
If no new arrays are to be used and the file “CUST” may consist of more than 6 records, write a
BASIC subroutine for each of the following: [note: the file handing statements must follow the
syntax shown on the last page of this question-answer book]
(a) [Using lines 1000-1999] read data records from the file “CUST”, calculate the number of
copies required for each newspaper and print the newspaper summary as indicated in the
sample run.
(10 marks)
(b) [Using lines 2000-2999] print the dispatch schedule as shown in the sample run.
(15 marks)

You might also like