Microsoft 70-536 Exam Practice Questions: Technology Specialist

40 Questions | Total Attempts: 5115

SettingsSettingsSettings
Microsoft Certification Exam Quizzes & Trivia

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 can 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!


Related Topics
Questions and Answers
  • 1. 
    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?
    • A. 

      Exception e = new Exception('Invalid argument'); e.HResult = 0x80070057; throw e;

    • B. 

      Return Marshal.GetExceptionForHR(0x8007005);

    • C. 

      Throw new ArgumentException('Invalid Argument');

    • D. 

      Marshal.ThrowExceptionForHR(0x80070057);

  • 2. 
    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?
    • A. 

      Signtool

    • B. 

      Gacutil

    • C. 

      Sn

    • D. 

      Tlbimp

    • E. 

      Regasm

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

      EventLog log = new EventLog(); log.Source = "A1"; log.Log = "A2"; log.WriteData("data");

    • B. 

      EventLog log = new EventLog(); log.Source = "A2"; log.Log = "A1"; log.WriteEvent("data");

    • C. 

      EventLog log = new EventLog(); log.Source = "A1"; log.Log = "A2"; log.WriteEntry("data");

    • D. 

      EventLog log = new EventLog(); log.Source = "A2"; log.Log = "A1"; log.WriteError("data");

  • 4. 
    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?
    • A. 

      Caspol

    • B. 

      Permview

    • C. 

      Sn

    • D. 

      Gacutil

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

      BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(obj, outstream);

    • B. 

      BinaryFormatter formatter = new BinaryFormatter(obj); formatter.Serialize(outstream);

    • C. 

      BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(outstream, obj);

    • D. 

      BinaryFormatter formatter = new BinaryFormatter(outstream); formatter.Serialize(obj);

  • 6. 
    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?
    • A. 

      Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

    • B. 

      Debug.Listeners.Add(new StreamWriter(Console.Out));

    • C. 

      Debug.Listeners.Add(new ConsoleTraceListener(Console.Out));

    • D. 

      Debug.Listeners.Add(new StreamWriterTraceListener(Console.Out));

  • 7. 
    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?
    • A. 

      IComparable

    • B. 

      IComparer

    • C. 

      IEquatable

    • D. 

      IEqualityComparer

  • 8. 
    You create an application that uses an assembly a.dll. You distribute a.dll along with your application. The application uses version 1.0.0.0. After some months, you release a newer version of a.dll with version 1.5.0.0. You need to make sure that the already deployed applications seamlessly switch to the newer DLL version. What element will you add in the app.config file?
    • A. 

    • B. 

    • C. 

    • D. 

  • 9. 
    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?
    • A. 

      WindowsIdentity user = WindowsIdentity.GetCurrent(); if (user.IsInRole("FavouriteUsers")) { //execute code }

    • B. 

      WindowsGroup group = WindowsPrincipal.GetGroup("FavouriteUsers"); WindowsIdentity user = WindowsIdentity.GetCurrent(); if (group.Contains(user)) { //execute code }

    • C. 

      If (Thread.CurrentPrincipal.IsInRole("FavouriteUsers")) { //execute code }

    • D. 

      If (Thread.CurrentUser.IsMemberOf("FavouriteUsers")) { //execute code }

  • 10. 
    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?
    • A. 

      FileSecurity permission = src.GetAccessControl(); permission.SetAccessRuleProtection(true, false); dst.SetAccessControl(permission);

    • B. 

      FileSecurity permission = src.GetAccessControl(); permission.SetAccessRuleProtection(true, true); dst.SetAccessControl(permission);

    • C. 

      FileSecurity permission = src.GetAccessControl(); permission.SetAccessRuleProtection(false, false); dst.SetAccessControl(permission);

    • D. 

      FileSecurity permission = src.GetAccessControl(); permission.SetAccessRuleProtection(false, true); dst.SetAccessControl(permission);

  • 11. 
    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?
    • A. 

      [UrlIdentityPermission(SecurityAction.RequestRefuse, Url="http://myintranet")]

    • B. 

      [UrlIdentityPermission(SecurityAction.LinkDemand, Url="http://myintranet")]

    • C. 

      [UrlIdentityPermission(SecurityAction.Demand, Url="http://myintranet")]

    • D. 

      [UrlIdentityPermission(SecurityAction.Assert, Url="http://myintranet")]

  • 12. 
    How can you retrieve a reference to the current application domain?
    • A. 

      AppDomain ad = AppDomain.Current;

    • B. 

      AppDomain ad = Thread.GetDomain();

    • C. 

      AppDomain ad = Thread.CurrentThread.CurrentDomain;

    • D. 

      AppDomain ad = AppDomain.GetCurrentDomain();

  • 13. 
    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?
    • A. 

      Hash.Compute(byteArray);

    • B. 

      Hash.ComputeHash(byteArray);

    • C. 

      Hash = new HashAlgorithm(byteArray); hash.Compute();

    • D. 

      Hash = new HashAlgorithm(byteArray); hash.ComputeHash();

  • 14. 
    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?
  • 15. 
    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?
    • A. 

      StringCollection

    • B. 

      HybridDictionary

    • C. 

      HashTable

    • D. 

      ArrayList

  • 16. 
    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?
    • A. 

      Add the NonSerialized attribute to the Salary field.

    • B. 

      Have the Employee class implement ISerializable, and in the GetObjectData method, don't persist the Salary field.

    • C. 

      Do nothing. since Salary is a private field.

    • D. 

      Have the Employee class implement IFormatter for customizing the serialization process.

  • 17. 
    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?
    • A. 

      If (parameter < 0) MessageBox.Show("parameter cannot be less than 0");

    • B. 

      #if DEBUG if (parameter < 0) MessageBox.Show("parameter cannot be less than 0"); #endif

    • C. 

      Debug.Assert(parameter >= 0, "parameter cannot be less than 0");

    • D. 

      If (parameter < 0) Debug.Assert("parameter cannot be less than 0");

  • 18. 
    Which methods of the FileStream class affect the Position property?
    • A. 

      Read

    • B. 

      Write

    • C. 

      Seek

    • D. 

      Lock

    • E. 

      Unlock

  • 19. 
    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?
    • A. 

      Try { table.Add(key, value); } catch (Exception e) { //key already exists }

    • B. 

      If (table.Contains(key)) //key exists

    • C. 

      If (table.ContainsKey(key)) //key exists

    • D. 

      If (!table.TryAdd(key, value)) //key exists

  • 20. 
    What are the restrictions imposed on the signature of a method that is called when a serialization event occurs?
    • A. 

      Must not have any parameters (void)

    • B. 

      Must not return anything (void)

    • C. 

      Must take a StreamingContext parameter

    • D. 

      Must return a StreamingContext object

  • 21. 
    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?
    • A. 

      Void Compress(Stream sourceFile, Stream destFile) { GZipStream compStream = new GZipStream(destFile, CompressionMode.Compress); int theByte = sourceFile.ReadByte(); while (theByte != -1) { compStream.WriteByte((byte)theByte); theByte = sourceFile.ReadByte(); } compStream.Flush(); }

    • B. 

      Void Compress(Stream sourceFile, Stream destFile) { GZipStream compStream = new GZipStream(sourceFile, CompressionMode.Compress); int theByte = compStream.ReadByte(); while (theByte != -1) { destFile.WriteByte((byte)theByte); theByte = compStream.ReadByte(); } destFile.Flush(); }

    • C. 

      Void Compress(Stream sourceFile, Stream destFile) { DeflateStream compStream = new DeflateStream(destFile, CompressionMode.Compress); int theByte = sourceFile.ReadByte(); while (theByte != -1) { compStream.WriteByte((byte)theByte); theByte = sourceFile.ReadByte(); } compStream.Flush(); }

    • D. 

      Void Compress(Stream sourceFile, Stream destFile) { DeflateStream compStream = new DeflateStream(sourceFile, CompressionMode.Compress); int theByte = compStream.ReadByte(); while (theByte != -1) { destFile.WriteByte((byte)theByte); theByte = compStream.ReadByte(); } destFile.Flush(); }

  • 22. 
    How would you send an HTML email message using MailMessage and SmtpClient?
    • A. 

      MailMessage.IsSubjectHtml = true;

    • B. 

      Set HTML content in the MailMessage.Subject field.

    • C. 

      MailMessage.IsBodyHtml = true;

    • D. 

      Set HTML content in the MailMessage.Body field.

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

      SmtpClient.EnableEncryption = true;

    • B. 

      SmtpClient.UseEncryption = true;

    • C. 

      =SmtpClient.EnableSsl = true;

    • D. 

      SmtpClient.UseSsl = true;

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

      BinaryFormatter

    • B. 

      StreamingContext

    • C. 

      ObjectManager

    • D. 

      SerializationInfo

  • 25. 
    Which code should you use to create a class that represents a Windows Service?
    • A. 

      Class MyService : System.ServiceProcess.WindowsService { //implementation }

    • B. 

      Class MyService : System.ServiceProcess.ServiceHost { //implementation }

    • C. 

      Class MyService : System.ServiceProcess.ServiceBase { //implementation }

    • D. 

      Class MyService : System.ServiceProcess.Service { //implementation }