Professional Documents
Culture Documents
Sub Question1VBA()
Const numrows = 4
For i = 1 To numrows
For j = 1 To (2 * i - 1)
Range("A1").Offset(i, numrows + 1 - i + j).Value = "*"
Next
Next
End Sub
a) Reproduce the following grid in your answer book and fill in the output of the
above subroutine:
A B C D E F G H I J
1
2
3
4
5
6
7
8
9
10
[8]
b) What is the difference between a variable of type variant and a variable of type
string ?
[2]
Question 7: (8 marks, 13 minutes)
Dim x As Double
Else
If thenumber <= 0 Then
x=0
End If
DoCalc = x
End Function
a) What is the difference between a Boolean and a Double variable type? [2]
b) What does the function DoCalc return if thenumber = 0.5? [4]
c) What does the function DoCalc return if thenumber = 0? [2]