Exam 70-536 : .NET Framework Application Development Foundation Part – 3

Question: You need to create a method to clear a Queue named q. Which code segment should you use?

  1. foreach (object e in q) {
    q.Dequeue();
    }
  2. foreach (object e in q) {
    Enqueue(null);
    }
  3. q.Clear();
  4. q.Dequeue();

Correct Answer: 3


Question: You need to return the contents of an isolated storage file as a string. The file is machine-scoped and is named Settings.dat. Which code segment should you use?

  1. IsolatedStorageFileStream isoStream;
    isoStream = new IsolatedStorageFileStream("Settings.dat", FileMode.Open);
    string result = new StreamReader(isoStream).ReadToEnd();
  2. IsolatedStorageFile isoFile;
    isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();
    IsolatedStorageFileStream isoStream;
    isoStream = new IsolatedStorageFileStream("Settings.dat", FileMode.Open, isoFile);
    string result = new StreamReader(isoStream).ReadToEnd();
  3. IsolatedStorageFileStream isoStream;
    isoStream = new IsolatedStorageFileStream("Settings.dat", FileMode.Open);
    string result = isoStream.ToString();
  4. IsolatedStorageFile isoFile;
    isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();
    IsolatedStorageFileStream isoStream;
    isoStream = new IsolatedStorageFileStream("Settings.dat", FileMode.Open, isoFile);
    string result = isoStream.ToString();

Correct Answer: 2


Question: You are creating a class to compare a specially-formatted string. The default collation comparisons do not apply. You need to implement the IComparable<string> interface. Which code segment should you use?

  1. public class Person : IComparable<string>{
    public int CompareTo(string other){
    }}
  2. public class Person : IComparable<string>{
    public int CompareTo(object other){
    }}
  3. public class Person : IComparable<string>{
    public bool CompareTo(string other){
    }}
  4. public class Person : IComparable<string>{
    public bool CompareTo(object other){
    }}

Correct Answer: 1


Question: You develop a service application named PollingService that periodically calls long-running procedures. These procedures are called from the DoWork method. You use the following service application code:
partial class PollingService : ServiceBase {
bool blnExit = false;
public PollingService() {}
protected override void OnStart(string[] args) {
do {
DoWork();
} while (!blnExit);
}
protected override void OnStop() {
blnExit = true;
}
private void DoWork() {
...
} }

When you attempt to start the service, you receive the following error message: Could not start the PollingService service on the local computer. Error 1053: The service did not respond to the start or control request in a timely fashion. You need to modify the service application code so that the service starts properly. What should you do?

  1. Move the loop code into the constructor of the service class from the OnStart method.
  2. Drag a timer component onto the design surface of the service. Move the calls to the long-running procedure from the OnStart method into the Tick event procedure of the timer, set the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method.
  3. Add a class-level System.Timers.Timer variable to the service class code. Move the call to the DoWork method into the Elapsed event procedure of the timer, set the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method.
  4. Move the loop code from the OnStart method into the DoWork method.

Correct Answer: 3


Question: You are developing an application that will perform mathematical calculations. You need to ensure that the application is able to perform multiple calculations simultaneously. What should you do?

  1. Set the IdealProcessor property of the ProcessThread object.
  2. Set the ProcessorAffinity property of the ProcessThread object.
  3. For each calculation, call the QueueUserWorkItem method of the ThreadPool class.
  4. Set the Process.GetCurrentProcess().BasePriority property to High.

Correct Answer: 3

Tagged . Bookmark the permalink.

Leave a Reply