Friday, August 21, 2009

70-536 MCTS .NET Practice Questions #20

 

Hey Now,

Please feel free to check out my MCTS 70-536 reference page on Chris Catto.com. It’s a page with a summary of all of my posts.
As I study for this test I thought this would be good to post on to learn the content & others would be able to view & comment on it.

This content below is from some practice questions from the internet.

Thx,

Catto

Question: 6

You are working on a debug build of an application.

You need to find the line of code that caused an exception to be thrown. Which property of the

Exception class should you use to achieve this goal?

A. Data

B. Message

C. StackTrace

D. Source

Answer: C

(of course the stackTrace)

 

Question: 7

You need to write a code segment that performs the following tasks:

* Retrieves the name of each paused service.

* Passes the name to the Add method of Collection1.

Which code segment should you use?

A. ManagementObjectSearcher^ searcher =

gcnew ManagementObjectSearcher(

“Select * from Win32_Service where State = ‘Paused’”);for each (ManagementObject^

svc in searcher->Get()) {

Collection1->Add(svc[“DisplayName”]);}

B. ManagementObjectSearcher^ searcher =

gcnew ManagementObjectSearcher(

“Select * from Win32_Service”, “State = ‘Paused’”);for each (ManagementObject^ svc in

searcher->Get()) {

Collection1->Add(svc[“DisplayName”]);}

C. ManagementObjectSearcher^ searcher =

gcnew ManagementObjectSearcher(

“Select * from Win32_Service”);for each (ManagementObject^ svc in searcher->Get()) {

if ((String^) svc["State"] == "'Paused'") {

Collection1->Add(svc[“DisplayName”]);

}}

D. ManagementObjectSearcher^ searcher =

gcnew ManagementObjectSearcher();searcher->Scope = gcnew

ManagementScope(“Win32_Service”);for each (ManagementObject^ svc in

searcher->Get()) {

if ((String^)svc["State"] == "Paused") {

Collection1->Add(svc[“DisplayName”]);

}}

Answer: A

 

Question: 8

You need to serialize an object of type List(Of Integer) in a binary format. The object is named data. Which code segment should you use?

A. Dim formatter As New BinaryFormatter()Dim ms As New

MemoryStream()formatter.Serialize(ms, data)

B. Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream() For i As

Integer = 1 To 20

formatter.Serialize(ms, data(i - 1))Next

C. Dim formatter As New BinaryFormatter()Dim buffer As New Byte(data.Count) {}Dim ms As

New MemoryStream(buffer, True)formatter.Serialize(ms, data)

D. Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream()While

ms.CanRead formatter.Serialize(ms, data)End While\

Answer: A

No comments: