0% found this document useful (0 votes)
21 views5 pages

BVSS 2020 P2 Solution

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

BVSS 2020 P2 Solution

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Task 1 – 10 marks

1 =HLOOKUP(B3, $B$14:$G$15, 2, FALSE)*C3


=HLOOKUP(B4, $B$14:$G$15, 2, FALSE)*C4
=HLOOKUP(B5, $B$14:$G$15, 2, FALSE)*C5
=HLOOKUP(B6, $B$14:$G$15, 2, FALSE)*C6
=HLOOKUP(B7, $B$14:$G$15, 2, FALSE)*C7
=HLOOKUP(B8, $B$14:$G$15, 2, FALSE)*C8

2 =SUM(D3:D8)

3 =IF(D3>=500, "Yes", "No")


=IF(D4>=500, "Yes", "No")
=IF(D5>=500, "Yes", "No")
=IF(D6>=500, "Yes", "No")
=IF(D7>=500, "Yes", "No")
=IF(D8>=500, "Yes", "No")

4 =COUNTIF(E3:E8, "Yes")

OR

=COUNTIF(D3:D8, ">500")

5 =20%*D10*12

6 =-FV(1/12*3.88%, 3*12, 0, 30000)

7 =IF(B17*3 >=B19, "able", "unable")

OR

=IF(B19>B17*3, "unable", "able")

1
Task 2

Q8(a), (b), (c) – 7 marks

num_low = 0
num_med = 0
num_high = 0

number = int(input('Enter a positive integer: '))

while number != 0:
valid = False
while valid == False:
if number < 0 or number > 100:
print('Numbers must be between 1 to 100 inclusive')
number = int(input('Enter a positive integer: '))
else:
valid = True

if number > 0 and number <= 30:


print(number, '- Low')
num_low = num_low + 1
elif number > 30 and number <= 70:
print(number, '- Medium')
num_med = num_med + 1
elif number > 70 and number <= 100:
print(number, '- High')
num_high = num_high + 1

number = int(input('Enter a positive integer: '))

print("There are", num_low, "number(s) in Low category")


print("There are", num_med, "number(s) in Medium category")
print("There are", num_high, "number(s) in High category")

2
Task 2

Q9 – 3 marks

num_low = 0
num_med = 0
num_high = 0

upper_limit = int(input("Enter a upper limit: "))

number = int(input('Enter a positive integer: '))

while number != 0:
valid = False
while valid == False:
if number < 0 or number > upper_limit:
print('Numbers must be between 1 to', upper_limit, 'inclusive')
number = int(input('Enter a positive integer: '))
else:
valid = True

if number > 0 and number <= 30:


print(number, '- Low')
num_low = num_low + 1
elif number > 30 and number <= 70:
print(number, '- Medium')
num_med = num_med + 1
elif number > 70 and number <= upper_limit:
print(number, '- High')
num_high = num_high + 1

number = int(input('Enter a positive integer: '))

print("There are", num_low, "number(s) in Low category")


print("There are", num_med, "number(s) in Medium category")
print("There are", num_high, "number(s) in High category")

3
Task 3 – 10 marks

month_abbr = ['Jan','Feb','Mar','Apr','May','Jun',
'Jul','Aug','Sep','Oct','Nov','Dec']

day = int(input("Enter the day: "))

# validate day #
while day < 1 or day > 31:
day = int(input("Invalid date. Re-enter the day: "))

month = int(input("Enter the month: "))

#validate month
while month < 1 or month > 12:
month = int(input("Invalid month. Re-enter the month: "))

year = int(input("Enter the year: "))

# validate year
while year < 1900 or year > 2200:
year = int(input("Invalid year. Re-enter the year: "))

if day > 28 and month == 2:


print('Invalid date!')
elif month in [4, 6, 9, 11] and day > 30:
print('Invalid date!')
else:
if day < 10:
day = '0' + str(day)

answer = str(day)+’ ‘+month_abbr[month-1]+’ ‘+str(year)

print(answer)

4
Task 4
Q11 – 11 marks (max)
● 1m - input code
● 1m - convert to upper case
● 1m - validate length
● 1m - validate colour code
● 1m - appropriate error messages
● 1m - input guess
● 1m - initialize number of guess
● 1m - loop for guess
● 1m - update number of guesses
● 1m - compare guess with code
● 1m - able to exit game when code broken
● 1m - correct output when code broken / incorrect guess
● 1m - correct output when 4 chances up

Q12 – 4 marks

Test123

Test4

You might also like