Microsoft 70-536 Exam Practice Questions: Technology Specialist

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Muskad202
Muskad202
Community Contributor
Quizzes Created: 2 | Total Attempts: 7,118
| Attempts: 5,174 | Questions: 39
Please wait...
Question 1 / 39
0 %
0/100
Score 0/100
1. You have a custom object 'MyCustomObject' which you store in a list. You now want to enable a user to sort this list (containing instances of 'MyCustomObject'). However, on reading the documentation, you determine that in order to support sorting in a list, your object needs to implement a particular interface. What interface do you need to implement?

Explanation

The IComparable interface is the one. It has a method named CompareTo, which is used to compare the current object instance with the one passed in via a parameter.

Submit
Please wait...
About This Quiz
Microsoft 70-536 Exam Practice Questions: Technology Specialist - Quiz

These are practice questions for the Microsoft Technology Specialist (TS) 70-536 Exam 70-210 developed for students and learners. There is a list of 40 questions. You... see morecan try these as a timed practice exam. The pass percentage is set to 75% for this set of practice questions. So, let's try out the quiz. All the best!
see less

2. What method would you call on an object of type DirectoryInfo to retrieve a list of all subdirectories under that directory?

Explanation

GetFileSystemInfos retrieves a list of both files and subdirectories. There is no method called GetSubDirectories.

Submit
3. You have a number of statements in your code that write lines to a Trace file. You use code as such: BooleanSwitch myTrace = new BooleanSwitch("MyTrace", "Used For Tracing"); Trace.WriteLineIf(myTrace.Enabled, "Test Trace Statement"); You want to toggle tracing on and off without having to recompile your application. What should you do?

Explanation

You should add the following to your app.config file:




Submit
4. You have created a custom event log using EventLog.CreateEventSource('A1','A2'); How would you write entries to this log?

Explanation

The first argument to CreateEventSource is the source name, and the second is the log name.

Submit
5. You work in a company and need to send an email to a user, and a copy of that email to your manager. Which code should you use?

Explanation

You cannot assign strings to the To, From and CC fields since these are collections of MailAddress objects. The answer shows the proper syntax.

Submit
6. You are developing a .NET assembly which will be used from both, .NET components and COM components. How would you notify the caller that incorrect arguments were passed to a method?

Explanation

The ArgumentException is a built-in .NET class, and .NET will automatically assign the correct value for the HResult. You should set HResult only for custom exception classes you create. The HResult value will be passed as the error code to the COM caller.

Submit
7. For the employees in a company, you need to store their salaries. Given an employee name, you want to find the salary as efficiently as possible. Currently, there are only 4 employees in the company, but you expect that number to go up to 100 by the year-end. Which object should you use?

Explanation

You should use the HybridDictionary since this class is efficient when the number of entries is small as well as large. The HashTable is not efficient when the number of entries is small. The StringCollection and ArrayList are not efficient for performing fast lookups � when the number of entries is small the performance hit may go unnoticed, but when the number of entries is large, they are much less efficient compared to HashTable and HybridDictionary.

Submit
8. When you attempt to run an assembly, you receive a security exception. You realize that the assembly does not have sufficient permissions required for running. Which tool can you use to modify the assembly's permissions?

Explanation

The Code Access Security Policy tool (caspol) is the one you need to use

Submit
9. Which interface should you implement in order to allow instances of your class to be converted to an instance of another type?

Explanation

The IConvertible interface contains the signatures for about 17 functions, like ToInt32(), ToDateTime(), GetTypeCode(), ToType(), etc.

Submit
10. You've created a function named 'MyFunction' which you want to be called every 10 minutes. You decide to use the Timer class. You write another function called 'StartTimer' which you will use to start the Timer. Also, when 'StartTimer' is called, you want 'MyFunction' to be called the moment the timer is started. What code would you use?

Explanation

The second argument specifies the parameter which will be passed to 'MyFunction'. The 3rd parameter specifies the delay (in milliseconds) before calling 'MyFunction' the first time. The 4th parameter specifies the interval (in milliseconds) between successive calls to 'MyFunction'.

Submit
11. Your application has a number of debug messages which you write using Debug.WriteLine(). How would you display all these messages on the command line?

Explanation

TextWriterTraceListener is less efficient than ConsoleTraceListener. You cannot add a stream object to the Listeners collection, hence you cannot use StreamWriter. There is no object named StreamWriterTraceListener.

