Professional Documents
Culture Documents
HCI Promo 2019 Solution Guide
HCI Promo 2019 Solution Guide
Question 1
(a) IP address is the logical address of a device in the network
MAC address is the physical address of a device.
(b) IPv4 uses decimal numbers but IPv6 uses hexadecimal numbers.
OR IPv4 is 32 bit and IPv6 is 128 bit
Question 2
Need of TCP: establishes connection before data is transmitted.
3-Way Handshake: User A send a SYN request to User B, User B sends back a SYN/ACK
message to acknowledge, User A sends another ACK message to establish the connection
Advantage of TCP: Reliable connection; ensure the order of the data; In case of data loss,
TCP can resend the data
Question 3
(a) high security level within the campus; faster communication and collaboration for
students and staff; reduce the cost of connecting all devices to the Internet
(b) monitors and controls all incoming and outgoing network traffic based on a set of
security rules, detect a malicious document and block it from entering the network.
Limitation: cannot protect against internal attack; the setting of firewall may block
some legitimate programs
(c) Encryption ensures only authorised person can access the document.
Digital signature ensures the document was created by the known sender
OR digital signature ensures that the document was not altered in transit.
Question 4
(a) The file contains repeated information. For example: student name, phone number, title
are repeated and stored in multiple records.
(b)
Student StudentLoan Book
(c)
Book (BookID, BookTitle)
Student (StudentID, StudentName, PhoneNumber)
StudentLoan (LoanID, StudentID, BookID, DateBorrowed, DateDue, DateReturned)
OR StudentLoan(StudentID, Book ID, DateBorrowed, DateDue, DateReturned)
(d)
(i) SELECT StudentName, PhoneNumber FROM Student
(e) any two from below + student data related to the question (e.g. phone number)
1. Consent Obligation - Only collect, use or disclose personal data when an individual has
given his/her consent.
2.Purpose Limitation Obligation - An organisation may collect, use or disclose personal data
about an individual for the purposes that a reasonable person would consider appropriate in
the circumstances and for which the individual has given consent.
3.Notification Obligation - Notify individuals of the purposes for which your organisation is
intending to collect, use or disclose their personal data on or before such collection, use or
disclosure of personal data.
4. Access and Correction Obligation - Upon request, the personal data of an individual and
information about the ways in which his or her personal data may have been used or disclosed
in the past year should be provided. Organisations are also required to correct any error or
omission in an individual’s personal data upon his or her request.
5. Accuracy Obligation - Make reasonable effort to ensure that personal data collected by or
on behalf of your organisation is accurate and complete, if it is likely to be used to make a
decision that affects the individual, or if it is likely to be disclosed to another organisation.
6. Protection Obligation - Make security arrangements to protect the personal data that your
organisation possesses or controls to prevent unauthorised access, collection, use, disclosure
or similar risks.
7. Retention Limitation Obligation - Cease retention of personal data or remove the means by
which the personal data can be associated with particular individuals when it is no longer
necessary for any business or legal purpose.
8. Transfer Limitation Obligation -Transfer personal data to another country only according
to the requirements prescribed under the regulations, to ensure that the standard of protection
provided to the personal data so transferred will be comparable to the protection under the
PDPA.
9. Accountability Obligation -Make information about your data protection policies, practices
and complaints process available on request.
(f)
Backup Archive
Enables rapid recovery of live, changing data Stores unchanging data no longer in use but
must be retained
Multiple copies of data One copy
Restore speed: crucial Retrieval speed: not crucial
Short Term Retention Long Term Retention
Retained for as long as data is in active use Retained for required period or indefinitely
Duplicate copies are periodically overwritten Data cannot be altered or deleted
(g)
Version Control
1.Ease collaboration across distributed teams -a version control system makes it much easier
to share code changes and coordinate the work of the various team members who are
responsible for the database. The ability to rapidly share and manage changes makes it
particularly important for teams based in different locations, and evidence shows that teams
are increasingly distributed.
2.Gain better visibility of the development pipeline -a version control system provides an
overview of what development work is going on, its progress, who’s doing it, and why. It also
maintains detailed change histories and can be associated with issue tracking systems.
3.Ability to roll back or retrieve previous versions- it provides an efficient mechanism for
backing up the code. Because the history it provides is incremental, version control lets
developers explore different solutions and roll back safely in the case of errors.
4. More readily demonstrate compliance and auditing -The change tracking provided by
version control is the first step to getting ready for compliance, and an essential step in
maintaining a robust audit trail and managing risk. Compliance auditors will require an
organization to account for all changes and detail all those with access to it.
Naming Convention
1. Readability is important. Readability helps in figuring out what the code does in less time.
2. A common naming convention that everyone agrees to follow will result in developers,
reviewers and project managers communicate effectively with respect to what the code does.
3. Naming conventions result in improvements of communication, code integration,
consistency and clarity and lead to predictability and discoverability (easier to find files)
Question 5
1 Assume array index starts at 1
2
3 xptr = 1
4 yptr = 1
5 zptr = 1
17 If xptr <= M
18 For i = xptr to M
19 Z[zptr] = X[i]
zptr = zptr + 1
20 EndFor
21 EndIf
22
23 If yptr <= N
24 For i = yptr to N
25 Z[zptr] = Y[i]
zptr = zptr + 1
26 EndFor
27 EndIf
Question 6
Method 1
Assume string index starts at 0
1 Output(“Key in a word:”)
2 Input word
3
4 found = False
5 i=0
13 If found = True
14 output(“Yes”)
15 Else
16 output(“No”)
17 EndIf
Method 2
1 Assume string index starts at 0
2 Output(“Key in a word:”)
3 Input word
4 nooftime = 1
5 current = 0
6 previous = 0
7
8 n = 0
9 hasThreeChars = False
24 If hasThreeChars = True
25 Output(“Yes”)
26 Else
27 Output(“No”)
28 EndIf
Question 7
(i)
000 996258
…
996 996123
997 996514
998 998330
999 996001
(ii)
read the ID code and extract the first three digit as the block number to search for
1. if the block is empty, no record exists with the ID code
2. if the block contains the ID code, the record is found
3. if the block contains another ID code other than the one we are searching, begin a
‘circular’ linear search from this block onwards until
a. the ID code we are searching is found OR
b. we reach an empty block, indicating no record exists with the ID code OR
c. we reach the starting block of the ‘circular’ linear search, also indicating no record
Question 8
(a) MYS, AUS, CAN, SGP, JPN.
MYS
Insert AUS: AUS MYS
Insert CAN: AUS CAN MYS
Insert SGP: AUS CAN MYS SGP
Insert JPN: AUS CAN JPN MYS SGP
ENDFUNCTION
""" Verifies that each integer in the magic grid is unique """
FUNCTION check_numbers (grid, order):
IF number_list = []
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION
""" Checks each row in the grid to make sure it is valid """
FUNCTION check_rows (grid, magic_sum, order)
row_sum_valid TRUE
row 1
RETURN row_sum_valid
ENDFUNCTION
""" Checks each col in the grid to make sure it is valid """
FUNCTION check_cols (grid, magic_sum, order)
col_sum_valid TRUE
col 1
RETURN col_sum_valid
ENDFUNCTION
""" Checks the two diagonals """
FUNCTION check_diagonals (grid, magic_sum, order)
ENDFUNCTION
BEGIN_MAIN()
END_MAIN
Question 10
(a)
iterative solution is a loop which converges to a solution
recursive solution is a procedure which keeps calling itself until a solution is found
iterative solution: successive values of its local variables are overwritten
recursive solution: successive values of its local variables are all preserved
IF length of aString = 1
RETURN
ELSE
SHRINK(BUTFIRST(aString), n+1)
ENDIF
FOR i = 1 to n
PRINT (' ', end ='')
ENDFOR
PRINT (aString)
ENDPROCEDURE
(ii) To indicate the number of spaces to print before the string for right justification