Ensurepass


QUESTION 121

A BooleanSwitch instance has been created in the OrderProcessingSteps.es file to enable detailed logging during testing.

You need to ensure that the order-processing service logs all steps.

Which code segment should you add to the order-processing service’ s configuration?

A. <system.diagnostics>

<switches>

<add name="LogSteps" value="l" />

</switches>

</system.diagnostics>

B. <appSettings>

<add key="Oi:derProcessingSteps.LogSteps" />

</appSettings>

C. <system.diagnostics>

<sharedListeners>

<add naroe"LogSteps" />

</sharedListeners>

</systero.diagnostics>

D. <appSettings>

<add key="Switches.LogSteps" value="l" />

</appSettings>

Correct Answer: A


QUESTION 122

You need to ensure that the client-supplied DateTime value is stored in the correct format,

Which code segment should you use as the body of the NormalizedOrderDate function in the OrderProcessor.es file? (Each correct answer presents a complete solution. Choose two.)

A. return inputOrderDate.ToUniversalTime();

B. if (inputOrderDate.Kind != DateTimeKind.Utc) return inputOrderDate.ToUniversalTime(); ilse

return inputOrderDate;

C. if (inputOrderDate.Kind == DateTimeKind.Unspecified)

{

return inputOrderDate.ToUniversalTime

}

else

{

return inputOrderDate;

}

D. DateTime orderDateTime;

if (IDateTime.TryParse(inputOrderDate.ToString("o"), out orderDateTime)) { return orderDateTime.ToUniversalTime(); >

}

else

{

return orderDateTime.ToLocalTime()

}

E. return inputOrderDate.ToLocalTime().ToUniversalTime();

F. return DateTime.ParseExact(inputOrderDate.ToString("o") , "o", DateTimeFormatlnfo.Invariantlnfo);

Correct Answer: DF


QUESTION 123

The ProcessPayment step in the OrderProcessingSteps.es file uses a cornmand-line executable to process payments. The command-line executable accepts a credit card information string on its input stream, submits the credit card charge, and then returns "Approved" if the charge is accepted.

You need to ensure that the ProcessPayment step returns true when a charge is approved and otherwise returns false. With which code segment should you replace line OS26 in the OrderProcessingSteps.es file?

A. proc.Start();

proc.Standardlnput.WriteLine(order.CreditCardlnformation); proc.WaitForExit () ;

bool result = proc.StandardOutput.ReadToEnd().Trim().EndsWith("Approved"); proc.Close(); return result;

B. proc.Start () ; proc.WaitForlnputldle() ;

proc.StandardInput.WriteLine(order.CreditCardlnformation) ; bool result = proc.ToString().EndsWith("Approved"); proc.Close() ;

return result;

C. proc.Start Info.Arguments = order.CreditCardlnformation; proc.Start();

bool result = proc.StandardOutput.ReadToEnd().EndsWith("Approved"); proc.Close() ; return result;

D. proc.Start Info.Arguments = order.CreditCardlnformation; proc.Start(); bool result = proc.ToString() .EndsWith("Approved");

proc.Close(); return result;

Correct Answer: A


QUESTION 124

After an order is processed, the ProcessingComplete event is raised.

The ProcessingComplete event must make information available to delegates about the order and the order processor.

You need to ensure that when the ProcessingComplete event is raised, an instance of the ProcessComplete class is provided to event subscribers. Which base class should you use for the ProcessComplete class?

A. IEnumerable(Of Order)

B. CollectionBase

C. EventArgs

D. Attribute

Correct Answer: C


QUESTION 125

You need to use the performance counters to ensure that the performance metrics are updated as required.

Which code segment should you use as the body of the LogOrderFinished function in the ApplicationServices.vb file? (Each correct answer presents a complete solution. Choose two.)

A. totalCounter. Increment ()

averageCounter.IncrementBy(DateTime.Now.Ticks – order.OrderDate.Ticks) averageCounterBase.Increment()

B. totalCounter.IncrementBy(totalCounter-RawValue) averageCounter.Increment() averageCounterBase.IncrementBy(TimeSpan.TicksPerSecond)

C. totalCounter.RawValue += 1 averageCounter.Increment()

averageCounterBase.IncrementBy (order.Order Date. Ticks – DateTime.Now.Ticks)

D. totalCounter.RawValue += 1

averageCounter.IncrementBy(DateTime.Now.ToBinary() – order.OrderDate.ToBinary()) averageCounterBase.Increment()

E. totalCounter.Increment () averageCounter.Increment()

averageCounterBase.IncrementBy(DateTime.Now.Ticks)

F. totalCounter.IncrementBy(totalCounter.RawValue) averageCounter.IncrementBy(TimeSpan.TicksPerSecond) averageCounterBase.Increment()

Correct Answer: CE


QUESTION 126

You create a class library that is used by applications in three departments of your company. The library contains a Department class with the following definition.

public class Department

{ public string name;

public string manager;

}

Each application uses a custom configuration section to store department-specific values in the application configuration file as shown in the following code.

<Department>

<name>Hardware</name>

<manager>Amy</manager>

</Department>

You need to write a code segment that creates a Department object instance by using the field values retrieved from the application configuration file.

Which code segment should you use?

A. public class deptElement: ConfigurationElement {

protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey) { Department dept = new Department(); dept.name = reader.GetAttribute("name");

dept.manager = reader.GetAttribute("manager");

}

}

B. public class deptHandler : IConfigurationSectionHandler { public object Create(object parent, object configContext, System.Xml.XmlNode section)

{ Department dept = new Department(); dept.name = section.Attributes["name"].Value;

dept.manager = section.Attributes["manager"].Value; return dept;

}

}

