Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 8

MCTS QUESTIONS AND ANSWERS

1)You have been hired by a small software company to help with the development of their internal .Net reporting applications. You have been given the task of assessing the security model of the company's application, in particular the classes derived from System.Security.CodeAccessPermission. Which one of the .NET framework permissions should be used to gain insight into the users credentials?

PrincipalPermission DnsPermission PublisherIdentityPermission ZoneIdentityPermission


2)You have written a COM component to provide advanced mathematical formulas for some of your school colleagues projects. Some of your colleagues are moving their projects to .NET and require a RCW to continue their work. What should you do to enable them to continue?

Use the ActiveX Library Importer tool to create and sign a PIA for your component Use the Type Library Importer tool to create and sign a PIA for your component Set a reference to your component from any Visual Studio .NET project to quickly create a RCW for you component Create an extra class that uses the Platform Invoke to call methods from your component
As the leading developer of your Visual Studio 2005 application you have been given the task of managing the storage of message data. You have opted to use the Queue class to store messages as they are delivered to your application. Which method of the Queue class should you use to store a new message string at the end of your queue object?

MyQueue.Peek() MyQueue.Enqueue() MyQueue.Dequeue() MyQueue.Clone()


Correct answer!

MyQueue.Enqueue(). To add a new object to the end of the queue you must use the Enqueue method. The other choices do not satisfy the requirement. Dequeue removes the object at the end of the list, Peek returns the first object and Clone creates a copy of the queue.

Your new .Net application needs to store a large amount of data to a disk file for permanent storage. Space is important and you want to write the data in a compact format but it does not need to be easily readable by humans. Which class is the best choice to accomplish this?

StreamWriter BinaryWriter FileStream StringWriter


BinaryWriter. The BinaryWriter class provides an efficient encoding method to write data to disk so long as you don't need the data to be in human readable format.

You are designing a new .Net application that will be used by clients in a large number of different countries. The application allows company's to store geographical information and then share that information with other company's in different countries. When storing this information ready to publish, which culture should you use?

The invariant culture The en-EN culture The culture from the Thread.CurrentThread.CurrentCulture A random culture
The invariant culture. The invariant culture is ideal for situations where the information is not presented to the end user but may need to be used from many different locals (languages). The invariant culture is a culture-neutral storage format.

You are working on a large .Net project with a group of work mates. The project is time critical and you need to think fast. As part of the project you have created an order entry system using Visual Studio 2005 and you want to email clients automatically when their orders have been processed. Which class is best suited to sending electronic mail using the .NET framework?

HttpClient

SmtpClient WebServicesClient WindowsServicesClient


SmtpClient. The SmtpClient is the desired choice to send e-mail by using the Simple Mail Transfer Protocol. The others either don't exist or don't provide you with the desired functionality.

Your new Visual Studio 2005 application has been designed to allow users to perform audit operations on their network. Your application uses the .Net namespace to create mail message and attach log files of network activity. What type of content can you specify for the Attachment method?

String All of these Stream Filename


All of these. You can attach Strings, Streams or specify a filename to attach to your mail messages.

You need to control the tracing and debug output of your .Net application but you really don't want to recompile your code because it will be delivered to an offshore test client. Which class could you use to achieve this?

TraceSwitch DebugListener DebugSwitch Trace


TraceSwitch. The TraceSwitch class provides a switch that allows you to control tracing and debugging output of a .Net application without recompiling the code. You can use the switch to change trace options simply by using the config file.

You are working on a new .Net application for a small software company. The application will use a collection from the Systems.Collection namespace to store key-

value pairs. However, you want the list to be ordered by key and you also want to be able to pick values from the list by using key name or index. Which collection would be the best choice?

Hashtable SortedLis t Queue Stack


SortedList. The SortedList class stores elements in key order. Elements can also be pulled from the list using either the key or by index.

You have been hired as the database developer for a small software company. Your organization would like you to send information from their internal database to external customers using XML documents. Currently, you have custom classes that store this information. Which class should you use to write the XML documents?

XmlSerializer BinaryFormatter TextWriter StreamWriter


Correct answer! XmlSerializer. The XmlSerializer serializes and deserializes objects into and from XML documents. The XmlSerializer also enables you to control how objects are encoded into XML.

