Download data processing assignment - The ELCHK Yuen Long Lutheran

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Corecursion wikipedia , lookup

Transcript
Chapter 3 – Data Processing
Section 1: Digital Data, Bit, Byte (Combinations), Two’s complement and Binary System
1. In a computer system, 8 bits are reserved for user identity codes and 48 bits are reserved for user alias names. It
is assume alias name has to be in ASCII code format. What is the maximum length of a valid user alias name?
A. 6
B.
8
C. 48
D.
256
2. The status of users of an Intranet of a school can be either “student”, “parents”, “teachers” or “administrator”.
Binary codes format has been used to represent the username. How many bits should be used to represents the
different status of users?
A. 1
B.
2
C. 3
D.
4
3. A user tries to choose a password of his own having four characters as shown below:
Which of the following situations will provide the greatest numbers of codes of passwords?
A. Each of the four digits is selected from numerals “0” to “9”.
B. Each of the four digits is selected from upper case letters “A” to “Z”.
C. The first digit is selected from numerals “0” to “9” and the remaining digits are selected from upper case letters “A”
to “Z”.
D. The first digit is selected from upper case letters “A” to “Z” and the remaining digits are selected from numerals “0”
to “9”.
4. The Thai Alphabet consists of 55 characters. How many bits are needed to represent those characters?
A. 5 bits
B.
6 bits
C. 16 bits
D.
32 bits
2011CIT MC#6
5.
A factory produces five models of mobile phone. Each model has three different colours. Each type of mobile
phone will be assigned a unique binary code. What is the number of bits required for the binary code?
A.
4
B.
5
C.
8
D.
15
Use the following case to answer Question 6 and 7:
A remote-controlled toy can be controlled using the following commands:
Direction
Speed Level (metre per minute)
Left
1, 2, 3 or 4
Right
1, 2, 3, 4 or 5
Forward
1, 2, 3, 4 or 5
backward
1, 2 or 3
2008CIT MC#6
6.
After completing the following four commands, the toy car goes back to its original position. What are the last
P. 1
command and its duration?
Command (direction and speed level)
Duration (minutes)
Forward 1
10
Backward1
3
Forward5
1
Command
Duration
A.
Backward6
2
B.
Backward5
2
C.
Backward2
6
D.
Backward1
8
2008CIT MC#7
7.
If a binary code is used to represent a command of the car, what is the minimum number of bits required for the
code?
8.
9.
A.
4
B.
5
C.
6
D.
9
A character set has 24 characters. The minimum number of bits needed to represent them is
A.
2
B.
4
C.
5
D.
24
The hardware address of a network device consists of 48 bits. Which of the following is a valid address in
hexadecimal?
10.
A.
00E0071944 A0
B.
0A23B5
C.
1E07FG124372
D.
398A7E9412110408
Which of the following statements is / are correct?
(1)
Analogue signals are continuous while digital signals are discrete.
(2)
Digital data can be stored more efficiently than analogue data.
(3)
Digital data has a lower rate of transmission error.
A.
(1) only
C.
(1) and (3) only
B.
D.
(2) only
(1), (2) and (3)
11. For a computer which uses 8 bit two’s complement to represent numbers. Which of the following will not create
overflow error?
(1) Decline 01111111 by 1.
(2) Decline 10000000 by 1.
(3) Increment 11111111 by 1.
A. (1) and (2) only
B.
(1) and (3) only
C. (2) and (3) only
D.
(1), (2) and (3)
12. With 6-bit two’s complement representation, which of the following statement is correct?
P. 2
(1) The largest number is 32.
(2) The smallest number is –32
(3) Two numbers are being added together, if the first number is “0XXXXX” and the second number is “1XXXXX”
where X represents any “0” or “1”, then, the result will not be data overflow.
A. (1) and (2) only
B.
(1) and (3) only
C. (2) and (3) only
D.
(1), (2) and (3)
13. Which of the following is the signed representation of -91 in 8 bits two’s complement format?
A. 11011011
B.
10100100
C. 10100101
D.
00100101
14. Signed representation of -77 in 8 bits is
A. 11001101
B.
01001101
C. 10110010
D.
10110011
15.
What is 103(10) NOT equivalent to?
A. 67(16)
B.
147(8)
C. 01100111(2)
D.
1110111(2)
16. Arrange the following numbers in ascending order:
(1) EE16
(2)
1101 10012
(3) 6710
(4)
AC16
A. (3)<(4)<(2)<(1)
B.
(3)<(1)<(2)<(4)
C. (3)<(4)<(1)<(2)
D.
(3)<(1)<(4)<(2)
17.
Which of the following statements is/are NOT correct?
(1)
BY16 is a valid number.
(2)
7C616 is a valid number.
(3)
The Hexadecimal System uses 16 symbols, "1" to "9" and "A" to "G'
(4)
Computers use binary numbers to represent data.
A.
(1) only
B.
(1) and (2) only
C.
(1) and (3) only
D.
(1), (3) and (4) only
M.C. Answer:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
A
B
B
B
A
C
B
C
A
D
B
C
C
D
D
A
C
P. 3
18
19
20
Conventional Question:
1.
a)
With 16 bit representation, what is the value (in denary form) of
(3 marks)
(i)
the maximum integer of unsigned numbers.
(ii)
the maximum integer of a signed number with two’s complement representation.
(iii)
the minimum integer of a signed number with two’s complement representation.
b) With 8 bit two’s complement representation, state the answers in binary form.
(2 marks)
The greatest value it can represent
The least value it can represent
c) Under 8 bit two’s complement representation, perform 3510 – 8210 with detail calculation. (4 marks)
Two’s complement representation of 3510
Two’s complement representation of
-8210
Perform 3510 – 8210 by two’s complement representation
=
d)
10
By 10 bit computer system with two’s complement representation, which of the following cases will create
overflow errors? Circle the correct answer.
2.
a)
(i)
550 – 510
Yes / No
(ii)
–222 – 333
Yes / No
(iii)
123 + 234
Yes / No
(3 marks)
With 12 bit representation, what is the value (in denary form) of
(3 marks)
(i)
the maximum integer of unsigned numbers.
(ii)
the maximum integer of a signed number with two’s complement representation.
(iii)
the minimum integer of a signed number with two’s complement representation.
P. 4
b) With 7 bit two’s complement representation, state the answers in binary form. (2 marks)
The greatest value it can represent
The least value it can represent
c) Under 7 bit two’s complement representation, perform 2710 – 6010 with detail calculation.
(4 marks)
The representation of 2710 in binary
Two’s complement representation of
format
-6010
Perform 2710 – 6010 by two’s complement representation
=
d)
10
By 8 bit computer system with two’s complement representation, which of the following cases will create
overflow errors? Circle the correct answer.
(i)
132 – 120
(ii)
–118 + 111
Yes / No
(iii)
63 + 78
Yes / No
(3 marks)
Yes / No
P. 5
Chapter 3 – Data Processing
Section 2: Characters Encoding
1. A computer user types three Chinese characters and nine bytes are used to store the characters. What is the
encoding method?
A. GB
B.
ASCII
C. UTF-8
D.
Morse code
2. How many bytes are used to store the following characters?
元朗信義中學(YLLSS)
A. 11
B.
17
C. 19
D.
21
3. The size of a text file (ASCII code) is 512 KB. The maximum number of characters stored in the file is
A. 512
B.
51200
C. 512000
D.
524288
4. Assume that all the data below are alphanumeric. Which of the following sets is arranged in descending order
correctly?
A. “1234”, “512”, “33”
B. “33”, “1234”, “512”
C. “512”, “33”, “1234”
D. “33”, “512”, “1234”
5. Which of the following mappings about character coding system is not correct?
Coding
The number of bits
A. ASCII
7
B. Big5 code
16
C. GB code
16
D. Unicode
33
6.
Which of the following character sets will contain both simplified Chinese characters and traditional Chinese
characters.
7.
(1)
ASCII
(2)
Unicode
(3)
Big-5
A. (1) only
B.
(2) only
C. (2) and (3) only
D.
(1), (2) and (3)
Assume that all the data below are alphanumeric. Which of the following sets is arranged in descending order
correctly?
A.
“2851”, “763”, “42”
B.
“42”, “2851”, “763”
C.
“763”, “42”, “2851”
D.
“42”, “763”, “2851”
P. 6
8.
A computer uses 16 bits to store a character. How many bytes of computer storage is needed for the string:
“joyful”?
9.
A.
6 bytes
B.
12 bytes
C.
48 bytes
D.
96 bytes
Which of the following statements about Chinese characters is / are true?
(1) Each Chinese character has a length of 8 bits.
(2) In two-byte code system, the maximum possible number of Chinese characters represented is more than
60,000.
(3) Different input methods will give different codes for the same Chinese character.
10.
A.
(1) only
B.
(2) only
C.
(1) and (2) only
D.
(2) and (3) only
Which of the following concerning BIG5 is not correct?
A.
It is a character set mainly for representing traditional Chinese characters.
B.
It is sorted first by usage frequency, second by stroke count, lastly by radicals.
C.
It cannot be used together with ASCII.
D.
One of its extensions is Hong Kong Supplementary Character Set.
2002 CS#30
11.
Why are two bytes used to represent a Chinese character?
A.
Most Chinese characters are composed of two parts.
B.
The display size of a Chinese character on screen is usually twice that of an alphanumeric
character.
12.
13.
C.
Two bytes have sufficient combinations to represent all Chinese characters.
D.
Some Chinese applications software is designed for 16-bit computers.
Which of the following statements about the BIG5 code for the Chinese character ‘三’ is correct?
A.
The BIG5 code is the same as the BIG5 code for ‘3’.
B.
The first byte of the BIG5 code is the ASCII code for ‘3’.
C.
The value of the BIG5 code is three times that for the Chinese character ‘一’.
D.
The BIG5 code is 16 bits long.
Which of the following character sets are examples of the Double Byte Character Set?
(1)
Big-5
(2)
(3)
ASCII
(4)
Unicode
A.
(1) and (2) only
B.
(3) and (4) only
C.
(1), (2) and (3) only
D.
GB
(1), (2) and (4) only
M.C. Answer:
1
2
3
4
5
6
7
8
9
10
11
12
13
C
C
D
C
D
B
C
B
B
B
C
D
D
P. 7
14
15
16
17
18
19
20
Conventional Question:
1.
Data in computer is represented in binary form. Character is one form of representation in a computer. Some
characters are represented in 2 byte code and some are represented in 1 byte code.
(a) BIG5, GB and Unicode are considered as a 2 byte code.
(i)
(3 marks)
What does a 2 byte code mean? Explain why they are to be represented in 2 byte code.
(iii) Suggest an example of one byte code.
(b) Apart from character, number is another form of representation in a computer. They may be unsigned or
signed numbers. If 2 bytes are used, with denary presentation,
(3 marks)
(i)
the maximum integer of unsigned numbers
(ii)
the maximum integer of a signed number with two’s complement representation.
(iii)
the minimum integer of a signed number with two’s complement representation.
c) With 9 bit two’s complement representation, state the answers in binary form.
(2 marks)
The greatest value it can represent
The least value it can represent
d) Under 8 bit two’s complement representation, perform 6310 – 10310 with detail calculation. (4 marks)
Perform 6310 – 10510 by two’s complement representation
=
P. 8
10
2013DSE P1#3(d)
2.
Charles: The operating system of my computer uses Unicode instead of Big-5 code and GB code.
Billy: Unicode only includes around 20,000 Chinese characters.
Amy: Not any more. As of September 2012, Unicode includes more than 110,000 characters.
d) (i) To represent a set of 20,000 characters using binary code, what is the minimum number of
bits required? Show your calculation.
(ii) Referring to Amy’s comment, do the 110,000 characters include traditional and simplified
Chinese characters only? Explain briefly.
(3 marks)
P. 9
Chapter 3 – Data Processing
Section 3: Validation and verification
1. The teaching staff ID number / student ID number of a school is in the following format:
C
d1
d2
d3
d4
The first character C will either be ‘S’ or ‘T’, S represents ‘student’ and T represents ‘teacher’. And d4 is the check
digit. The formula for the check digit is shown below:
d4 = the remainder of (d1+d2+d3) divided by 6
Which of the following statements is / are false?
(1) the check digit can detect error if ‘S’ is changed into ‘T’.
(2) the check digit can correct error if d1 is changed from ‘5’ to ‘7’.
(3) the divider of formula for the check digit should be changed into 10 to enhance reliability
A. (1) and (2) only
B.
(1) and (3) only
C. (2) and (3) only
D.
(1), (2) and (3)
2. A secondary school clerk enters the names and ages of students into a computer file. The clerk incorrectly enters
the ages of two students as shown below:
Name
Age entered
Mary Lee
1M
John Chan
98
The above wrong ages can be detected by means of
A. parity check.
B.
source error check
C. range check and type check
D.
length check and type check
3. [Repeated]
4. Which of the following fields of an invoice may use check digit?
(1)
Product code
A. (1) only
C. (1) and (2) only
D.
(2)
Price per item
B.
(2) only
(3)
Total amount in the invoice
(2) and (3) only
5. Which of the following measures is/are related to data verification?
(1) Check digit
(2) Inputting data twice
(3) Double data entry
A.
(1) only
B.
(2) only
C.
(1) and (3) only
D.
(2) and (3) only
6. What is meant by the computer proverb “Garbage In, Garbage Out” ?
A. The input is followed by the output.
B. The accuracy of output information depends on the input data.
C. Garbage is used to describe a simple computer system.
D. The processing speed of computer is very high.
P. 10
7. A student has entered his personal particulars as shown below :
The birthday month entered by the student is found to be incorrect. Which of the following types of
validation methods can be used to avoid such an error ?
A. a check digit
B.
a data type check
C. a range check
D.
a sign check
8. Which of the following is/are data verification?
(1) checking if the data is mistyped
(2) entering data twice by two different operators
(3) checking if the data is reasonable
(4) printing a hard copy for checking against the original data
A. (3) only
B. (1) and (2) only
C. (1), (2) and (4) only
D. (1), (3) and (4) only
2009 CIT 1A#1
9.
Peter uses Table 1 to produce Table 2.
Travel agent
Phone number
Travel agent
Phone number
Moon Tours
26663666
Happy Tours
38884888
Monday Travel
51115111
Monday Travel
51115111
Happy Tours
38884888
Moon Tours
26663666
Table 1
Table 2
Which of the following ways of processing information is involved in the above action?
A.
Communication
B.
Reorganization
C.
Validation
D.
Conversion
2008CIT MC#12
10.
Which of the following examples shows a way to verify input data?
A.
Make sure all required input items on an online application are filled in.
B.
User is required to type a new password twice when changing his/her password.
C.
When changing a filename, the operating system will ensure there are no special characters such as ‘*’
and ’?’ in the filename.
D.
Compare the newly input Towngas meter reading with the average reading from past records and check
whether it is reasonable.
11.
A computer operator enters a telephone number as ‘2217333’ instead of ‘22173333’. He can use
to detect the error.
A. range check
B.
check digit
C. length check
D.
type check
P. 11
12.
Which of the following statement about data verification is / are true?
(1)
Double data entry is a kind of verification method.
(2)
Verification concerns the accuracy of source data whereas validation concerns whether the data is
reasonable or not.
(3)
13.
GIGO should be avoided in view of data verification.
A. (1) only
B.
(2) only
C. (2) and (3) only
D.
(1), (2) and (3)
The check digit of a 4-digit code d1d2d3d4 is the remainder when the sum
d1 + d2 + d3 + d4
is divided by 10. Which of the following statements is/are true?
(1) The check digit of 2345 is 4.
(2) The method can detect transcription error when digit “3” in the code 2345 is entered as “6”.
(3) The method can detect transcription error when adjacent digits are interchanged.
14.
15.
A.
(1) only
B.
(2) only
C.
(1) and (2) only
D.
(2) and (3) only
Which of the following statements about parity check is correct?
A.
Parity bit is added by the data sender.
B.
Parity bit is an extra bit used to validate data input.
C.
Parity bit can always detect error in data transmission.
D.
Parity bit is added by the data receiver.
Which of the following statements about data validation is/are true?
(1) Data validation involves entering the same data twice.
(2) Data validation can be done by a program.
(3) Check digit is an example of data validation.
16.
A.
(1) only
B.
(2) only
C.
(1) and (2) only
D.
(2) and (3) only
Which of the following statements about parity check is/are correct?
(1) If data is transmitted correctly, the number of 1’s in all the data are the same
(2) Parity check is used in data transmission between hardware.
(3) The parity bit is removed from a data after successful transmission.
17.
18.
A.
(1) only
B.
(2) only
C.
(1) and (2) only
D.
(2) and (3) only
Which of the following devices may involve transcription error?
A.
barcode reader
B.
magnetic card reader
C.
fingerprint scanner
D.
keyboard
The following data are received during a data transmission that uses parity check. One of these data is invalid.
P. 12
Identify the invalid data.
19.
A.
1101 0110 0
B.
0110 1101 1
C.
1110 1110 1
D.
1001 0001 0
Suppose a student number consists of five digits as follows:
check digit