Submit
12. You create an Employee object as such: [Serializable] public class Employee { public string Name; private long Salary; } When the employee object is serialized, you do not want the Salary field to be persisted. What is the easiest way to do this?

Explanation

The easiest way to prevent the Salary field from being persisted when serializing the Employee object is to add the NonSerialized attribute to the Salary field. This attribute tells the serializer to ignore the field during the serialization process.

Submit
13. You want to display the names of all currently running processes. What could can you use?

Explanation

The correct answer is "foreach (Process p in Process.GetProcesses()) MessageBox.Show(p.ProcessName);". This code uses the GetProcesses() method from the Process class to retrieve all currently running processes. It then uses a foreach loop to iterate through each process and display its name using the MessageBox.Show() method.

Submit
14. You write a function that calculates the square root of numbers. The number passed in as a parameter must be greater than or equal to 0. If the number is less than 0, then in your debug build, you want to display a message box to the user. What code would do this in the best possible way?

Explanation

The correct answer is Debug.Assert(parameter >= 0, "parameter cannot be less than 0"). This code uses the Debug.Assert method, which is specifically designed for debugging purposes. It checks if the parameter is less than 0 and if it is, it will display an assertion message with the specified error message. This helps in identifying and fixing issues during the debugging process.

Submit
15. Which code should you use to create a class that represents a Windows Service?

Explanation

The correct answer is "class MyService : System.ServiceProcess.ServiceBase { //implementation }". This is because the ServiceBase class is the base class for creating a Windows Service in C#. It provides the necessary methods and properties to control the service's lifecycle, such as OnStart, OnStop, and OnPause. The other options (WindowsService, ServiceHost, and Service) are not valid base classes for creating a Windows Service.

Submit
16. If a class implements ISerializable, it needs to provide a constructor that takes two parameters. What are the types of those parameters?

Explanation

If a class implements ISerializable, it needs to provide a constructor that takes two parameters. The first parameter is of type StreamingContext, which provides contextual information about the source or destination of the serialized data. The second parameter is of type SerializationInfo, which holds the serialized object data. These parameters are necessary for the class to properly deserialize and reconstruct the object from the serialized data.

Submit
17. You want to use IsolatedStorage to store user settings for your application. What could you use?

Explanation

You should not use GetMachineStoreForAssembly because then the file will be shared among all the users of the application. Also, you should use StreamWriter for accessing the files.

Submit
18. Within your application, you need to monitor and control a service installed on the local machine. Which class do you need to use?

Explanation

You can use code like:
ServiceController controller = new ServiceController('ServiceName');
controller.Start();
MessageBox.Show(controller.Status.ToString());

Submit
19. You want to encrypt the network communication while sending an email to an smtp server. Which code should you use?

Explanation

The correct answer is "=SmtpClient.EnableSsl = true;". This is because the "EnableSsl" property is used to enable SSL encryption for the network communication with the SMTP server. SSL (Secure Sockets Layer) is a cryptographic protocol that provides secure communication over a network. By setting "EnableSsl" to true, the email communication will be encrypted, ensuring that the data sent between the client and the server is protected from unauthorized access.

Submit
20. Which methods of the FileStream class affect the Position property?

Explanation

The methods of the FileStream class that affect the Position property are Read, Write, and Seek. The Read method reads a sequence of bytes from the current position in the file, advancing the Position property. The Write method writes a sequence of bytes to the current position in the file, also advancing the Position property. The Seek method sets the position within the file based on the specified offset, affecting the Position property accordingly. The Lock and Unlock methods are not related to the Position property and do not affect it.

Submit
21. What could you use to serialize an object 'obj' and write it to a stream 'outstream' using binary serialization?

Explanation

The correct answer is "BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(outstream, obj);" because it uses the BinaryFormatter class to serialize the object 'obj' and write it to the stream 'outstream'. The Serialize method of the BinaryFormatter class takes two parameters, the stream to write to and the object to serialize.

Submit
22. You want to use the Rijndael encryption method for encrypting an input file and storing the encrypted data in an output file. What code would you use?

Explanation

The CryptoStream object should wrap the stream that holds / will hold the encrypted data. Also, the CryptoStreamMode parameter should reflect the operation that will be carried out on the encrypted stream. Therefore, for encryption, since you will be writing to the encrypted stream, this parameter should be CryptoStreamMode.Write

