Sunday, 2 September 2012

Here's Practice Test/Questions for the MCTS Self-Paced Training Kit (Exam 70-536): Microsoft .NET Framework - Application Development, 1st Edition.

  1.What is the preferred way for a service to interact with a user?

A. By writing an event to the event log
B. By opening a dialog box
C. By writing a message to a text file
D. By opening a Web browser

Microsoft Press :  The correct answer is A. Services do not have a user interface. Therefore, they cannot directly interact with the user by opening a dialog box or Web browser. Instead, you should write events to the event log. Although you could write messages to a text file, the event log is easier to manage, especially in enterprise environments.

2. You are writing an application that connects to a network resource using SslStream.

Which of the following types of exceptions should you catch so that you can retry authentication with a different set of credentials if authentication fails?

A. AuthenticationException
B. FatalAuthenticationException
C. InvalidCredentialException
D. Exception
Microsoft Press :   The correct answer is A. The NegotiateStream and SslStream classes throw an AuthenticationException when the client or server cannot be authenticated. When this exception is thrown, you can retry the authentication with different credentials.

If a FatalAuthenticationException is thrown, you cannot retry authentication.

If an InvalidCredentialException is thrown, the underlying stream is not in a valid state and you cannot retry the authentication using the NegotiateStream or SslStream instance.

While catching an Exception would catch any authentication exception, it does not allow you to distinguish between authentication errors that allow retrying different credentials.


3. Which of the following elements is NOT required if you want a custom class to raise an event?

A. A class that raises the event
B. A class that holds event data, derived from System.EventArgs
C. A delegate for the event
D. A method to add an event handler

Microsoft Press :    The correct answer is D. You do not need a method to add an event handler; that functionality is provided by the .NET Framework.

If you want to raise an event in a custom class, you need a class that holds the event data (either EventArgs or a class that inherits from EventArgs), a delegate for the event, and a class that raises the event.


4. You are in the process of isolating a complicated bug in a Console application that occurs only in rare circumstances. You need to write information to the debugging console, but you do not want to waste processing cycles when users run release versions of the application.

Which method should you call?

A. Console.WriteLine
B. Debugger.Log
C. Debug.Assert
D. Console.Write

Microsoft Press :     The correct answer is B. Debugger.Log posts information to the attached Debugger if one is present. If no Debugger is present, the result is effectively nothing.

Console.Write and Console.WriteLine are processed in both debug and release versions of code. The output is written to the console, not to the debugger.

Debug.Assert validates a value and does not output information to the debugger.

5. You need to pause a thread to ensure that other threads have sufficient processor time. You need to resume processing of the thread later.

Which method would you call?

A. Thread.Suspend
B. Thread.Abort
C. Thread.Sleep
D. Thread.Interrupt
Microsoft Press :     The correct answer is C.
hread.Sleep seems to be the correct call. MSDN - Passing and resuming Threads States: "
You can also have threads put themselves to sleep. When threads are blocked or sleeping, you can use a ThreadInterruptedException to break them out of their wait states.

The Thread.Sleep Method

--------------------------------------------------------------------------------

Calling the ThreadSleep method causes the current thread to immediately block for the number of milliseconds you pass to ThreadSleep, yielding the remainder of its time slice to another thread. One thread cannot call ThreadSleep on another thread.

Calling ThreadSleep with TimeoutInfinite causes a thread to sleep until it is interrupted by another thread that calls ThreadInterrupt, or until it is terminated by ThreadAbort.

Interrupting Threads

--------------------------------------------------------------------------------

You can interrupt a waiting thread by calling ThreadInterrupt on the blocked thread to throw a ThreadInterruptedException, which breaks the thread out of the blocking call. The thread should catch the ThreadInterruptedException and do whatever is appropriate to continue working. If the thread ignores the exception, the runtime catches the exception and stops the thread."
6. Which of the following is a first-in, first-out (FIFO) collection?

a. [b]Queue[/b]
b. [b]Stack[/b]
c. [b]List[/b]
d. [b]Hashtable[/b]
Microsoft Press :     The correct answer is A. The Queue class is a FIFO collection.

The Stack collection is a last-in, first-out collection.

The List class does not support ordered retrieval.

The Hashtable class does not support ordered retrieval.
7. You are in the process of isolating a complicated bug in a Console application that occurs only in rare circumstances. You would like to pause execution to examine the values of variables during debugging, but you do not want to pause execution when users run release versions of the application.

Which method should you call?

A. Console.ReadLine
B. Debugger.Break
C. Debug.Assert
D. Console.Read
Microsoft Press :     The correct answer is B. Debugger.Break acts just like a hard-coded breakpoint, except that you can call it programmatically. The Debugger class is only used in debug releases.

Console.Read and Console.ReadLine interrupt processing in both debug and release versions of code.

Debug.Assert validates a value and does not stop execution during debugging.

Resource :
Microsoft Press®. Books designed for the different ways you learn. And across the range of Microsoft technologies.


2 comments:

  1. Practice creates great. Would you like to strengthen your English ability and obtain the greatest English test out ratings? test-practice.net offers an individual free English testing and also workout routines online regarding English students to apply.

    ReplyDelete
  2. brillant piece of information, I had come to know about your web-page from my friend hardkik, chennai,i have read atleast 9 posts of yours by now, and let me tell you, your webpage gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts, once again hats off to you! Thanx a million once again, Regards, obiee training in hyderabad,informatica training in hyderabad


    ReplyDelete