C. public class deptElement : ConfigurationElement

{ protected override void DeserializeElement( XmlReader reader, bool

serializeCollectionKey) { Department dept = new Department();

dept.name = ConfigurationManager.AppSettings["name"];

dept.manager = ConfigurationManager.AppSettings["manager"]; return dept;

}

}

D. public class deptHandler : IConfigurationSectionHandler { public object Create(object parent, object configContext, System.Xml.XmlNode section)

{ Department dept = new Department();

dept.name = section.SelectSingleNode("name").InnerText;

dept.manager = section.SelectSingleNode("manager").InnerText; return dept;

}

}

Correct Answer: D


QUESTION 127

You are developing an application for a client residing in Hong Kong. You need to display negative currency values by using a minus sign. Which code segment should you use?

A. CultureInfo culture = new CultureInfo("zh-HK"); return numberToPrint.ToString("C", culture);

B. NumberFormatInfo culture = new CultureInfo("zh-HK").NumberFormat; culture.CurrencyNegativePattern = 1; return numberToPrint.ToString("C", culture);

C. CultureInfo culture = new CultureInfo("zh-HK"); return numberToPrint.ToString("C", culture);

D. NumberFormatInfo culture = new CultureInfo("zh-HK").NumberFormat; culture.NumberNegativePattern = 1; return numberToPrint.ToString("C", culture);

Correct Answer: B


QUESTION 128

You are testing a component that serializes the Meeting class instances so that they can be saved to the file system. The Meeting class has the following definition:

public class Meeting

{

private string title;

public int roomNumber; public string[] invitees; public Meeting()

{

}

public Meeting(string t)

{

title = t;

}

}

The component contains a procedure with the following code segment. Meeting myMeeting = new Meeting("Goals");

myMeeting.roomNumber = 1100;

string[] attendees = new string[2]

{ "John", "Mary"

};

myMeeting.invitees = attendees;

XmlSerializer xs = new XmlSerializer(typeof(Meeting)); StreamWriter writer = new StreamWriter("C:\Meeting.xml"); xs.Serialize(writer, myMeeting);

writer.Close();

You need to identify the XML block that is written to the C:Meeting.xml file as a result of running this procedure. Which XML block represents the content that will be written to the C:Meeting.xml file?

A. <?xml version="1.0" encoding="utf-8"?>

<Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance"> <roomNumber>1100</ roomNumber>

<invitees>

<string>John</string>

</invitees>

<invitees>

<string>Mary</string>

</invitees>

</Meeting>

B. <?xml version="1.0" encoding="utf-8"?>

<Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance" title="Goals">

<roomNumber>1100</roomNumber>

<invitees>

<string>John</string>

<string>Mary</string>

</invitees>

</Meeting>

C. <?xml version="1.0" encoding="utf-8"?>

<Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance"> <title>Goals</title>

<roomNumber>1100</roomNumber>

<invitee>John</invitee>

<invitee>Mary</invitee>

</Meeting>

D. <?xml version="1.0" encoding="utf-8"?>

<Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance"> <roomNumber>1100</ roomNumber>

<invitees>

<string>John</string>

<string>Mary</string>

</invitees>

</Meeting>

Correct Answer: D


QUESTION 129

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(){

CalculationValues myValues = new CalculationValues();

Thread newThread = new Thread(new ThreadStart(PerformCalculation)); newThread.Start(myValues);

}

B. private void PerformCalculation (CalculationValues values) { …

}

private void DoWork(){

CalculationValues myValues = new CalculationValues(); Application.DoEvents();

PerformCalculation(myValues);

Application.DoEvents();

}

C. private void PerformCalculation() {

}

private void DoWork(){

CalculationValues myValues = new CalculationValues();

ThreadStart delStart = new ThreadStart(PerformCalculation); Thread newThread = new Thread(delStart); if (newThread.IsAlive)

{ newThread.Start(myValues

);

}

}

D. private void PerformCalculation(object values) {

}

private void DoWork(){

CalculationValues myValues = new CalculationValues();

Thread newThread = new Thread(new ParameterizedThreadStart(PerformCalculation)); newThread.Start(myValues);

}

Correct Answer: D


QUESTION 130

You are writing a method to compress an array of bytes. The bytes to be compressed are passed to the method in a parameter named document. You need to compress the contents of the incoming parameter.

Which code segment should you use?

A. MemoryStream outStream = new MemoryStream();

GZipStream zipStream = new GZipStream(outStream, CompressionMode.Compress); zipStream.Write(document, 0, document.Length); zipStream.Close();

return outStream.ToArray();

B. MemoryStream inStream = new MemoryStream(document);

GZipStream zipStream = new GZipStream(inStream, CompressionMode.Compress); byte[] result = new byte[document.Length]; zipStream.Write(result, 0, result.Length);

return result;

C. MemoryStream stream = new MemoryStream(document);

GZipStream zipStream = new GZipStream(stream, CompressionMode.Compress); zipStream.Write(document, 0, document.Length); zipStream.Close();

return stream.ToArray();

D. MemoryStream inStream = new MemoryStream(document);

GZipStream zipStream = new GZipStream(inStream, CompressionMode.Compress); MemoryStream outStream = new MemoryStream(); int b;

while ((b = zipStream.ReadByte()) != -1)

{ outStream.WriteByte((byte)b);

}

return outStream.ToArray();

Correct Answer: A

Download Latest 70-536 Real Free Tests , help you to pass exam 100%.

Comments are closed.