Submit
23. You need to compress a Stream 'source file' and store the compressed bytes in another Stream 'destFile'. You also want to enable Cyclic Redundancy Checks in the compressed stream. What code would you use?

Explanation

During both compression and decompression, the DeflateStream or GZipStream objects must wrap the stream that holds/will hold the compressed bytes.
When using DeflateStream, no CRC checks are performed.

Submit
24. You want to copy a file from one location to another. You create two FileInfo objects' 'src' and 'dst' for this purpose which represent the source location and the destination location. You want to copy all the permissions which the original file has to the destination file. You also want to ensure that the destination file does not inherit the permissions of the destination directory in which it is placed. What code would you use?

Explanation

The first parameter in SetAccessRuleProtection determines whether permissions can be modified/inherited from the destination directory. The second parameter determines whether the current permissions that are being inherited from the current source folder should be copied or not. We require that both these parameters are set to true.

Submit
25. While writing a file using StreamWriter, how would you specify the encoding to use?

Explanation

There is no method called SetEncoding(). The Encoding property is readonly. There is no property called CodePage.

Submit
26. You are implementing a data structure, where in you want to store keys which are strings, and you want to store values associated with the keys, which are also strings. There can be multiple values associated with a key. What class would you use to minimize the development effort, while at the same time maximizing efficiency?

Explanation

You could also use Dictionary>, but this would require additional code when storing and retrieving data in it.

Submit
27. You have a function which should only be used by users who are part of the 'FavouriteUsers' group. You want to implement role-based security within the application. Which code snippet should you use?

Explanation

The correct answer is "if (Thread.CurrentPrincipal.IsInRole("FavouriteUsers")) { //execute code }". This code snippet checks if the current principal (user) is in the "FavouriteUsers" role before executing the code. It uses the IsInRole method of the CurrentPrincipal property to determine if the user is a member of the specified role.

Submit
28. You want to obtain a hash value for some data stored in a byte array, in order to detect if there is the corruption of the data. You use a HashAlgorithm object. Which code would you use to generate the hash?

Explanation

The correct code to generate the hash for the given scenario is "hash.ComputeHash(byteArray)". This code will use the HashAlgorithm object to compute the hash value for the data stored in the byte array. The ComputeHash method is specifically designed for this purpose and will generate the hash value that can be used to detect any corruption in the data.

Submit
29. You want to use the RSA algorithm to encrypt a string 'messageString' and obtain the encrypted bytes. What code would you use?

Explanation

The correct answer is RSACryptoServiceProvider myRsa = new RSACryptoServiceProvider(); byte[] messageBytes = Encoding.Unicode.GetBytes(messageString); byte[] encryptedMessage = myRsa.Encrypt(messageBytes, false). This code correctly initializes an instance of the RSACryptoServiceProvider class, converts the message string to bytes using the Unicode encoding, and then encrypts the message bytes using the RSA algorithm with the specified padding mode (in this case, false indicates no padding). The encrypted message is stored in the encryptedMessage byte array.

Submit
30. You want to implement role-based security in your application. The group and user data and account information are stored in a database. You want your application to restrict/allow access to code based on the user's group membership. You want to write your application with the least amount of effort. What should you do?

Explanation

You could Create custom classes that implement Identity and IPrincipal, but this would be more effort as compared to creating objects of type Generic Identity and Generic Principle.

Submit
31. How would you send an HTML email message using MailMessage and SmtpClient?

Explanation

To send an HTML email message using MailMessage and SmtpClient, you need to set the property MailMessage.IsBodyHtml to true. This indicates that the content of the email body is in HTML format. Then, you can set the HTML content in the MailMessage.Body field, which will be sent as the body of the email.

Submit
32. What code would you use (using Management Objects) to retrieve a list of logical drives on a machine?

Explanation

The given code snippet uses Management Objects to retrieve a list of logical drives on a machine. It first creates a ConnectionOptions object and sets the username and password for authentication. Then, it creates a ManagementScope object with the machine name and the ConnectionOptions. Next, it creates an ObjectQuery object with the query to select the logical drives with DriveType=3 (which represents local disk drives). After that, it creates a ManagementObjectSearcher object with the ManagementScope and ObjectQuery. It then calls the Get() method on the ManagementObjectSearcher to retrieve all the matching objects. Finally, it iterates over the ManagementObjectCollection and prints the name and size of each logical drive.

Submit
33. What are the restrictions imposed on the signature of a method that is called when a serialization event occurs?