d1
d3
d2
d4
d5
where the check digit d 5 is calculated such that the sum
5 x d1 + 4 x d 2 + 3 x d 3 + 2 x d 4 + d 5 is divisible by 11.
Which of the following student numbers is valid?
20.
A.
14321
B.
24341
C.
62054
D.
20317
Mr Chan has submitted an electronic form for a job application through the Internet. In the field "Year of Birth",
he entered the current year. Which of the following validation checks can detect the error?
21.
A.
range check
B.
type check
C.
check digit
D.
control total
What type of data validation method is commonly used for entering bar code
information?
A.
double entry
B.
range check
C.
format check
D.
check digit
22.
bit pattern
extra bit
0110 0011
0
1101 1100
X
0101 1010
Y
0010 0010
Z
If the extra bit is a parity bit for checking the transmission of the bit pattern, the bits X, Y and Z should be
respectively
A.
0, 1, 0
B.
1, 0, 0
C.
0, 0, 1
D.
1, 1, 0
23.
[Repeat]
M.C. Answer:
1
2
3
4
5
6
7
8
9
10
11
P. 13
12
13
14
15
16
17
18
19
20
A
C
B
A
D
B
C
C
B
B
C
D
B
A
D
D
D
B
B
A
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
D
B
B
R
Short Questions:
1.
2.
Name 5 different checks.
(i)
F
V
Check
(ii)
(iii)
F
P
Check
(iv)
(v)
T
Check
Digit
Finish the following table according to the information provided.
Mode of parity check
Original Data
Parity Bit
Output data
Odd Parity Check
1001 011
1
1001 0111
Odd Parity Check
1000 001
Even Parity Check
1000 001
Even Parity Check
3.
Check
1010 010
1
1100 001
0
10
0
0 011
Match the following scenarios
(i)
It is a check that would be used for inputting exam marks
(ii)
It is a check that would make sure the inputted data is an email address.
(iii)
It is a check that inputted data is appropriate.
(iv)
It is a check that can ensure the inputted data is correct and accurate.
(v)
It is a check that can limit inputted data is numeric but not alphabets.
(vi)
It is a check that can make sure the data transmission is correct.
(vii)
It is a check that can ensure the inputted ID number is 10 characters.
(viii) It is a check that can ensure your Towngas account number being inputted is valid.
A).
Format Check
B).
Verification
C)
Parity Check
D)
Range Check
E)
Validation
F)
Type Check
G)
Check digit
H)
Length Check
Conventional Question:
1.
The Astronomy Club uses computer to store various data, such as information of members.
assigned a member ID.
a)
Each member is
The Astronomy Club also sells stationery.
Suggest a validation rule for detecting the errors in the following examples:
Field
Mistyped text
Member ID (original: 23411)
24311
Name of member
3mily Chan
P. 14
Validation Rule
(5 marks)
b)
Date of birth (dd/mm/yyyy)
4/23/1991
Telephone
(missing)
Price of a clear folder
$150
Any student can register to be a member of the club through a form on the web.
Suggest a suitable
verification method of each of the following user-input data:
c)
i.
Password:
ii.
Email address:
iii.
Delivery address:
When Peter browses the web site of Astronomy Club, he finds that the page is full of scrambled characters:
Suggest a possible reason and a corresponding solution for the problem.
2.
(2 marks)
(2 marks)
Ada develops a POS system for a restaurant. She designs the following screen output for waiters to
use. There are two buttons,
and
, beside each lunch set. They are used to select the
quantities of the corresponding lunch sets.
P. 15
(a)
(i) In Area P, waiters will input some numerical data. Give two examples of these data.
(ii) Ada should apply some appropriate validation checks to the input data. Describe two
examples of the validation checks .
(iii)In Area Q, waiters will receive some output data. Give two examples of these data.
(6 marks)
P. 16
Chapter 3 – Data Processing
Section 4: Database MS and SQL
2011CIT MC#4
1.
2.
Which of the following database activities produces useful information from raw data?
A.
Insert a record
B.
Update a field
C.
Execute a query
D.
Change a field name
Which of the following functions can be provided by SQL?
(1)
Delete data in a database
(2)
Searching data in a database
(3)
Update data in a database
A.
(1) only
B.
(2) only
C.
(2) and (3) only
D.
(1), (2) and (3)
3. Which of the following functions can be provided by SQL?
(1) Delete data in a database
(2) Search data in a database
(3) Update data in a database
(4) Create a table in a database
A. (1) and (2) only
B.
C. (1), (2) and (3) only
(2) only
D.
All of the above
4. In database software, SQL cannot be used to ________________.
A. create reports
B. design database tables
C. link several tables together
D. create queries
5. For a database, a SQL is executed to perform a number of operations. Which of the following statement about
performing SQL on a database is correct?
(1) A SQL may create a new table with fields of suitable data types by the command CREATE TABLE.
(2) When updating a database by a SQL, it will first create a temporary transaction file which stores updating data,
then, it will update the database and finally it will delete the temporary file after the updating processing is
successfully done. This operation is performed in order to protect data.
(3) When deleting data in a database by SQL will not require a temporary transaction file.
A. (1) only
B.
(2) only
C. (1) and (2) only
D.
(1), (2) and (3)
6.
Which of the following is/are function(s) of a DBMS?
(1) Managing database structures
(2)
Storing and organizing data in a database
(3) Verifying whether data is entered correctly
A.
(1) only
B.
(3) only
C.
(1) and (2) only
D.
(1), (2) and (3)
P. 17
2010CIT MC#8
7.
What functions should a good database management system include?
(1) video conferencing
(2) SQL
(3) Project resource management
(4) Form/report generation
A. (1) and (3) only
B. (1) and (4) only
C. (2) and (3) only
D. (2) and (4) only
8.
For a Sports Day, a file is used to store information about participating students and the events. Which of the
following CANNOT be used as the key field?
9.
A.
Hong Kong Identity Card Number
B.
student registration number
C.
class together with class number
D.
student name together with event
Which of the following pairs of information can uniquely identify a student in school?
A.
Student name and class
B.
Class number and telephone number
C.
Student name and class number
D.
Class number and class
10. Which of the following statements about key field is / are correct?
(1) A key field can uniquely identify records in a table.
(2) A key field can be used to link up tables.
(3) A key field must only be selected from one field of a table.
A. (1) only
B.
(3) only
C. (1) and (2) only
D.
(1), (2) and (3)
11.[Repeated]
12. The following shows a label of a product in a supermarket, which of the following data
will be the least likely included data?
A. the price
B. the product number
C. the country of origin
D. the manufacturer’s number
13.
Which of the following statements is not correct?
A.
The data type of each field must be considered when designing a database.
B.
The name of each field must be unique.
C.
The key field of a table can only contain one field.
D.
The data in a key field is unique to a specific record.
1996 CS#16
14.
STOCK is a master file of stock items in an inventory control application. Which of the following fields of STOCK
can be used as a key field?
A.
item reference number
B.
description
P. 18
C.
15.
quantity
D.
cost
Which of the following fields is/are suitable to be used as a key field in the database of an online auction
company?
(1)
Member number.
(2)
The email address of the members.
(3)
Member’s name.
A.
(1) only
B.
(1) and (2) only
C.
(2) and (3) only
D.
(1), (2) and (3)
16. [Repeated]
2011CIT
MC#8
17. When entering a school, students must touch their personal smart cards to the reader in an attendance system.
Which of the following item(s) must be stored in both the smart card and the attendance system?
18.
19.
20.
(1)
Student ID number
(2)
Name of student
(3)
Photo of student
(4)
Class teacher ID number
A.
(1) only
B.
(1) and (2) only
C.
(1) and (3) only
D.
(1) and (4) only
Arrange the following into a hierarchical structure of a database in descending order.
(1)
Table
(2)
Record
(3)
Character
(4)
Field
A.
(3), (4), (2), (1)
B.
(3),(2), (4), (1)
C.
(1), (4), (2),(3)
D.
(1), (2), (4), (3)
Which of the following correctly represents the hierarchical structure of a database in ascending order?
A.
field, character, record, table, database
B.
character, record, field, table, database
C.
database, table, record, field, character
D.
character, field, record, table, database
A database table STUDENT consists of the following fields:
Field name
Type
Length
Student_id
Character
10
Name
Character
38
Class
Character
2
Phone
Character
20
Address
Character
30
Suppose there are 50 records. What is the approximate size of the database table?
A.
50 bytes
B.
5 KB
C.
50 KB
D.
500 KB
P. 19
21.
Peter creates a database file with a record. Its structure is shown below:
Field name
Type
Size (bytes)
NAME
character
5
AMOUNT
integer
2
Then he amends the contents of the record as follows:
Name
Amount
Jack
10000
is amended to
Name
Amount
Jacky
80
What will be the change of the file size?
22.
A.
an increase of 1 byte
C.
a decrease of 1 byte
B.
no change
D.
a decrease of 2 bytes
A database table named ‘student’ contains the information of students’ test marks where each record has three
fields: ‘name’, ‘class’ and ‘test_mark’. Which of the following query counts the number of students with marks
lower than 50 in each class?
A.
SELECT class, Max(test_mark) FROM student GROUP BY class;
B.
SELECT COUNT(*) FROM student WHERE test_mark < 50;
C.
SELECT class, COUNT(*) FROM student WHERE test_mark < 50 and class = "3A";
D.
SELECT class, COUNT(*) FROM student WHERE test_mark < 50 GROUP BY class;
23. There is no any record is retrieved after executing the following SQL command but with no error message. Which
of the following statements have to be incorrect?
SELECT Class, AVG(mark) FROM EMPLOYEE WHERE mark > 50 OR sex=”F” GROUP BY class
A. There is no any record in EMPLOYEE
B. There is no such a field “class” in the database table.
C. There is no any student whose mark is greater than 50.
D. There is no any girl whose mark is greater than 50.
24. In the diagram below it shows an application by a DBMS, which of the following statement about the application
is correct?
P. 20
(1) It is a form application.
(2) It is being used because it can enhance the efficiency of inputting data.
(3) It is being used because it can reduce inputting error like transposition errors
A. (1) and (2) only
B.
(1) and (3) only
C. (2) and (3) only
D.
(1), (2) and (3) only
M.C. Answer:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
C
D
D
A
C
D
D
D
D
C
D
A
C
A
B
A
A
D
C
B
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
B
D
B
D
Conventional Question
1.
Peter is an IT teacher in a secondary school. He uses a database table “result” to store the first examination
marks of his students. Below shows the structure of the table:
result
Field
Data type
Description
Field length
a)
Student_ID
Text
7
The student identity number
DoB
[To be confirmed]
[To be confirmed]
Date of birth, e.g. 25-12-2015
Class
[To be confirmed]
[To be confirmed]
Class, e.g. 2A, 3B, 4C, etc
Class_number
Integer
/
Class number
Sex
Text
1
Sex of the student, ‘M’ or ‘F’
Mark
Integer
/
The mark of the student on the subject
It is advised to validate the data during data entry. Suggest one validity check for the fields ‘mark’, ‘sex’
and ‘student_ID’ respectively.
b)
(3 marks)
For the fields DoB and Class, suggest suitable data types for them.
(2 marks)
DoB:
Class:
c)
Originally, student_id is being used as the primary key for the table result. Peter considers using class +
class_number as the primary key, do you agree? Explain please.
d)
(1 mark)
Peter wants to find the average mark of each class, below shows the expected output. Write down the SQL
needed to finish this task. Note that the data is sorted according to the average marks of the classes.
(3 marks)
P. 21
Class
e)
Average_mark
2A
83.6
1B
76.3
……
……
Peter hopes to make more students get passed, so, he raises the field mark to 50 if the mark is originally
between 45 and 50. Write down the SQL so that it will produce a list of students whose marks are in
between 45 and 50.
2.
(2 marks)
Below shows all the data in detail for the table “Result”.
Student_ID
DoB*
Class
Class_number
Sex
Mark
2009001
1996/11/7
1A
12
M
71
2009002
1997/1/6
1A
6
M
63
2009003
1997/6/22
1C
5
M
28
2009004
1997/3/24
1D
7
F
47
2009005
1997/8/1
1A
13
F
59
2009006
1996/11/13
1C
9
F
88
2009007
1996/1/20
1A
8
M
39
2009008
1996/9/14
1C
22
M
45
2009009
1997/2/13
1A
7
F
63
2009010
1997/9/26
1C
14
M
81
2009011
1997/6/19
1A
6
F
49
2009012
1996/9/4
1C
7
M
75
*Note: DoB represents Date of birth.
Based on the above data, answer the following questions.
a)
(i)
How many fields are there in the table?
(2 marks)
(ii)
How many records are there in the table?
b)
Write the SQL statement that shows the student ID without duplication.
(2 marks)
c)
Write the SQL statement that shows the highest mark.
(1 mark)
d)
Write the SQL statement that shows the student id of the students who is either born on the date from
1996/11/01 to 1997/05/31 or a girl with mark over 80
P. 22
(2 marks)
e)
What is the output if the following SQL statement is executed?
SQL statement
(i)
(5 marks)
Output
SELECT sex, COUNT(*) AS number
FROM result GROUP BY sex
(ii)
SELECT MONTH(DoB) AS stu_month,
class, COUNT(*) AS number FROM
result WHERE sex = ‘M’ GROUP BY
MONTH(DoB), class ORDER BY class,
MONTH(DoB) DESC
3.
(a)
A school has a database as follows:
Field Name
Data Type
Description
Example
Student_ID
Char(8)
Unique code for a student Identification.
5034286
Name
Char(10)
Name of the student
Chan tai man
Class
Char(2)
Class of the student
1A
Class_no
Integer
Class number of the student
18
DoB
Date
Date of birth of the student
1998-DEC-09
Sex
Logical
Sex of the student, True represents “M” and
True
False represents “F”
(i)
Apart from student_ID, suggest a suitable primary key for this table.
(ii)
One of the above fields needs modification. Name the field and give a suggestion with suitable
argument.
(iii)
(1 mark)
(2 marks)
As a matter of fact, the database can be implemented in the form of a spreadsheet or a database
format. Give one advantage of each of these two approaches.
Adv. of spreadsheet:
Adv. of database:
P. 23
(2 marks)
(b)
The student_ID is in the form of 8 digits. A check digit is used to detect error in a sequence of
digits due to typing mistakes made by an operator. A validation procedure for an 8-digit sequence
is shown below:
Step 1: Add up all the digits of the 7-digit data.
Step 2: Divide the sum by a certain number x and get the remainder.
Step 3: Check whether the 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 x is 7, validate the following 8-digit sequences student_ID. Show your working briefly.(4 marks)
(1)
3
2 1
7
8 9 1
3
(2)
1
0 1
1
2 1 1
2
(ii)
Describe when the above validation procedure may fail to detect errors.
(1 mark)
(iii)
(1)
(2 marks)
If X is less than 5, would the following number valid? Explain please.
18039728
(2)
4.
Which of the following is better X = 7 or X = 5? Explain please.
Kit has friends who live in Hong Kong and mainland China. He wants to design a database to store information
about his friends. He then designs a database table named ‘Friends’ with the following structure:
Field
Data type
Field length
Description
firstName
Text
10
Given name
lastName
Text
10
Surname
homeTel
Text
16
Home telephone number
P. 24
School code of the school which his friend
schoolID
Text
3
email
Text
30
E-mail address
hkID
Text
10
Hong Kong ID Card number
is studying
Table ‘Friends’
(a)
Kit increases the field lengths of both ‘firstName’ and ‘lastName’ to 30. Give one advantage and one
disadvantage of this modification.
(2 marks)
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
(b) Explain why the data type of ‘homeTel’ is text instead of integer.
(1 mark)
_____________________________________________________________________
_____________________________________________________________________
(c) Describe one main characteristic of the key field. Explain why ‘hkID’ cannot be used as the key field of the table.
(2 marks)
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
(d)
Explain the meaning of the following SQL statement :
(2 mark)
UPDATE TABLE Friends
SET homeTel = "23445367"
WHERE firstName = "Amy" AND lastName = "Chan"
_____________________________________________________________________
_____________________________________________________________________
(e)
Suggest one validity check for the fields email and hkID respectively.
(2 marks)
_____________________________________________________________________
_____________________________________________________________________
(f)
Describe one verification method for the field schoolID.
(1 mark)
_____________________________________________________________________
_____________________________________________________________________
(g)
His friend John suggests that the field ‘class’ should be added to the table ‘Friends’. However, he strongly
disagrees. Explain why.
(1 mark)
_____________________________________________________________________
_____________________________________________________________________
P. 25
(h)
If he wants to send a birthday gift to each friend, what field should be added to the table?
(1 mark)
_____________________________________________________________________
5.
Below shows all the data in detail for the table “Info” in the database “DB”.
*Note:
DoB represents Date of birth.
Hcode represents House code, B for Blue and R for Red.
Dcode represents the district code, YL represents Yuen Long.
Mtest represents the Maths marks of the student.
Based on the above data, answer the following questions.
a)
b)
(i)
How many fields are there in the table?
(2 marks)
(ii)
How many records are there in the table?
Which of the fields would be the key field? Suggest a reason to support your choice?
(2 marks)
c)
Write down the SQL statement that it will show a list of name of students who is a boy in class 1A and
whose Maths score is more than 55.
d)
(3 marks)
Write down the SQL statement that it will shows the average Maths scores of
P. 26
boys and girls. It should look like as below:
e)
(2 marks)
What is the output if the following SQL statement is executed?
SQL statement
(i)
(3 marks)
Output
SELECT class, name FROM info
WHERE hcode = ‘G’ and dcode=’TM’
(ii)
SELECT dcode, COUNT(*) as Number
FROM info GROUP BY dcode ORDER
BY dcode
2013DSE P1B#4(a) and (b)
6.
Sarah is a librarian in a secondary school. She uses a table in a database, LOAN, to store the book
circulation records.
LOAN
Field Name
STUID
Character
Student’s identity code
TRANID
Character
Transaction number
BOOKID
Character
Identity of the book
LOANDATE
Date
Date of Loan
DUEDATE
Date
Due Date
REDATE
Date
Date of Return
FINE
Integer
Fine for late return
a)
Type
Description
(i) Suggest a primary key for LOAN.
(ii) Suggest a validation check on each of the following fields.
DUEDATE
FINE
b)
Sarah executes a SQL command on LOAN with four records, as shown below.
P. 27
SELECT STUID, COUNT(*) FROM LOAN GROUP BY STUID
What is the output?
2012DSE P1B#4(a) and (b)
7.
Sarah is a teaching assistant in a secondary school. She creates a table, STUD, to store the
examination scores of all the students in a database.
STUD
Field name
REGNO
Registration number
CLASS
Class
CNO
Class number
ENAME
English name
CNAME
Chinese name
CHI
Chinese language score
ENG
English language score
MATH
Mathematics score
a)
Description
(i) Should Sarah use CNO as the key field of STUD? Explain briefly.
(ii) Sarah decides to use Unicode for CNAME, instead of GB code or Big-5 code. Give a
reason to support her decision.
b)
Sarah executes a SQL command on STUD with four records, as shown below.
SELECT REGNO FROM STUD WHERE CLASS = ‘2A’ and ENG > 50
REGNO
CLASS CNO
ENAME
20101001
1A
20
Wong Siu Man
CNAME
王小文
20101002
1A
21
Chan Tai Man
陳大文
70
50
30
20114001
2A
18
Wong Chi Chun
黃子俊
40
50
30
20114002
2A
19
Li Lai Lai
李麗麗
70
80
90
What is the output?
P. 28
CHI
ENG
MATH
80
90
100
P. 29
Section 1:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
A
B
B
B
A
C
B
C
A
D
B
C
C
D
D
A
C
18
1. a)(i) 216 – 1 (or 65535)
1
(ii)
215
– 1 (or 32767)
1
(iii)
– 215 (or –32768)
1
b)
01111111, 10000000
1+1
c)
35 = 00100011
1
82 = 01010010, one’s complement = 10101101, two’s complement = 10101110
1
00100011 + 10101110 =11010001
1
One’s complement of 11010001 = 00101110, two’s complement = 00101111 = -4710
1
19
20
19
20
Method 2,
For 7 bit representation,
35 = 0100011
82 = 1010010, one’s complement = 0101101, two’s complement = 0101110
0100011 + 0101110 =1010001
One’s complement of 1010001 = 0101110, two’s complement = 0101111 = -4710
d)
(i)YES,
(ii) YES,
(iii) NO
1+1+1
2. a)(i) 212 – 1 (or 4095)
1
(ii)
211
– 1 (or 2047)
1
(iii)
– 211 (or –2048)
1
b)
0111111, 1000000
1+1
c)
27 = 0011011
1
60 = 0111100, one’s complement = 1000011, two’s complement = 1000100
1
0011011+1000100 = 1011111
1
One’s complement of 1011111 = 0100000, two’s complement = 0100001 = -3310
1
(i)YES,
1+1+1
d)
(ii) NO,
(iii) YES
Section 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
C
C
D
C
D
B
C
B
B
B
C
D
D
(1)
(a)
(i)
14
15
16
17
18
Two byte code means characters are represented by 16 bits.
1
It is being used because Chinese characters contains more than 10,000 different
1
characters and so, codes contain Chinese characters like BIG5, GB and Unicode
should adopt 16 bit or more representation which can provide a maximum of
65536 different characters.
(b)
(ii)
ASCII
1
(i)
65535
1
P. 30
(c)
(d)
(ii)
32767
1
(iii)
-32768
1
011111111
1
100000000
1
6310 = 001111112
1
1052 = 011010012
1
-1052 in two’s complement form = 10010111
63 – 105 = 00111111 + 10010111 = 11010110
1
Two’s complement of
1
11010110 = 00101010 = 42
So, 63 – 105 = –42
2.
Section 3:
M.C. Answer:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
A
C
B
A
D
B
C
C
B
B
C
D
B
A
D
D
D
B
B
A
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
D
B
B
1
a)
b)
c)
Check digit
1
Type check
1
Range check
1
Presence / Completeness check
1
Range check
1
(i)
Ask the user to type it twice.
1
(ii)
Send an email to the address and ask the user to reply.
1
(iii)
Display on the screen and ask the user to confirm.
1
The character encoding (character set) is not correct.
1
He should try to change the character encoding of the web browser, such as Big5 or
1
UTF-8. (“language” acceptable but not recommended)
2.
P. 31
Section 4:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
C
D
D
A
C
D
D
D
D
C
D
A
C
A
B
A
A
D
C
B
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
B
D
B
D
1.(a) mark: Range check / Type check
b)
1
Sex: Fixed value check
1
Student_ID: Check digit / length check / format check
1
result
1
ii)
Date
1
iii)
Char / String
1
c)
Yes, because it can uniquely identity any particular record in the table
1
d)
SELECCT class, AVG(mark) FROM result GROUP BY class ORDER BY 2
1+1+1
e)
UPDATE result SET mark = 50 WHERE mark BETWEEN 45 AND 50
1+1
2.(a) i)
ii)
6
1
12
1
b)
SELECT DISTINCT student_ID FROM result
1+1
c)
SELECT MAX(mark) FROM result
1
d)
SELECT student_ID FROM result WHERE dob
e)
BETWEEN #1996/11/01# AND #1997/05/31# OR (sex = ‘F’ AND mark > 80)
1+1
i)
M, 7
1
F, 5
1
ii)
3.
(a)
3
Stu_month
class
number
11
1A
2
1
1A
1
9
1C
3
6
1C
1
(i)
Class + Class_no
1
(ii)
Name. It should be modified into 20 characters or more.
1+1
(iii)
Adv. of spreadsheet: Auto-recalculation, chart plotting
1
Adv. of database: Support Query, multi-users handling, large amount of data, data
1
reliability
(b)
(i)
(1)
3 + 2 + 1 + 7 + 8 + 9 + 1 = 31
1
31  7 = 4…3
As the remainder should be 3, which is the same as the input “3”, so this code is valid.
P. 32
1
(2)
1+0+1+1+2+1+1=7
1
7  7 = 1…0
As the remainder should be 0, which is different from the input “2”, so this code is invalid.
(ii)
When the adjacent digit is interchanged, the sum of all digits are the
1
1
same, so this errors cannot be detected.
(iii)
(1) the sequence will never be valid, it is because the remainder (i.e. the check digital)
is 8 where X = 5\1`. And hence it is impossible to give a remainder which would be
1
larger than the divisor.
(2) X = 7 is better, it is because the error detection capability is higher for X = 7.
1
4. (a) Advantage: Longer names can be stored. (1)
Disadvantage: More storage space is needed. (1)
(b)
Numbers beginning with ‘0’ can be stored. / 8 digits can be represented in text form. (1)
(c)
It is unique and can be used to identify a specific record. (1)
Although each Hong Kong ID Card number is unique, not all Kit’s friends are from Hong Kong.
So this field is empty for those friends from the mainland China. (1)
(d)
to update home telephone number of his friend Amy Chan. Her new number is ‘23445367’. (2)
(e) format check, check digit (2)
(f) the user should input the schoolID twice to check whether there is any difference between the 2 IDs. (1)
(g) class should be updated each year. (1)
(h) date of birth(1)
5.
a)
(i)
(ii)
8 fields
1
17 records
1
b)
id should be set as the key field. It is suitable because it is unique.
1+1
c)
SELECT name FROM info WHERE sex=’M’ AND class = ‘1A’ and mtest > 55
1+1+1
d)
SELECT sex, round(avg(mtest),1) AS average_mark FROM info GROUP BY sex;
1+1
e)
(i)
class
name
1A
David
1A
Tommy
1
e)
(ii)
dcode
numberstudent
TM
4
TP
2
TST
4
YL
5
YMT
2
6.
P. 33
7.
P. 34