PrepAway - Latest Free Exam Questions & Answers

What should you do?

You are creating a Windows Forms application by using the .NET Framework 3.5. You create a new form in your application. You add a PrintDocument control named pntDoc to the form. To support the print functionality, you write the following code segment in the application. (Line numbers are included for reference only.)

01 pntDoc.BeginPrint +=new PrintEventHandler(PrintDoc_BeginPrint);
02 …
03 bool canPrint = CheckPrintAccessControl();
04 if (!canPrint) {
05
06 }
07

You need to ensure that the following requirements are met:

*When the user has no print access, font and file stream initializations are not executed and the print operation is cancelled.
*Print operations are logged whether or not the user has print access.

What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Add the following code segment at line 05.
pntDoc.BeginPrint -= new PrintEventHandler(PrintDoc_BeginPrint);
pntDoc.BeginPrint += new PrintEventHandler((obj, args) => args.Cancel = true);
Add the following code segment at line 07.
pntDoc.BeginPrint += new PrintEventHandler((obj1, args1) => LogPrintOperation());

B.
Add the following code segment at line 05.
pntDoc.BeginPrint += new PrintEventHandler(delegate(object obj, PrintEventArgs args){});
Add the following code segment at line 07.
pntDoc.BeginPrint -= new PrintEventHandler(PrintDoc_BeginPrint);
pntDoc.BeginPrint += new PrintEventHandler((obj1, args1) => LogPrintOperation());

C.
Add the following code segment at line 05.
pntDoc.BeginPrint -= new PrintEventHandler(PrintDoc_BeginPrint);
pntDoc.BeginPrint -= new PrintEventHandler(delegate(object obj, PrintEventArgs args){});
Add the following code segment at line 07.
pntDoc.BeginPrint -= new PrintEventHandler((obj1, args1) => LogPrintOperation());

D.
Add the following code segment at line 05.
pntDoc.BeginPrint -= new PrintEventHandler((obj, args) => args.Cancel = true);
Add the following code segment at line 07.
pntDoc.BeginPrint += new PrintEventHandler(PrintDoc_BeginPrint);
pntDoc.BeginPrint -= new PrintEventHandler((obj1, args1) => LogPrintOperation());


Leave a Reply