PrepAway - Latest Free Exam Questions & Answers

Which two code segments should you use? (Each correct answer presents part of the solution

You are creating an XML Web service named BankCustomer that provides bank customer information. You write code to keep track of error messages, warning messages, and informational messages while the service is running. You use the Trace class to write the messages to a log file.

On test computers, you want to see error messages and warning messages. On deployment computers, you want to see error messages, but not warning messages.

Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)

PrepAway - Latest Free Exam Questions & Answers

A.
private static TraceSwitch mySwitch;
static BankCustomer {
mySwitch = new TraceSwitch(“tswitch”,
“a trace switch”);
}

B.
public static TraceLevel level;
static BankCustomer {
level = TraceLevel.Error;
}

C.
Trace.WriteLineIf(mySwitch.TraceError,
“An error occurred.”);
Trace.WriteLineIf(mySwitch.TraceWarning,
“Warning message”);

D.
Trace.WriteLineIf(level == TraceLevel.Error ,
“The operation succeeded.”);
Trace.WriteLineIf(level == TraceLevel.Warning ,
“Warning message”);

E.
Trace.WriteLineIf(mySwitch != null,
“An error occurred.”);
Trace.WriteLineIf(mySwitch != null,
“Warning message”);

F.
Trace.WriteIf(level != TraceLevel.Off,
“An error occurred.”);
Trace.WriteIf(level != TraceLevel.Off,
“Warning message”);


Leave a Reply