You are developing an application to perform mathematical calculations. You develop a class
named CalculationValues. You write a procedure named PerformCalculation that operates on an
instance of the class. You need to ensure that the user interface of the application continues to
respond while calculations are being performed. You need to write a code segment that calls the
PerformCalculation procedure to achieve this goal.
Which code segment should you use?
A. Private Sub PerformCalculation()...End Sub Private Sub DoWork()
Dim myValues As New CalculationValues()
Dim newThread As New Thread( _
New ThreadStart(AddressOf PerformCalculation))
newThread.Start(myValues)End Sub
B. Private Sub PerformCalculation()...End Sub Private Sub DoWork()
Dim myValues As New CalculationValues()
Dim delStart As New ThreadStart( _AddressOf PerformCalculation)
Dim newThread As New Thread(delStart)If newThread.IsAlive
ThennewThread.Start(myValues)End IfEnd Sub
C. Private Sub PerformCalculation ( _ByVal values As CalculationValues)...End Sub
Private Sub DoWork()
Dim myValues As New CalculationValues()
Application.DoEvents()
PerformCalculation(myValues)
Application.DoEvents()End Sub
D. Private Sub PerformCalculation ( _ByVal values As Object)...End Sub Private Sub
DoWork()
Dim myValues As New CalculationValues()
Dim newThread As New Thread( _
New ParameterizedThreadStart( _AddressOf PerformCalculation))
newThread.Start(myValues)End Sub
Answer: D
named CalculationValues. You write a procedure named PerformCalculation that operates on an
instance of the class. You need to ensure that the user interface of the application continues to
respond while calculations are being performed. You need to write a code segment that calls the
PerformCalculation procedure to achieve this goal.
Which code segment should you use?
A. Private Sub PerformCalculation()...End Sub Private Sub DoWork()
Dim myValues As New CalculationValues()
Dim newThread As New Thread( _
New ThreadStart(AddressOf PerformCalculation))
newThread.Start(myValues)End Sub
B. Private Sub PerformCalculation()...End Sub Private Sub DoWork()
Dim myValues As New CalculationValues()
Dim delStart As New ThreadStart( _AddressOf PerformCalculation)
Dim newThread As New Thread(delStart)If newThread.IsAlive
ThennewThread.Start(myValues)End IfEnd Sub
C. Private Sub PerformCalculation ( _ByVal values As CalculationValues)...End Sub
Private Sub DoWork()
Dim myValues As New CalculationValues()
Application.DoEvents()
PerformCalculation(myValues)
Application.DoEvents()End Sub
D. Private Sub PerformCalculation ( _ByVal values As Object)...End Sub Private Sub
DoWork()
Dim myValues As New CalculationValues()
Dim newThread As New Thread( _
New ParameterizedThreadStart( _AddressOf PerformCalculation))
newThread.Start(myValues)End Sub
Answer: D
No comments:
Post a Comment