TASK 4
Question a)
Would result in a compile error for no valuables have being declared? Declaring valuables at the beginning of the program before using it would solve these error.
Question b:
x1 = Sheet1.Cells(1,1).Value
x2 = Sheet1.Cells(2,1).Value
Avg1 = (x1 + x2) / 2
Msgbox (“average is : “ & x2)
Solution
Msgbox (“average is : “ & x2)
This line would result in a compile error due incorrect use of syntax. Using string interpolation to output the variable, the collect statement would be:
MsgBox($"Variable = {variable}")
Question c:
Function AOC(r as single, Pivalue as single)a single
This line would result in a compile error due to incorrect syntax. The collect statement would be as follows.
Function AOC(r As Single, value As Single) As Single
Question D
For i = 10 to -2 Step -1
b = sqr(i)
Next i
Solution
The line “Next I” would cause a run-time-error ‘5’ caused by invalid procedure calls and arguments.
The collect procedure would be as follows:
For i as double = 10 To -2 Step -1
b = Sqr(i)
Next