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

ZIMBABWE ARMY EDUCATION CORPS

General Certificate of Education Ordinary Level

COMPUTER SCIENCE 4021/3


PAPER 3 [Practical]

JUNE/JULY 2018 SESSION

MARKING SCHEME

Page 1 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Copyright: Zimbabwe Army Education Corps Examinations, J2018

©ZAEC J2018
Question 1 a

Output or Interface 1 mark


Imports System.Console
Module Qsn1a

Sub Main()
Dim l, w, A, P As Single
WriteLine("Enter the length the rectangle and press Enter")
l = CSng(ReadLine())
WriteLine("Enter the Width the rectangle and press Enter")
w = CSng(ReadLine())
P = (l + w) * 2
A = l * w
WriteLine("The area of the rectangle is {0} and the Perimeter is {1}", A, P)
ReadKey()
End Sub

End Module
3 marks for Code - 1 mark for capturing, 2 marks calculation and 1 mark for display

Page 2 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Public Class frmAnswer
Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click
Dim l, w, A, P As Single
l = InputBox("Enter the length the rectangle and press Enter")
w = InputBox("Enter the Width the rectangle and press Enter")

P = (l + w) * 2
A = l * w
MessageBox.Show("The area of the rectangle is " & A & " and the Perimeter is "
& P)

End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
End
End Sub
End Class

Accept any other variations as long as they produce the same results.

Page 3 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Question 1b
Output

2 marks for the output


Program Code
Imports System.Console
Module Question1b

Sub Main()
Dim num, fact, i, sum, temp, r As Integer
WriteLine("Enter any positive whole number and press Enter")
num = CInt(ReadLine())
temp = num
sum = 0
While temp > 0
fact = 1
r = temp Mod 10
For i = 1 To r
fact *= i
Next i
sum += fact
temp \= 10
End While
If num = sum Then
WriteLine("{0} is a strong number", num)
Else
WriteLine("{0} is not a strong number", num)
End If
ReadKey()
End Sub
End Module
3 marks for declarations
2 marks for initialisation
2 marks for outer loop
2 marks for digit and remaining number calculation
2 marks for factorial calculation
2 marks for decision making

Page 4 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Windows Forms

Code
Public Class frmQuestion1b

Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles


btnCompute.Click
Dim num, fact, i, sum, temp, r As Integer
num = InputBox("Enter any positive whole number and press Enter")
temp = num
sum = 0
While temp > 0
fact = 1
r = temp Mod 10
For i = 1 To r
fact *= i
Next i
sum += fact
temp \= 10
End While
If num = sum Then
MessageBox.Show(num & " is a strong number")
Else
MessageBox.Show(num & " is not a strong number")
End If
End Sub
End Class

Other variations are also considered as long as they come up with a strong number

Page 5 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Question 2.
Interface

3 marks if the combobox has the animals displayed as above. 2 marks for combobox with no
animals displayed

Code
Public Class frmQuestion2a

Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles


btnCompute.Click
cboAnimal.Items.Add(txtAnimal.Text)
txtAnimal.Clear()
txtAnimal.Focus()
End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click


End
End Sub
End Class
2 marks for the code

Page 6 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Question 2b
Output

2 marks for the two textboxes


1 mark for the label
2 marks for the buttons.
Make use of the code to see the proper renaming of the controls.
Code
Public Class Question2b

Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles


btnCompute.Click
If txtFirstNum.Text = "" Then
MessageBox.Show("Please Enter the first number", "Missing Number",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtFirstNum.Focus()
Exit Sub
End If
If txtSecondNum.Text = "" Then
MessageBox.Show("Please Enter the second number", "Missing Number",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtSecondNum.Focus()
Exit Sub
End If
If Val(txtFirstNum.Text) = Val(txtSecondNum.Text) Then
lblResult.Text = Val(txtFirstNum.Text) + Val(txtSecondNum.Text)
Else
lblResult.Text = Val(txtFirstNum.Text) * Val(txtSecondNum.Text)
End If
End Sub

Page 7 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles
btnExit.Click
End
End Sub
End Class
1 mark for the condition in decision making
1 mark for action when the condition is true
1 mark for action when the condition is false
1 mark for assigning the calculated result to the label result.
1 mark for the button exit coded.

Accept other variations which include the stated marking points above.

Question 3a.
Output

1 mark for the output

Code
Imports System.Console
Module Question3a
Sub Main()
Dim num, totmarks As Integer
Dim ave As Integer
WriteLine("Enter the total number of learners")
num = CInt(ReadLine())
totmarks = getMarks(num)
ave = calculateAverage(totmarks, num)
WriteLine("The sum of the entered marks is {0} and the average mark is
{1}", totmarks, ave)
ReadKey()
End Sub
Function getMarks(a As Integer) As Integer
Dim mark, sum As Integer
sum = 0

Page 8 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


For i As Integer = 1 To a
WriteLine("Enter the mark")
mark = CInt(ReadLine())
sum += mark
Next i
Return sum
End Function
Function calculateAverage(s As Integer, n As Integer) As Double
Dim Ave As Double
Ave = s / n
Return Ave
End Function
End Module

2 marks for each function


1 mark for the calling of the functions
Accept another version of the windows forms.

Question 3b
Output

2 marks for buttons


1 mark for textbox
2 marks for labels
Code
Public Class frmQuestion3b
Dim ages(9) As Integer
Dim old, young As Integer

Page 9 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Private Sub btnCapture_Click(sender As Object, e As EventArgs) Handles
btnCapture.Click
For i As Integer = 0 To 9
ages(i) = InputBox("Enter the age of the person at position " & i + 1)
Next
End Sub

Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles


btnDisplay.Click
old = ages(0)
young = ages(0)
For Each age As Integer In ages
If old < age Then
old = age
End If
If young > age Then
young = age
End If
txtDisplay.Text &= age & vbNewLine
Next
lblOldest.Text = "The oldest person is aged " & old
lblYoungest.Text = "The youngest person is aged " & young
End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles


btnExit.Click
End
End Sub
End Class

1 mark for global declaration


2 marks for capturing
2 marks for displaying

Accept other variations as long they will be yielding the same results.
No Console app on this question

Question 4a

1 mark for each field for the five fields


1 mark for each record for five records

Page 10 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Question 4b

2 marks for each record

Question 4c Prod_ID

1 mark for selecting the correct field


2 marks for correct input mask

Page 11 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Question 4c Price

1 mark for correct field


1 mark for correct validation rule
1 mark for validation text

Question 4d

1 mark for correct query used


1 mark correct field used
1 marks for correct criteria used

Page 12 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Edited Table

1 mark for each updated recorded for two records.

Question 4e

1 mark for correct query


1 marks for correct field
1 mark for correct criteria

Page 13 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Edited Table

2 marks for the deleted record.

Question 5 a

Heading - 3 marks
1 mark for bold
1 mark for underline
1 mark for center alignment

Text – 1 mark
Links – 6 marks – 2 marks each

Page 14 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018


Question 5b

3 marks for the picture


2 marks for correct position

Question 5c

2 marks for the page.


3 marks for any three features added. Including text

Page 15 of 15 Computer Science Marking Scheme 4021/3 ©ZAEC J2018

You might also like