1.
You are customizing a Windows Form to use a BackgroundWorker component named bgwExecute. bgwExecute perform a database operation by an event handler named WorkHandler. You need to ensure that
users can see the progress of the database operation by viewing a progress bar named pbProgress. You want the progress bar to appear when the database operation is 50 percent complete. Which code segment should you use?
2.
You are customizing a Windows Form to asynchronously update a database in a method named WorkHandler.
You need to ensure that the form displays a message box to the user that indicates the success of failure of the update. Which segment should you use?
3.
You are creating a Windows Forms application. You create a System.Threading.Semaphore instance in the application by using the follwing code.
Semaphore threadPool = new Semaphore(0, 3);
// ...ThreadPool.Release(4);
What does this code do?
4.
You are customizing a Windows Form to update a database asynchronously by using an instance of a BackgroundWorker component named bgwExecute. You start the component by using the following code. private void StartBackgroundProcess() {
bgwExecute.DoWork += new Do WorkEventHandler(WorkHandler); bgwExecute.DoWorkerCompleted += new Do WorkerCompletedEventHandler(CompletedHandler); bgwExecute.ProgressChanged += new ProgressChangedEventHandler(ProgressHandler);
bgwExecute.RunWorkerAsync();
}
If the UpdateDB method that is called by the BackgroundWorker component returns the value False, you need to display a message box to the user that indicates that the update failed. Which code segment should you use?
5.
You are busy using a BackgroundWorker component, set to its default value, to execute an asynchronous operation.
What should you do to receive notification when the operation completes?
6.
You are busy using a BackgroundWorker component to call a method named DownloadJob in a background thread.
Which code segment is used to display a message box to alert the users when the background thread is complete?
7.
You are busy using a BackgroundWorker component to execute an asynchronous operation. The job of the background thread is to call the ReportProgress method to update the foreground thread. You have handled
the ProgressChanged event and set the Value property of a ProgressBar. The problem is that the ProgressBar display by no means gets updated. During the investigation you find out t6hatvthe event handler that works with
the ProgressChanged event never gets called. What should you do to make sure that the event handler gets called?
8.
You were asked to use the BackgroundWorker component to do an asynchronous task. What should you do to define the signature of the method that will contain the code to perform the asynchronous task?
9.
ThreadStart threadStart = delegate
{
}
ParameterizedThreadStart parameterizedThreadStart = delegate[object args]
{
}
int threadPoolThreadCount = 0
Thread thread1 = new Thread[threadStart];
Thread thread2 = new Thread[parameterizedThreadStart]; Thread thread3 = new Thread[threadStart];
thread1.Start[];
thread2.Start[null];
thread3,Start[];
if [thread1.IsThreadPoolThread]
{
threadPoolThreadCount++;
}
if [thread2.IsThreadPoolThread]
{
threadPoolThreadCount++;
}
if [thread3.IsThreadPoolThread]
{
threadPoolThreadCount++;
}
What value of the threadPoolThreadCount should you identify after the code is executed?
10.
You are busy developing a Microsoft Windows Form application. This Windows Forms application will allow electrical engineers to visually design circuit boards. The users in the Development department connect to
Certkiller -WS005 and download their respective designed circuit board for the hardware they developed.
Which of the following code segments should you use to allow users to download all designed circuit boards in a background thread with Common Language Runtime to manage the thread?