Page 205 - Open Soource Technologies 304.indd
P. 205
Unit 8: Understanding Function and Procedure
11. Define the scope of Public, Private, Friend procedures.
12. Difference between a function and a subroutine, Dynaset and Snapshot, early and late
binding, image and picture controls, linked object and embedded Object,listbox and combo
box,Listindex and Tab index,modal and moduless window, Object and Class, query unload
and unload in form, declaration and instantiation of an object.
13. What is a module? Give different types of module with examples.
14. Write a program that requests three scores as input and displays the average of the two
highest scores. The input and output should be handled by Sub procedures, and the average
should be determined by a user-defined function.
15. You want to create a read-only property. How would you define the Property procedure?
16. Suppose a program contains the lines
Dim n As Double, x As String
lstOutput.Items.Add(Arc(n, x))
What types of inputs (numeric or string) and output does the function Arc have?
17. What is displayed in the text box when btnCompute is clicked?
Private Sub btnCompute_Click(...) Handles btnCompute.Click
‘How many gallons of apple cider can we make?
Dim gallonsPerBushel, apples As Double
GetData(gallonsPerBushel, apples)
DisplayNumOfGallons(gallonsPerBushel, apples)
End Sub
function Cider(ByVal g As Double, ByVal x As Double) As Double
Return g * x
End function
Sub DisplayNumOfGallons(ByVal galPerBu As Double, _
ByVal apples As Double)
txtOutput.Text = “You can make “& Cider(galPerBu, apples) _
& “ gallons of cider.”
End Sub
Sub GetData(ByRef gallonsPerBushel As Double, _
ByRef apples As Double)
‘gallonsPerBushel Number of gallons of cider one bushel
‘of apples makes
‘apples Number of bushels of apples available
gallonsPerBushel = 3
apples = 9
End Sub
LOVELY PROFESSIONAL UNIVERSITY 199