HCI Computing 2018 Promo Solution Guide

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

HCI Computing 2018 Promo Solution Guide

1. a) Give the characteristics of voice-user interface and graphical user interface. [2]

VUI: A voice-user interface makes human interaction with computers possible through a
voice/speech platform in order to initiate an automated service or process.
GUI: A visual way of interacting with a computer using items such as windows, icons, and
menus.
Instead of typing in a command we ‘click’ , ’Select’ using a pointing device.

b) What are the strengths and weaknesses of a voice-user interface in comparison to a


graphical user-interface? [4]

Strengths:
- Hands free
- Easy to learn as user do not need to manipulate devices to perform actions
Weaknesses:
- Error prone as human language is ambiguous
- Need a conducive environment to work
- Machine learning needed to make it smarter

2. The HCI IT department is looking at tracking the computer lab usage in the Tech block.
Currently, only teachers are allowed to make a booking manually via the technician. You
are to propose a relational database design for the purpose.

a. Give the table descriptions in shorthand notations. Explain the purpose of all your tables.
Highlight the necessary details needed in your design. [6]

Teacher(NRIC, Name, Job_Title, department, Subject)


//Tracks all users who are eligible to make a booking
Venue(VenueID, Rm_No, Blk, Level, capacity)
//Venue descriptions
Booking(BookingID, NRIC, VenueID, StartTime, Endtime, duration, Time_of_booking,
descriptions )
//Booking Information

b. Draw the entity-relationship model for your design. [4]

1
c. The online booking system will facilitate the booking and the booking data will be kept
in the database you have proposed. Design and draw all the booking interfaces needed in
this online system. [6]

Clarification: Teachers book the venue online directly.


Flow:
Log-in to booking system -> Entry of booking details -> Confirmation

- Log-in screen
- The booking screen should include and capture all the fields given in the tables with
suitable layout elements like drop down list, checkboxes, text fields etc for data entry
- Buttons for Cancel / submit
- Confirmation screen

d. In your opinion, which of the 8 golden rule is the most important when designing this
interfaces? Why? [3]

- State the rule with brief descriptions (eg. Consistency, reversal of action, error msgs etc)
- Justifications
Eg. Easy reversal of action(edit / cancel bookings), Informative feedback (Confirmation)

e. To allow the integrity and privacy of the booking data, users are prompt for user ID and
password. Suggest a possible improvement to the current approach and why? [2]
Possible answers:
- Two factor authentication using token or phone verification code
- Explain how it works

f. Should the booking data be kept in a client-server or peer-to-peer network? Why? [2]
Answer: Client-server
Reason: Security, centralized control of the booking system

3 a) A 30 Megabyte(MB) file is transferred over a network to a printer in 10 seconds.


Calculate the transfer rate, in kilobytes per second(KB), used to transfer this file. Show
all of your workings. [2]
(You may assume that 1MB = 1000 KB)
Transfer rate = 30MB/10S = 3 MB/s = 3 x 1000 kbps = 3000 kbps

b) Explain how DNS operates in a network? [4]


The Domain Name System is used to resolve human-readable hostnames like
www.Dyn.com into machine-readable IP addresses like 204.13.248.115.
It will query its cache to check its availability
before send request to different servers to retrieve the IP address. (ISP DNS,
Authoritative, TLD, rootname servers)

c) Switches and routers are both connecting devices,


a. What is a connecting device? [1]
- A device to facilitate the transferring of data from one host to another.

2
b. what are the differences between them? [3]
- Serve different layers of the OSI model
- Type of data transfer is different (packets vs frames)
- With different build in functionalities like Gateway, address translation etc

d) How do you make use of a parity bit to check the accuracy of the transmitted data? Give
an example to illustrate your case. [3]

Example:
- There are even and odd parity bits. Data to be transmitted: eg. 01111011
- Even parity: Add Off bit to the data : 011110110
- At the receiving end: count the number of ‘On’ bits and check that its even.

Under what circumstances will the parity bit fail to detect any errors? Give an example. [3]

Answer: If an even number of bits (including the parity bit) are transmitted incorrectly, the
parity bit will be incorrect
Example:
- If even parity is used
- Transmitted data: 011110110
- Data Received: 010010110
- Since the parity bit is ’Off’ and there are even number of ‘On’ bits. It is unable to
detect the error.

4
(a) def BinSearch(A,low,high,key):
if low <= high:
mid = (low + high)//2
if key < A[mid]:
BinSearch(A,low,mid-1,key)
elif key > A[mid]:
BinSearch(A,mid+1,high,key)
else:
print("Found!")
else:
print("Key is not found!")

