You work as an application developer. Company wants you to develop an application that handles passes for abc.coms parking lot. The application has to store and retrieve vehicle information using a vehicle identification number {VIN). You need to use the correct code to ensure type-safety. What should you do?
You work as an application developer. You are currently in the process of creating a new application. You are required to read compressed data files that have been sent by company's sales offices. These data files are less than 4 GB in size, but were compressed without cyclic redundancy. You want to write a method that receives the compressed files and return the uncompressed data as a byte array. What should you do?
You write the following class that has three methods.
public class SimpleEmployee {
public string GetEmployeeId() { return employeeId; }
public string GetName() { return employeeName; }
public string GetTitle() { return jobTitleName; }
You need to expose the class to COM in a type library. The COM interface must not expose the method GetEmployeeId. The GetEmployeeId method must still be available to managed code. You need to hide the GetEmployeeID method from the COM interface. What should you do?
You develop an application that appends text to existing text files. You need to write a code segment that enables the application to append text to a file named C:\MyFile.txt. The application must throw an exception if the file does not exist. You need to ensure that the other applications can read but not modify the file. Which code segment should you use?
You are creating a class named Temperature. The Temperature class contains a public field named F. The public field F represents a temperature in degrees Fahrenheit. You need to ensure that users can specify whether a string representation of a Temperature instance displays the Fahrenheit value or the equivalent Celsius value. Which code segment should you use?
You are creating an assembly that interacts with the file system. You need to configure a permission request so that the common language runtime (CLR) will stop loading the assembly if the necessary file permissions are absent. Which attribute should you place in your code?
You are developing a multithreaded application. You need to ensure that a shared resource maintains a consistent state when multiple threads update it. You also need to permit multiple threads to read the shared resource concurrently. What should you do?
You are developing a routine that will periodically perform a calculation based on regularly changing values from legacy systems. You write the following lines of code. (Line numbers are included for reference only.)
01 bool exitLoop = false;
02 do {
04 exitLoop = PerformCalculation();
05 } while (!exitLoop);
You need to write a code segment to ensure that the calculation is performed at 30-second intervals. You must ensure that minimum processor resources are used between the calculations. Which code segment should you insert at line 03?
You create a class library that contains the class hierarchy defined in the following code segment. (Line numbers are included for reference only.)
01 public class Group {
02 public Employee[] Employees;
03 }
04 public class Employee {
05 public string Name;
06 }
07 public class Manager : Employee {
08 public int Level;
09 }
You create an instance of the Group class. You populate the fields of the instance. When you attempt to serialize the instance by using the Serialize method of the XmlSerializer class, you receive
InvalidOperationException. You also receive the following error message: There was an error generating the XML document. You need to modify the code segment so that you can successfully serialize instances of the Group class by using the XmlSerializer class. You also need to ensure that the XML output contains an element for all public fields in the class hierarchy. What should you do?