Un fel de simulare examen Microsoft 70-536: Microsoft .NET Framework, Application Development Foundation

1. 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?
a. StreamWriter
b. FileStream
c. StringWriter
d. BinaryWriter

2. . 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?
a. Use the UTF7Encoding.GetBytes method
b. Use the Unicode.GetChars method
c. Use the Unicode.GetBytes method
d. Use the UTF7Encoding.GetChars method

3. As part of a sizable .Net team you are responsible for working on state of the art .Net solutions. Your team has just finished developing a large application for a space exploration company. It is now your responsibility to fully test and debug the application. To aid in the debugging you have chosen to use the TextWriterTraceListener. Which namespace do you need to include a reference to?
a. System.Reflection
b. System.Diagnostics
c. System.Deployment
d. System.Resources

4. 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?
a. Role-based security
b. Encryption
c. Type Safety
d. Code access security

5. 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?
a. String
b. All of these
c. Stream
d. Filename

6. 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?
a. HttpClient
b. WebServicesClient
c. WindowsServicesClient
d. SmtpClient

7. 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?
a. Hashtable
b. Queue
c. SortedList
d. Stack

8. 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?
a. DebugListener
b. DebugSwitch
c. Trace
d. TraceSwitch

9. 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?
a. IComparable
b. ICloneable
c. IFormattable
d. IDisposable

10. As part of your assembly, you must call a COM .dll file. Using Microsoft Visual Studio 2005, what is the easiest way to generate an interop assembly and enable your assembly to access the dynamic-link library (DLL)?
a. Use the Project menu, select Add Reference, choose the NET tab and select the library
b. Use the Project menu, select Add Reference, choose the COM tab and select the library
c. Use the Project meny, select Add Component, browse to the library to add it
d. None of these

11. The .Net framework provides various classes to enable you to read data from files located on the hard disk. One of these classes the FileStream treats a file as a stream of bytes. Which of the following is NOT a parameter of the FilesStream.Read method?
a. The minimum number of bytes to read
b. A buffer to hold the data being read
c. An offset in the buffer where new bytes read are placed
d. The maximum number of bytes to read

12. 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?
a. PrincipalPermission
b. DnsPermission
c. PublisherIdentityPermission
d. ZoneIdentityPermission

13. You are working on a .NET Framework version 2.0 assembly for your firms internal applications. However, you now need to load a .NET Framework version 1.1 assembly to examine its metadata given its file name. Which method should you use?
a. Assembly.ReflectionOnlyLoadFrom
b. Assembly.LoadModule
c. None of these
d. Assembly.LoadFile

14. 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?
a. MemoryStream
b. StreamReader
c. FileStream
d. SslStream

15. 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?
a. None of these
b. RC2
c. DES
d. TripleDES

16. 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?
a. TextWriterTraceListener listens only to the messages generated by the Trace class
b. All trace messages are stored in a file on the users SYSTEM32 folder
c. TextWriterTraceListener listens to all messages generated by both the Debug and Trace classes
d. TextWriterTraceListener listens only to the messages generated by the Debug class

17. You are developing a .Net application that reads a list of product details from an XML file into an XMLDocument object. You need to modify some of the nodes in the document during this process and then write the modified XmlDocument object back to disk to save the changes permanently. Which object should you use to write the edited XmlDocument object back to disk?
a. FileStream
b. StreamWriter
c. XmlTextWriter
d. BinaryWriter

18. You are working as one of the lead developers on a .Net application for a small pharmaceutical company. The main application called ‘monitor’, monitors all occurrences of the smaller ‘tester’ programme, which runs as a hidden process to calculate test results. The ‘monitor’ application uses the System.Diagnostics namespace to monitor processes. One of the most important roles of the ‘monitor’ application is to check when a ‘tester’ application process has stop responding.
Which property of the Process class should you use?
a. StandardOutput
b. ProcessorAffinity
c. WorkingSet
d. None of these

19. You are designing a new .Net application to read data from primitive arbitrary custom files. When a user chooses a disk file, you want to open the file and read it 1 byte at a time. Which .NET class should you use to achieve this?
a. BinaryReader
b. StreamReader
c. FileStream
d. StringReader

20. 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?
a. MyQueue.Enqueue()
b. MyQueue.Peek()
c. MyQueue.Dequeue()
d. MyQueue.Clone()

1. d) 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.
2. a) Use the UTF7Encoding.GetBytes method. You should use the GetBytes method of the encoding that you want to perform the conversion into.
3. b) System.Diagnostics. The System.Diagnostics contains classes for TextWriterTraceListener, TraceSwitch, DelimitedListTraceListener and other classes specifically designed to aid debugging.
4. d) Code access security. Using Code access security you can use the OleDbPermission to grant permission to use any OLE DB data sources. (http://msdn.microsoft.com/en-us/library/system.security.codeaccesspermission.aspx)
5. b) All of these. You can attach Strings, Streams or specify a filename to attach to your mail messages (http://msdn.microsoft.com/en-gb/library/system.net.mail.aspx)
6. d) 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.
7. c) SortedList. The SortedList class stores elements in key order. Elements can also be pulled from the list using either the key or by index.
8. d) 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 (http://msdn.microsoft.com/en-us/system.diagnostics.traceswitch.aspx)
9. d) IDisposable. The IDisposable interface defines a method to release allocated unmanaged resources (http://msdn.microsoft.com/en-us/system.idisposable.aspx)
10. b)
11. a) The minimum number of bytes to read. The FileStream.Read method does not need to know about the minimum number of bytes to read, it only needs to know the maximum number.
12. a) PrincipalPermission. The PrincipalPermission permission of the .Net framework represents the credentials of the application user. (http://msdn.microsoft.com/en-us/library/system.security.permissions.aspx)
13. a) Assembly.ReflectionOnlyLoadFrom. The Assembly.ReflectionOnlyLoadFrom method Loads an assembly into the reflection-only context, given its path. (http://msdn.microsoft.com/en-us/system.reflection.assembly.reflectiononlyloadfrom.aspx)
14. c) FileStream (http://msdn.microsoft.com/en-gb/library/system.io.filestream.aspx)
15. c) 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 (http://msdn.microsoft.com/en-us/system.security.cryptography.des.aspx)
16. c) When you add a listener to the Trace.Lsiteners collection, it will listen to messages generated both by Trace and Debug classes (http://msdn.microsoft.com/en-us/library/system.diagnostics.textwritertracelistener.aspx)
17. c) XmlTextWriter. The XmlTextWriter is designed to provide a fast, non-cached, forward-only way of generating streams or files containing XML data (http://msdn.microsoft.com/en-us/library/system.xml.xmltextwriter.aspx)
18. d) None of these. The property you should use to check if a process has stopped responding is the ‘Responding’ property.
19. c) The FileStream class allows for byte-by-byte input or output. The other choices are not correct because they extend the FileStream class and hence require you to know the structure of the file you are reading (http://msdn.microsoft.com/en-us/library/system.io.filestream.aspx)
20. a) 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.