3
5.
Method 1: use for loop to read file
f = open('DATA.txt','r')
g = open('NEWDATA.txt','w')
total = 0
for line in f:
data = line.split()
n = int(data[0])
for i in range(1,n+1):
total += float(data[i])
g.write(data[i]+'\n')

print("Sum is", total)


g.close()

Method 2: use while loop to read file


f = open('DATA.txt','r')
g2 = open('NEWDATA2.txt','w')
total = 0
line = f.readline()
while line != '':
data = line.split()
n = int(data[0])
for i in range(1,n+1):
total += float(data[i])
g2.write(data[i]+'\n')
line = f.readline()

print("Sum is", total)


g2.close()

4
6.
def main():
CONTACT = {}
display()
choice = int(input("Enter your choice [1-6]:"))

while choice != 6:
if choice == 1:
Add(CONTACT)
elif choice == 2:
Update(CONTACT)
elif choice == 3:
Delete(CONTACT)
elif choice == 4:
FindNum(CONTACT)
elseif choice == 5:
FindPerson(CONTACT)
else:
print(“Key in choice 1-6 only!”)
display()
choice = int(input("Enter your choice [1-6]:"))

def display():
print("1. Add new person's name and phone number")
print("2. Change a person's phone number")
print("3. Delete a person completely")
print("4. Find the phone number of a person")
print("5. Find the person with a given phone number")
print("6. Exit")

def Add(CONTACT):
name = input("Enter name of new contact:")
if name in CONTACT:
print(name,"is in the record. Try Updating.")
else:
number = input("Enter the phone number:")
CONTACT[name] = number

def Update(CONTACT):
name = input("Enter name of contact:")
if name in CONTACT:
number = input("Enter the new phone number:")
CONTACT[name] = number
else:
print(name,"is not in the record. Try Adding.")

def Delete(CONTACT):
name = input("Enter name of contact:")
if name in CONTACT:
CONTACT.pop(name)
else:
print(name,"is not in the record.")

def FindNum(CONTACT):
name = input("Enter the name of contact:")
if name in CONTACT:
print("Phone number:",CONTACT[name])
else:
print(name,"is not in the record.")

5
def FindPerson(CONTACT):
number = input("Enter the number to find:")
found = False
for key in CONTACT:
if CONTACT[key] == number:
print("This number belongs to",key)
found = True
if found == False:
print("This number is not in the record.")

7.
(a) Line 1 puts the key through a hashing algorithm and stores it in the variable index, which gives the
(i) home lcoation of the record being searched for and that this is the position where the search should
start.

(ii) Line 2 starts a loop that only terminates when the current record (at the position that index points to)
yields a value in the 1st field that corresponds to the key being searched for.

(iii) Line 3 serves to deal with a collision when two keys hash to the same address. It increments the index
by 1 in order to give the next location to be searched.
(iv)
Line 5 gets the value of the data stored in the 2nd field of the record where the key was found, storing it
as the variable value.

(b)
1. Index  Hash(Key)
2. WHILE Table[Index, 1] <> Key
3. Index  Index + 1
4. IF Index > 400
5. Index  1
6. ENDIF
7. ENDWHILE
8. Value  Table[Index, 2]

8. (i) Encapsulation: Combining together methods and attributes as a single object type.
(a) e.g. Vehicle class combines the attribute Fuel_Type and the methods Show,
Set_Fuel_Type and Get_Fuel_Type as a single entity.

(ii) Inheritance: The ability of the programming language itself to define a new object that
has all the attributes and methods of an existing object.
e.g. Car and lorry can use the attributes and methods of Vehicle

(iii) Data hiding: Only access to attributes is via class’s methods


e.g. Only access to Fuel_Type is via Set_Fuel_Type and Get_Fuel_Type

(iv) Polymorphism: The ability of different classes to respond to the same methods in different
ways.
e.g. Car responds to its show method and Lorry to its which may be different.

6
(b) A class is a template for objects that have common attributes and methods.
i.e. A class is the definition of objects of the same data type.

An object is an instance of a class (and has actual values).

e.g. Car is a class but MyCar can be defined as being of type Car.

9.
(a) Goods totalling more than $20 Y Y Y Y N N N N
Conditions

Goods totalling more than $100 Y Y N N Y Y N N


Have discount card Y N Y N Y N Y N

No discount X X X X X
Actions

5% discount X X
10% discount X

(b) Goods totalling more than $20 Y Y Y Y N


Conditions

Goods totalling more than $100 Y Y N N -


Have discount card Y N Y N -

No discount X X
Actions

5% discount X X
10% discount X

(c) def DISCOUNT (GoodsTotal, HasDiscountCard):


if GoodsTotal > 20:
if GoodsTotal > 100:
if HasDiscountCard:
return 10
else:
return 5
else:
if HasDiscountCard:
return 5
else:
return 0
else:
return 0

You might also like