BLSS 2019 P1 Solution
BLSS 2019 P1 Solution
PRELIMNARY EXAMINATION
2019
Name ANSWERS [ ]
CCA
Subject : COMPUTING
Paper No : 1
Subject Code : 7155/01
Level : SECONDARY FOUR EXPRESS
Date/Day : XX XXX 2019 / XXXDAY
Time : XXXX - XXXX
Duration : 2 HOURS
Before you start your exam, check that you have received the correct paper and the number
of printed pages are correct.
Write your name, index number, and CCA in the spaces at the top of this page.
Write in dark blue or black pen.
You may use an HB pencil for any diagrams or graphs or rough working.
Do not use staples, paper clips, glue or correction fluid.
The number of marks is given in brackets [ ] at the end of each question or part question.
You should show all your working.
The total number of marks for this paper is 80.
2
(i) Convert the denary number 168 into 8-bit binary. Show your working.
………………………………………………………………………………………………….[1
]
1010 1000
(ii) Convert the positive whole binary number 11010011 into a denary number. Show your
working.
………………………………………………………………………………………………….[1
]
211
(iii) Convert the hexadecimal number AC into its binary representation. Show your working.
………………………………………………………………………………………………….[1
]
1010 1100
(b) Hexadecimal numbers are commonly used in file compression techniques and in Media
Access Control (MAC) addresses.
(i) Calculate the largest numerical value that can be stored by the following numbers. Show
your working.
(1111) : 15
………………………………………………………………………………………………….[1
]
(FFFF) : 65535
………………………………………………………………………………………………….[1
]
BLS/EYE/2019/4E/COMP/7155/01
3
(ii) State and describe one other use of the hexadecimal number system.
……………………………………………………………………………………………………
.
………………………………………………………………………………………………….[2
]
2 A computer network is a system of two or more computers that are connected together by a
transmission medium for the exchange of data.
(a) The diagram below shows how a home network is connected to the Metropolitan Area
Network (MAN).
(i) Complete the diagram by filling in the appropriate networking devices for the three
parts labelled i., ii., and iii.
Networking devices:
i.
iii.
iii.
Mobile devices
i. …………………………………………………………………………………………………
ii. …………………………………………………………………………………………………
iii.
………………………………………………………………………………………………[2]
BLS/EYE/2019/4E/COMP/7155/01
4
Router
……………………………………………………………………………………………………
.
…………………………………………………………………………………………………[2]
Connects different networks, typically between internet and intranet. Determines which
terminal to send information to through ip addresses. Information only meant for
intended recipients.
……………………………………………………………………………………………………
.
…………………………………………………………………………………………………[2]
(b) (i) Compare the difference in purpose and functionality(how it works) between a client-
server network and a peer-to-peer network. You may use an example to aid your
answer.
……………………………………………………………………………………………………
.
……………………………………………………………………………………………………
.
………………………………………………………………………………………………….[3
]
(ii) With reference to the transfer of information to terminals on a network, explain one
difference between a bus and a star network.
BLS/EYE/2019/4E/COMP/7155/01
5
……………………………………………………………………………………………………
.
………………………………………………………………………………………………….[2
]
information on a bus network is sent on the bus and is received by all terminals
connected to the network. In a star network, information is only sent to the intended
recipient(s).
(iii) Explain what are parity bits and benefits of using parity bits in data communication.
Include the working principle of either odd or even parity bits.
……………………………………………………………………………………………………
.
………………………………………………………………………………………………….[4
]
Data that has been transmitted can be checked to determine if an error has been
incurred during the course of transmission.
Parity bit: a bit in the data packet is used to signify if there were supposed to be an odd
or even number of 1s in the packet. This would have been pre-agreed upon.
Even parity: it is set to 0 if the number of 1-bits in the packet is supposed to be an even
number. If there is an odd number of 1-bits, the parity bit will be set to ‘1’ so that there
will be an even number of 1-bits in the packet. The logic is similar for odd-parity.
1 x = 0
2 y = 0
3 while True:
4 num = input("Key in an integer: ")
5 out = 0
6 for i in range (len(num)):
7 out += int(num[i])*i
8 if out % 5 == 0:
9 x += 1
10 else:
11 y += 1
12 print("X: {}, Y: {}".format(x,y))
13 if (input("Try another number? (Y/N)").upper() != 'Y'):
14 break
BLS/EYE/2019/4E/COMP/7155/01
6
x y out
0 0 0
15
1 0 41
1 34
2 29
[5]
(ii) State the purpose of the algorithm. Assume only valid inputs are keyed in.
……………………………………………………………………………………………………
.
………………………………………………………………………………………………….[2
]
To find out the sum of digits in an input and to count the number of sums that are divisible
by 5.
(b) (i) Explain a benefit of including input validation checks in a computer program.
……………………………………………………………………………………………………
.
……………………………………………………………………………………………………
.
…………………………………………………………………………………………………[1]
To ensure that the input is valid so that the program can function as intended.
(ii) Write a validation check for the user input in the program above using pseudo code.
……………………………………………………………………………………………………
.
……………………………………………………………………………………………………
.
……………………………………………………………………………………………………
.
…………………………………………………………………………………………………[3]
BLS/EYE/2019/4E/COMP/7155/01
7
if digit.isdigit() == False:
check = False
4 State the function and describe one difference for each of the following
Function: …..…………………………………………………………………………………….
……………………………………………………………………………………………………
.
Difference:
……………………………………………………………………………………….
………………………………………………………………………………………………….[3
]
Buses are used to transfer information between different parts of a computer. [1]
Data buses are bi-directional and they allow for information transfer between the
processor and memory/storage.[1]
Address buses are uni-directional and only allow information transfer from the processor
to memory. [1]
Function: …..…………………………………………………………………………………….
……………………………………………………………………………………………………
.
Difference:
……………………………………………………………………………………….
………………………………………………………………………………………………….[3
]
Memory and storage are used to store data that is used by the processor. [1]
Memory are generally smaller in capacity compared to storage, are much faster, more
expensive, and are located closer to the processor. [1]
BLS/EYE/2019/4E/COMP/7155/01
8
External storage are larger in capacity, relatively slower, cheaper and are usually further
away from the processor. [1]
(b) Complete the truth tables for the gates shown below:
0 0 1 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0
[2]
5 (a) Draw the logic circuit to represent the following Boolean statement. Do not simplify the
statement.
BLS/EYE/2019/4E/COMP/7155/01
9
A
-
B X
- -
C
-
[4]
A B C Working Space X
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
[3]
6 A receptionist at a hotel wrote a program to find out how many of his guests have first or last names
that have at least 5 characters. The program also outputs the first and last names that have at least
5 characters. There are some errors in his program will give him the correct statistics.
BLS/EYE/2019/4E/COMP/7155/01
10
You may assume that all the names in the list namelst are valid and are made up of only two
words. The first word in each name is the first name and the second word is the last name.
BLS/EYE/2019/4E/COMP/7155/01
11
Error 1 …………………………………………………………………………………………………..
Correction 1...…………………………………………………………………………………………..
Error 2 …………………………………………………………………………………………………..
Correction 2...…………………………………………………………………………………………..
Error 3 …………………………………………………………………………………………………..
Correction 3...…………………………………………………………………………………………..
Error 4 …………………………………………………………………………………………………..
Correction 4...…………………………………………………………………………………………..
[8]
(b) Suggest why a list datatype is used to store the names instead of a string.
………………………………………………………………………………………………………...[1
]
Lists allows the storage of items of different datatypes and can be called out individually using
its index. Strings do not have this flexibility.
.…………..………………………………………………………………………………………….......
.…………..…………………………………………………………………………………………...[2]
Unauthorised copying of work from other people and passing it off as their own.
Accept any valid point on how plagiarism negatively impacts the original author and society.
.……………………………………………………………………………………………….......
.………………………………………………………………………………………………...[2]
Phishing baits the user to enter their information into a fake portal whereas pharming
involves the interception of data while it is on route to its original destination.
(ii) Describe how a researcher can prevent him/herself from falling prey to spyware.
.……………………………………………………………………………………………….......
BLS/EYE/2019/4E/COMP/7155/01
12
.………………………………………………………………………………………………...[2]
(c) Explain Two Factor Authentications (2FA) in the context of account security.
………………………………………………………………………………………………………......
.
………………………………………………………………………………………………………......
.
………………………………………………………………………………………………………...[2
]
Use: Accounts are protected via two sets of passwords. The second is usually generated as
a OTP or using a pre-assigned unique key generator.
(d) Explain a benefit and limitation of One Time Passwords (OTP) in 2FAs.
Benefit: .…………………………………………………………………………………………….......
………………………………………………………………………………………………………......
.
Limitation: ………………………………………………………………………………………….......
………………………………………………………………………………………………………...[2
]
Benefit: Generates a unique one-time password each time the user tries to login to his/her
account. Difficult for a hacker to obtain the OTP as it is randomly generated.
Limitation: The password needs to be sent to the user each time. User must be reachable
via a network (typically mobile phone network).
BLS/EYE/2019/4E/COMP/7155/01
13
8 John wishes to buy a car that is currently worth SGD 120,000. He is able to pay SGD 50,000 upfront
and takes a loan from the bank on the remaining amount.
He has to repay the loan over a period of 5 years and the bank charges an interest of 2.68% per
annum. At the end of 5 years, he would have paid the bank SGD 79,896.42.
The table lists several financial functions that are available in a spreadsheet.
Payment =pmt(rate,nper,pv,[fv],[type])
Rate =rate(nper,pmt,pv,[fv],[type],[guess])
(a) Write down the formula that will allow John to verify the amount that he has to repay the bank
at the end of the loan period. Include the necessary arguments.
……………..………………………………………………………………………………………….[1
]
=fv(2.68%,5,0,70000)
(b) Loan repayments are made only a monthly basis. Calculate the amount that John would have
to pay each month.
………..………………………………………………………………………………………………….
………………..……………………………………………………………………………………….[1
]
The amount paid during each repayment that contributes to the interest from the loan
amount.
BLS/EYE/2019/4E/COMP/7155/01
14
9 You are now an apprentice data-scientist and have been tasked to work on the intercepted
transmission string again.
Having recently attended an encryption class, you would like to test the following magic algorithm
on the string in an attempt to make sense of the transmission.
● Letters in the upper case are shifted +2 relative to their ASCII values
● Letters in the lower case are shifted -2 to their relative ASCII values
● Digits are replaced with the result of the following formula: (x + 6) % 10, where x is each
individual digit
● Spaces are replaced with an ampersand ‘&’
>> print(transmission_str)
Write an algorithm, using either pseudo-code or a flowchart to process the message using the
magic algorithm. The program must process every single character, and output the new string when
it ends.
[10]
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
BLS/EYE/2019/4E/COMP/7155/01
15
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
BLS/EYE/2019/4E/COMP/7155/01
16
……….…………………………………………………………………………………………………………
……….…………………………………………………………………………………………………………
1 transmission_str='PPj14jWLFr5iq90nsb6ezSca1 kOz
xP4A6MK6hTeHPM27gpol1 fwZyuSxB0SIBeA5wfG
Lceoex533Py9dUOIr6jTQY6687Luz9gavI1DdgH96eAn9yNbnMG1o7SYgkqFew4FP9
VpQPLI87OnkFNBMoPIdh9fh3ZB 9wwiVqzRR88bhuPtdhEYLeg5hxE
v7eCQfVrKNEi DsmdF0Gxv JUs7CX0ELbSwSbAE THAwVnpT2
knIOpV3j3gtkATHNu4mI VPpdNOTbHO5h5atCJWfTICmQ
vxE9nMd3LZDDh3vv7SiaBV174zQ136d0R29dUHGyx9KKLqcqyMJz2xS5Y9KgOOyfuE
wXx4ZUly vw EjOpr'
2 new_str='' #1m new string
3 for char in transmission_str: #1m valid loop to check all
characters
4 if char.islower(): #1m valid test condition
a. new_str += chr(ord(char)+2) #1m valid modification, #1m
correct datatype used
5 elif char.isupper(): #1m valid test condition
a. new_str += chr(ord(char)-4) #1m valid modification
6 elif char.isdigit(): #1m valid test condition
a. new_str += str((int(char)+6)%10) #1m valid modificatoin
7 elif char.isspace(): #1m valid test condition
a. new_str += '&' #1m valid modification
8 print(new_str) #valid output
9 #total possible marks: 12m
BLS/EYE/2019/4E/COMP/7155/01