MCP-070-536

40 Questions | Total Attempts: 56

SettingsSettingsSettings
Microsoft Certification Quizzes & Trivia

C# Related Question


Related Topics
Questions and Answers
  • 1. 
     Certkiller .com uses Visual Studio.NET 2005 as its application development platform. You are in the process of storing numerical values up to 2,100,000,000 into a variable and may require storing negative values using a .NET Framework 2.0 application. You are required to optimize memory usage What should you do?
    • A. 

      Int32

    • B. 

      UInt16

    • C. 

      UInt32

    • D. 

      Int16

  • 2. 
     You are currently in the process of creating a class that stores data about Certkiller .com's customers. Certkiller .com customers are assigned unique identifiers and various characteristics that may include aliases, shipping instructions, and sales comments. These characteristics can change in both size and data type. You start by defining the Customer class as shown below: public class Customer { private int custID; private ArrayList attributes; public int CustomerID { get {return custID;} } public Customer (int CustomerID) { this.custID = CustomerID; this.attributes = new ArrayList (); } public void AddAttribute (object att) { attributes.Add (att); } } You have to create the FindAttribute method for locating attributes in Customer objects no matter what the data type is. You need to ensure that the FindAttribute method returns the attribute if found, and you also need to ensure type-safety when returning the attribute. What should you do?
    • A. 

      Use the following code to declare the FindAttribute method: public T FindAttribute (T att) { //Find attribute and return the value }

    • B. 

      Use the following code to declare the FindAttribute method: public object FindAttribute (object att) { //Find attribute and return the value }

    • C. 

      Use the following code to declare the FindAttribute method: public T FindAttribute (T att) { //Find attribute and return the value }

    • D. 

      Use the following code to declare the FindAttribute method: public string FindAttribute (string att) { //Find attribute and return the value }

  • 3. 
    Certkiller .com uses Visual Studio.NET 2005 as its application development platform. You are developing a .NET Framework 2.0 application used to store a type-safe list of names and e-mail addresses. The list will be populated all at ones from the sorted data which means you well not always need to perform insertion or deletion operations on the data. You are required to choose a data structure that optimizes memory use and has good performance. What should you do?
    • A. 

      The System.Collections.Generic.SortedList class should be used

    • B. 

      The System.Collections.HashTable class should be used

    • C. 

      The System.Collections.Generic.SortedDictionary class should be used

    • D. 

      The System.Collections.SortedList class should be used

  • 4. 
    You are currently in the process of reviewing an application that was created by a fellow developer. The application that you are reviewing includes a declaration for a collection named EmployeeList, which stores Employee objects. The declaration is shown below: public class EmployeeList : Enumerator, IEnumerable { // Class implementation } You require the ability to iterate through the EmployeeList with minimum development effort. What should you do?
    • A. 

      Utilize the switch statement

    • B. 

      Utilize the dowhile statement

    • C. 

      Utilize the foreach statement

    • D. 

      Utilize the if statement

  • 5. 
     Certkiller .com has been contracted to develop an application for the local bank. You have been given the responsibility of creating this application and need to store each transaction record, which is identified using a complex transaction identifier, in memory. The bank informs you that the total amount of transaction records could reach 200 per day. To achieve this, you decide to utilize one of the existing collection classes in the .NET 2.0 class library. You need to ensure that you the collection class you select is the most efficient one for storing transaction records. What should you do?
    • A. 

      Select the ListDictionary collection class.

    • B. 

      Select the HashTable collection class.

    • C. 

      Select the Queue collection class.

    • D. 

      Select the StringCollection collection class.

  • 6. 
     Certkiller .com wants you to develop an application that stores and retrieves client information by means of a unique account number. You create a custom collection class, which implements the IDictionary interface, named ClientDictionary. The following code have been included into the new application. //Create Client objects Client c1 = new Client ("AReid", "Andy Reid", Status.Current); Client c2 = new Client ("DAustin", "Dean Austin", Status.New); //Create ClientDictionary object IDictionary cData = new ClientDictionary (); cData.Add ("10001", c1); cData.Add ("10002", c2); You use the same method to add other Client objects to the collection. You need to ensure that you are able to retrieve client information associated with the account number 10111. What should you do?
    • A. 

      Use the following code: Client foundClient; foundClient = (Client) cData.Find ("10111");

    • B. 

      Use the following code: Client foundClient; if (cData.Contains ("10111")) foundClient = cData ["10111"];

    • C. 

      Use the following code: Client foundClient; if (cData.Contains ("10111")) foundClient = (Client) cData ["10111"];

    • D. 

      Use the following code: Client foundClient; foreach (string key in cData.Keys { if (key == "10111") foundClient = (Client) cData.Values ["10111"]; }

  • 7. 
    You are developing an application that makes use of a Queue class object named MyQueue. This Queue class object will be used to store messages sent by the user during application run time. You would like to access the message at the beginning of the queue, prior to processing the user messages, without removing it. What should you do?
    • A. 

      Use the Enqueue method of the MyQueue object.

    • B. 

      Use the Contains method of the MyQueue object.

    • C. 

      Use the Dequeue method of the MyQueue object.

    • D. 

      Use the Peek method of the MyQueue object.

  • 8. 
    Certkiller .com wants you to develop an application that stores and retrieves employee information by means of a unique staff number. You create a custom collection class, which implements the type-safe IDictionary interface. This collection class is named EmployeeCollection, and is defined using the following code. public class EmployeeCollection : IDictionary { // Implementation code } You need to ensure that an EmployeeCollection object is instantiated and that Employee objects are added to it. What should you do?
    • A. 

      Use the following code: Employee e1, e2; e1 = new Employee (1001, "Andy Reid", "Manager"); e2 = new Employee (1002, "Kara Lang", "Sales Engineer"); EmployeeCollection eData = new EmployeeCollection(); eData.Add (new KeyValuePair (e1.ID, e1)); eData.Add (new KeyValuePair (e2.ID, e2));

    • B. 

      . Use the following code: Employee e1, e2; e1 = new Employee (1001, "Andy Reid", "Manager"); e2 = new Employee (1002, "Kara Lang", "Sales Engineer"); EmployeeCollection eData = new EmployeeCollection(); eData.Add ((string) e1.ID, e1); eData.Add ((string) e2.ID, e2);

    • C. 

      Use the following code: Employee e1, e2; e1 = new Employee (1001, "Andy Reid", "Manager"); e2 = new Employee (1002, "Kara Lang", "Sales Engineer"); EmployeeCollection eData = new EmployeeCollection(); eData.Add (e1.ID, e1); eData.Add (e2.ID, e2);

    • D. 

      Use the following code: Employee e1, e2; e1 = new Employee (1001, "Andy Reid", "Manager"); e2 = new Employee (1002, "Kara Lang", "Sales Engineer"); EmployeeCollection eData = new EmployeeCollection(); eData.Add (new KeyValuePair (e1.ID, e1)); eData.Add (new KeyValuePair (e2.ID, e2));

  • 9. 
    You are developing a collection class named ClientCollection, which is to be used for storing the names of Certkiller .com's clients that are situated in various geographical areas. These client names are represented by the Client class. You are planning to create a method named SortClients in the ClientCollection class to arrange Client objects in ascending order. You need to ensure that the appropriate interface is implemented by the Client class to allow sorting. What interface should be used?
    • A. 

      IDictionary

    • B. 

      IComparable

    • C. 

      IComparer

    • D. 

      IEqualityComparer

  • 10. 
    You have been given the responsibility of creating a class named CalcSalary that will determine the salaries of Certkiller .com's staff. The CalcSalary class includes methods to increment and decrement staff salaries. The following code is included in the CalcSalary class: public class CalcSalary { // for promotions public static bool IncrementSalary (Employee Emp, double Amount) { if (Emp.Status == QuarterlyReview.AboveGoals) Emp.Salary += Amount; return true; } else return false; } //for demotions public static bool DecrementSalary (Employee Emp, double Amount) { if (Emp.Status == QuarterlyReview.AboveGoals) Emp.Salary -= Amount; return true; } else return false; } } You would like to invoke the IncrementSalary and DecrementSalary methods dynamically at runtime from the sales manager application, and decide to create a delegate named SalaryDelegate to invoke them. You need to ensure that you use the appropriate code to declare the SalaryDelegate delegate. What is the correct line of code?
    • A. 

      Public delegate bool Salary (Employee Emp, double Amount);

    • B. 

      Public bool Salary (Employee Emp, double Amount);

    • C. 

      public event bool Salary (Employee Emp, double Amount);

    • D. 

      Public delegate void Salary (Employee Emp, double Amount);

  • 11. 
    You have recently created a Windows service application and need to define a Windows service class. What should you do?
    • A. 

      Use the following code: public class TestService : System.ServiceProcess.WindowsService { //Implementation details }

    • B. 

      Use the following code: public class TestService : System.ServiceProcess.IWindowsService { //Implementation details }

    • C. 

      Use the following code: public class TestService : System.ServiceProcess.ServiceBase { //Implementation details }

    • D. 

      Use the following code: public class TestService : System.ServiceProcess.IService { //Implementation details }

  • 12. 
    Certkiller .com has asked you to develop an application that monitors and controls the activities of a Windows service. You need to use the appropriate class to meet Certkiller .com's requirements. What should you do?
    • A. 

      Use the ServiceBase class.

    • B. 

      Use the ServiceInstaller class.

    • C. 

      Use the ServiceManager class.

    • D. 

      Use the ServiceController class.

  • 13. 
    You have recently created a multithreaded application to manage Certkiller .com's inventory system. The fulfillment task has to be executed on a regular basis, while other tasks are performed in the application. The task does not need any input to start. You are required to create and start the fulfillment thread using the appropriate code. What code should you use?
    • A. 

      ThreadStart work = new ThreadStart (Fulfill); Thread thFulfill = new Thread (work);

    • B. 

      ParameterizedThreadStart work = new ParameterizedThreadStart (Fulfill); Thread thFulfill = new Thread (work);

    • C. 

      ThreadStart work = new ThreadStart (Fulfill); Thread thFulfill = new Thread (work); thFulfill.Start ();

    • D. 

      ParameterizedThreadStart work = new ParameterizedThreadStart (Fulfill); Thread thFulfill = new Thread (work); thFulfill.Start ();

  • 14. 
    You have recently created an application that includes the code shown below. public delegate stringGetFileContentsDel (); public string GetFileContents () { //Process file and return results } You now need to invoke the GetFileContents method asynchronously. You have to ensure that the code you use to invoke the GetFileContents method will continue to process other user instructions, and displays the results as soon as the GetFileContents method finishes processing. What should you do?
    • A. 

      Use the following code: GetFileContentsDel delAsync = new GetFileContentsDel (GetFileContents); IAsyncResult result = delAsync.BeginInvoke (null, null); while (!result.IsCompleted) { //Process other user instructions } string strFile = delAsync.EndInvoke (result);

    • B. 

      Use the following code: GetFileContentsDel delAsync = new GetFileContentsDel (GetFileContents); string strFile = delAsync.Invoke ();

    • C. 

      Use the following code: string strFile = GetFileContents.Invoke ();

    • D. 

      Use the following code: GetFileContentsDel delAsync = new GetFileContentsDel (GetFileContents); IAsyncResult result = delAsync.BeginInvoke (null, null); //Process other user instructions string strFile = delAsync.EndInvoke (result);

  • 15. 
    You have recently created an application domain for Certkiller .com. A few weeks later you are asked to retrieve information from this application domain, which is the current application domain. What can you do to achieve this objective? (Choose two)
    • A. 

      Use the following code: AppDomain appInfo = ApplicationDomain.Current;

    • B. 

      Use the following code: AppDomain appInfo = AppDomain.CurrentDomain ();

    • C. 

      Use the following code: AppDomain appInfo = Thread.GetDomain ();

    • D. 

      Use the following code: AppDomain appInfo = MainThread.GetDomain ();

  • 16. 
    You are required to dynamically load assemblies into a custom child application domain. You need to ensure that the assemblies loaded into the child application domain have the same permissions as the applications that are accessed across the local intranet. What should you do?
    • A. 

      Use the following code to create the child application domain: Evidence childEvidence = new Evidence (new object [ ] { SecurityZone.Intranet }, null); AppDomain.CreateDomain ("ChildDomain", childEvidence);

    • B. 

      Use the following code to create the child application domain: AppDomain.CreateDomain ("ChildDomain", SecurityZone.Intranet);

    • C. 

      Use the following code to create the child application domain: AppDomain domain = new AppDomain ("ChildDomain", SecurityZone.Intranet);

    • D. 

      Use the following code to create the child application domain: Evidence childEvidence = new Evidence (new object [ ] { SecurityZone.Intranet }, null); AppDomain domain = new AppDomain ("ChildDomain", childEvidence);

  • 17. 
    You are required to dynamically load assemblies into an application domain. You are using the Load method of the AppDomain class. What types of files can you this use method for?
    • A. 

      Library application files (.dll).

    • B. 

      All assembly files, no matter what there file extensions are.

    • C. 

      Application configuration files (.config).

    • D. 

      Standalone application files (.exe).

  • 18. 
    You are in the process of creating an application for Certkiller .com's Human Resources department that tracks employee benefits. You have to store current employee data without recompiling the application. You elect to store this employee data as a custom section in the application configuration file. The relevant portion of the application configuration file is shown in the following exhibit: You want to use the .NET 2.0 Configuration API to access the custom section. You need to ensure that programmatic access of the EmployeeSection element is enabled. What should you do? (Choose two)
    • A. 

      Create a custom section handler class that inherits the ConfigurationSection interface.

    • B. 

      Add a section element to the EmployeeSection element of the application configuration file.

    • C. 

      Create a custom section handler class that implements the IConfigurationSectionHandler interface.

    • D. 

      Add an EmployeeSection element to the configSections element of the application configuration file.

    • E. 

      Add a section element to the configSections element of the application configuration file.

  • 19. 
    You have recently created and deployed an application using the .NET 1.1 CLR to all Certkiller .com users. After a Certkiller .com administrator updates all user computers with the .NET 2.0 CLR, you run preliminary tests and find that the application you created using the .NET 1.1 CLR is not compatible with the .NET 2.0 CLR. You need to ensure that the application can be run with the .NET 1.1 CLR. What should you do?
    • A. 

      Use the following element in the application configuration file:

    • B. 

      Use the following element in the application configuration file:

    • C. 

      Use the following element in the application configuration file:

    • D. 

      Use the following element in the application configuration file:

  • 20. 
    You have recently created a business application that references another strong-named assembly named library.dll, and deployed it to all Certkiller .com users. Subsequent to testing the applications performance, you elect to upgrade the assembly's version to 1.1.0.0. You need to ensure that the new version of will not affect any of Certkiller .com's current users by adding the appropriate element to the assemblyBinding element in the application configuration file. What element should you add?
    • A. 

    • B. 

    • C. 

    • D. 

  • 21. 
    You are required to retrieve and display the names of all processes that are currently running in memory. What should you do?
    • A. 

      Use the following code: foreach (Process curProcess in Process.GetSystemProcesses ()) Console.WriteLine (curProcess.ProcessName);

    • B. 

      Use the following code: foreach (Process curProcess in Process.GetAllProcesses ()) Console.WriteLine (curProcess.ProcessName);

    • C. 

      Use the following code: foreach (Process curProcess in Process.GetProcesses ()) Console.WriteLine (curProcess.ProcessName);

    • D. 

      Use the following code: foreach (Process curProcess in Thread.GetProcesses ()) Console.WriteLine (curProcess.ProcessName);

  • 22. 
    To get information on a specific method named myMethod, you use Reflection. You need to find out if myMethod can be accessed from a derived class. Which of the following properties should you call from the myMethod class?
    • A. 

      Call the IsAssembly property.

    • B. 

      Call the IsVirtual property.

    • C. 

      Call the IsStatic property.

    • D. 

      Call the IsFamily property.

  • 23. 
    You create a new class that uses unmanaged resources, but which still has references to managed resources on other objects. You want users of the new class to be able to explicitly release resources when the class instance is no longer required. What should you do next? Choose the three actions which you should perform. Each correct answer presents only part of the complete solution.
    • A. 

      Define the existing class so that it inherits from the WeakReference class.

    • B. 

      Define the existing class so that it applies the IDisposable interface.

    • C. 

      Create a new class destructor which calls methods on other objects to release the managed resources.

    • D. 

      Create a new class destructor that releases the unmanaged resources.

    • E. 

      Create a new Dispose method that releases unmanaged resources and which also calls methods on other objects to release the managed resources.

  • 24. 
    You are developing a debug build of an existing application. You want to locate a specific line of code which resulted in the exception occurring. Choose the property of the Exception class that you should use to accomplish the task.
    • A. 

      Data property

    • B. 

      Message property

    • C. 

      StackTrace property

    • D. 

      Source property

  • 25. 
    You need to modify the code of an application. The application uses two threads named thread A and thread B. You want thread B to complete executing before thread A starts executing. How will you accomplish the task?
    • A. 

      Define thread A to run at a lower priority.

    • B. 

      Define thread B to run at a higher priority.

    • C. 

      Implement the WaitCallback delegate to synchronize the threads.

    • D. 

      Call the Sleep method of thread A.

    • E. 

      Call the SpinLock method of thread A.