You are working with a group of clients to develop a .Net application to monitor their legacy applications. However sometimes your application may encounter errors. So you therefore want to develop an error reporting process that is robust, requires a minimum amount of code and is also easily readable by the clients system administrators. Which one of the following would be the best choice for this scenario?

MS Access tables XML-based log files

Event Log Plain text log files


Correct answer! Event Log. More often than not you should use an Event Log for error reporting for a .Net applications. Event logs are very easy to read and write to using just a single line of code.

You have recently joined a .Net development team based in the heart of the city. One of their applications requires the use of OLE DB data sources to store specific data about their clients business workflows. Which .Net security feature should be used to ensure the code has this ability?

Role-based security Encryption Code access security Type Safety


Code access security. Using Code access security you can use the OleDbPermission to grant permission to use any OLE DB data sources.

You are designing a new .Net application that primarily uses the System.IO namespace to manipulate different files. You require the options to delete, move, copy and rename files. Which of the following methods of the FileInfo class does NOT exist?

Delete Move Rename Copy


Correct answer! Rename. The rename method is not part of the FileInfo class. The others are all part of the FileInfo class.

During development of your .Net project you added the following statement to the Load event handler of the main form of your windows application:

Trace.Listeners.Add(New TextWriterTraceListener("MyTraceLog.txt")) Which of the following statement is true below?

TextWriterTraceListener listens only to the messages generated by the Trace class All trace messages are stored in a file on the users SYSTEM32 folder TextWriterTraceListener listens only to the messages generated by the Debug class TextWriterTraceListener listens to all messages generated by both the Debug and Trace classes
TextWriterTraceListener listens to all messages generated by both the Debug and Trace classes. When you add a listener to the Trace.Lsiteners collection, it will listen to messages generated both by Trace and Debug classes.

You have been hired by Accelerated Ideas to help with our .Net projects. One of our projects created using Visual Studio 2005, serializes objects into XML for storage in an XML document. Which XmlSerializer method should you use to serialize the objects in your application into an XML document?

Serialize Deserialize FromMappings GenerateSerializer


Serialize. The serialize method is used to serialize an object into an XML document. Don't confuse this with GenerateSerializer as this returns an assembly that contains typed serializers.

You are designing a custom class that performs complex algorithm calculations. During these calculations the code allocates large chunks of memory. Rather than wait for the runtime to free the memory resources, you would like developers who use your class to be able to free resources on demand. Which interface should you implement?

IComparable

IDisposable ICloneable IFormattable


Correct answer! IDisposable. The IDisposable interface defines a method to release allocated unmanaged resources.

As part of a sizable .Net team you are responsible for working on state of the art .Net solutions. The current project you are working on makes extensive use of the IO namespace. You have reviewed this application and are considering alternative options and possibilities. As part of this review you need to know which one of the following classes interacts with the file system?

FileStream MemoryStream StreamReader SslStream


Your application uses Unicode strings encoded in the UTF-16 format. You now want to save a copy of those strings to a disk file in a different format, namely UTF-7. What should you do to achieve this conversion?

Use the Unicode.GetChars method Use the Unicode.GetBytes method Use the UTF7Encoding.GetChars method Use the UTF7Encoding.GetBytes method
Correct answer! Use the UTF7Encoding.GetBytes method. You should use the GetBytes method of the encoding that you want to perform the conversion into.

You have recently joined a new .Net development team based in the heart of the city. Your first task is to review a colleague's code for security vulnerabilities.

Which of the System.Security.Cryptography classes would indicate that the developer had chosen to use weak encryption that could potentially be cracked in a short amount of time?

None of these RC2 DES TripleDES


DES. DES represents the base class for the Data Encryption Standard (DES) algorithm from which all DES implementations must derive. You should at least use Triple DES (3DES) for stronger encryption.

You are designing a new .Net application for a local weather station to predict weather forecasts. The application contains a huge amount of complex methods, one of which accepts an object array and proceeds to either update an existing record in the database table or add a new one. However when you run the application you frequently receive the exception of type InvalidCastException. What does the error mean?

You cannot pass an array of objects as a variable type None of these The data is not correct for the column being updated The variables should first be converted to a collection before calling the method
The data is not correct for the column being updated. This error is thrown when invalid casting or explicit conversion is performed on data from one type to another.

You might also like