Explanation

When a serialization event occurs, the method that is called must not return anything (void) because the serialization process does not expect any return value from the method. Additionally, the method must take a StreamingContext parameter because the StreamingContext object provides information about the source or destination of the serialized data.

Submit
34. What class would you use in order to create a Font from a string that contains the font definition?

Explanation

The correct answer is FontConverter. The FontConverter class is used to create a Font object from a string that contains the font definition. This class has a method that understands the string description of a font and converts it into a Font object.

Submit
35. You are developing a .NET assembly which will be used from both, .NET components and COM components. Which 3 utilities do you need to use to ensure that COM components can access your assembly as easy as possible?

Explanation

sn for signing your assembly with a key.
gacutil for placing it in the global assembly cache.
regasm for creating the required entries in the registry.

Submit
36. You develop a library and want to ensure that the functions in the library cannot be either directly or indirectly invoked by applications that are not running on the local intranet. What attribute would you add to each method?

Explanation

LinkDemand should be used. it ensures that all callers in the call stack have the necessary permission .in this case it ensures that all callers in the call stack are on the local intranet.

Submit
37. In order to use the for each statement, what interface needs to be implemented by the target class?

Explanation

The correct answer is IEnumerator. The for each statement is used to iterate over a collection of items. In order to use this statement, the target class needs to implement the IEnumerator interface. This interface provides the necessary methods for iterating over the collection, such as MoveNext() to move to the next item and Current to get the current item. By implementing this interface, the target class can be used in a for each loop to iterate over its items.

Submit
38. How can you retrieve a reference to the current application domain?

Explanation

The correct answer is "AppDomain ad = Thread.GetDomain();". This line of code retrieves a reference to the current application domain by using the GetDomain() method of the Thread class. The GetDomain() method returns the AppDomain object that represents the application domain in which the current thread is executing.

Submit
39. You want to add a key-value pair to a HashTable 'table'. However, you need to make sure that the key doesn't already exist in the HashTable. What code could you use?

Explanation

The correct answer is "if (table.Contains(key)) //key exists" and "if (table.ContainsKey(key)) //key exists" because both methods check if the key already exists in the HashTable. If the key exists, it means that the key-value pair cannot be added because it would result in a duplicate key.

Submit
View My Results

Quiz Review Timeline (Updated): Sep 18, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Sep 18, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 19, 2006
    Quiz Created by
    Muskad202
Cancel
  • All
    All (39)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
You have a custom object 'MyCustomObject' which you store in a...
What method would you call on an object of type DirectoryInfo to...
You have a number of statements in your code that write lines to a...
You have created a custom event log using...
You work in a company and need to send an email to a user, and a copy...
You are developing a .NET assembly which will be used from both, .NET...
For the employees in a company, you need to store their salaries....
When you attempt to run an assembly, you receive a security exception....
Which interface should you implement in order to allow instances of...
You've created a function named 'MyFunction' which you...
Your application has a number of debug messages which you write using...
You create an Employee object as such: [Serializable] public class...
You want to display the names of all currently running processes. What...
You write a function that calculates the square root of numbers. The...
Which code should you use to create a class that represents a Windows...
If a class implements ISerializable, it needs to provide a constructor...
You want to use IsolatedStorage to store user settings for your...
Within your application, you need to monitor and control a service...
You want to encrypt the network communication while sending an email...
Which methods of the FileStream class affect the Position property?
What could you use to serialize an object 'obj' and write it...
You want to use the Rijndael encryption method for encrypting an input...
You need to compress a Stream 'source file' and store the...
You want to copy a file from one location to another. You create two...
While writing a file using StreamWriter, how would you specify the...
You are implementing a data structure, where in you want to store keys...
You have a function which should only be used by users who are part of...
You want to obtain a hash value for some data stored in a byte array,...
You want to use the RSA algorithm to encrypt a string...
You want to implement role-based security in your application. The...
How would you send an HTML email message using MailMessage and...
What code would you use (using Management Objects) to retrieve a list...
What are the restrictions imposed on the signature of a method that is...
What class would you use in order to create a Font from a string that...
You are developing a .NET assembly which will be used from both, .NET...
You develop a library and want to ensure that the functions in the...
In order to use the for each statement, what interface needs to be...
How can you retrieve a reference to the current application domain?
You want to add a key-value pair to a HashTable 'table'....
Alert!

Advertisement