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 void PerformCalculation() {...} private void DoWork(){
Calculation Values myValues = new Calculation Values();
Thread newThread = new Thread(
new ThreadStart(PerformCalculation));
new Thread.Start(myValues);}
B. private void PerformCalculation() {...} private void DoWork(){
Calculation Values myValues = new Calculation Values();
ThreadStart delStart = new
ThreadStart(PerformCalculation);
Thread newThread = new Thread(delStart);if (newThread.IsAlive)
{newThread.Start(myValues);}}
C. private void PerformCalculation (CalculationValues values) {...} private void
DoWork(){
Calculation Values myValues = new Calculation Values();
Application.DoEvents();
PerformCalculation(myValues);
Application.DoEvents();}
D. private void PerformCalculation(object values) {...} private void DoWork(){
Calculation Values myValues = new Calculation Values();
Thread newThread = new Thread(
new ParameterizedThreadStart(PerformCalculation));
newThread.Start(myValues);}
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 void PerformCalculation() {...} private void DoWork(){
Calculation Values myValues = new Calculation Values();
Thread newThread = new Thread(
new ThreadStart(PerformCalculation));
new Thread.Start(myValues);}
B. private void PerformCalculation() {...} private void DoWork(){
Calculation Values myValues = new Calculation Values();
ThreadStart delStart = new
ThreadStart(PerformCalculation);
Thread newThread = new Thread(delStart);if (newThread.IsAlive)
{newThread.Start(myValues);}}
C. private void PerformCalculation (CalculationValues values) {...} private void
DoWork(){
Calculation Values myValues = new Calculation Values();
Application.DoEvents();
PerformCalculation(myValues);
Application.DoEvents();}
D. private void PerformCalculation(object values) {...} private void DoWork(){
Calculation Values myValues = new Calculation Values();
Thread newThread = new Thread(
new ParameterizedThreadStart(PerformCalculation));
newThread.Start(myValues);}
Answer: D
No comments:
Post a Comment