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

Question: 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?

  1. Insert the following code between lines 1 and 2 of the code segment:
    [XmlArrayItem(Type = typeof(Employee))]
    [XmlArrayItem(Type = typeof(Manager))]
  2. Insert the following code between lines 1 and 2 of the code segment:
    [XmlElement(Type = typeof(Employees))]
  3. Insert the following code between lines 1 and 2 of the code segment:
    [XmlArray(ElementName=”Employees”)]
  4. Insert the following code between lines 3 and 4 of the code segment:
    [XmlElement(Type = typeof(Employee))]
    And Insert the following code between lines 6 and 7 of the code segment:
    [XmlElement(Type = typeof(Manager))]

Correct Answer: 1


Question: You are creating a class that performs complex financial calculations. The class contains a method named GetCurrentRate that retrieves the current interest rate and a variable named currRate that stores the current interest rate. You write serialized representations of the class. You need to write a code segment that updates the currRate variable with the current interest rate when an instance of the class is deserialized. Which code segment should you use?

  1. [OnSerializing]
    internal void UpdateValue (StreamingContext context) {
    currRate = GetCurrentRate();}
  2. [OnSerializing]
    internal void UpdateValue(SerializationInfo info) {
    info.AddValue(“currentRate”, GetCurrentRate());}
  3. [OnDeserializing]
    internal void UpdateValue(SerializationInfo info) {
    info.AddValue(“currentRate”, GetCurrentRate());}
  4. [OnDeserialized]
    internal void UpdateValue(StreamingContext context) {
    currRate = GetCurrentRate();}

Correct Answer: 4


Question: You are testing a component that serializes the Meeting class instances so that they can be saved to the file system. The Meeting class has the following definition:
public class Meeting {
private string title;
public int roomNumber;
public string[] invitees;
public Meeting(){
}
public Meeting(string t){
title = t;
} }

The component contains a procedure with the following code segment.
Meeting myMeeting = new Meeting("Goals");
myMeeting.roomNumber = 1100;
string[] attendees = new string[2]{"Company", "Mary"};
myMeeting.invitees = attendees;
XmlSerializer xs = new XmlSerializer(typeof(Meeting));
StreamWriter writer = new StreamWriter(@"C:\Meeting.xml");
Xs.Serialize(writer, myMeeting);
writer.Close();

You need to identify the XML block that is written to the C:\Meeting.xml file as a result of running this procedure. Which XML block represents the content that will be written to the C:\Meeting.xml file?

  1. <?xml version="1.0" encoding="utf-8"?>
    <Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <title>Goals</title>
    <roomNumber>1100</roomNumber>
    <invitee>Company</invitee>
    <invitee>Mary</invitee>
    </Meeting>
  2. <?xml version="1.0" encoding="utf-8"?>
    <Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <roomNumber>1100</roomNumber>
    <invitees>
    <string>Company</string>
    <string>Mary</string>
    </invitees>
    </Meeting>
  3. <?xml version="1.0" encoding="utf-8"?>
    <Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" title="Goals">
    <roomNumber>1100</roomNumber>
    <invitees>
    <string>Company</string>
    <string>Mary</string>
    </invitees>
    </Meeting>
  4. <?xml version="1.0" encoding="utf-8"?>
    <Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <roomNumber>1100</roomNumber>
    <invitees>
    <string>Company</string>
    </invitees>
    <invitees>
    <string>Mary</string>
    </invitees>
    </Meeting>

Correct Answer: 2


Question: You are developing a class library that will open the network socket connections to computers on the network. You will deploy the class library to the global assembly cache and grant it full trust. You write the following code to ensure usage of the socket connections.
SocketPermission permission = new SocketPermission(PermissionState.Unrestricted);
permission.Assert();

Some of the applications that use the class library might not have the necessary permissions to open the network socket connections. You need to cancel the assertion. Which code segment should you use?

  1. CodeAccessPermission.RevertAssert();
  2. CodeAccessPermission.RevertDeny();
  3. permission.Deny();
  4. permission.PermitOnly();

Correct Answer: 1


Question: You are developing an application that will use custom authentication and role-based security. You need to write a code segment to make the runtime assign an unauthenticated principal object to each running thread. Which code segment should you use?

  1. AppDomain domain = AppDomain.CurrentDomain;
    domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
  2. AppDomain domain = AppDomain.CurrentDomain;
    domain.SetThreadPrincipal(new WindowsPrincipal(null));
  3. AppDomain domain = AppDomain.CurrentDomain;
    domain.SetAppDomainPolicy(PolicyLevel.CreateAppDomainLevel());
  4. AppDomain domain = AppDomain.CurrentDomain;
    domain.SetPrincipalPolicy(PrincipalPolicy.UnauthenticatedPrincipal);

Correct Answer: 4

Tagged . Bookmark the permalink.

One Response to Exam 70-536 : .NET Framework Application Development Foundation Part – 9

  1. Lauren says:

    You are so awesome! I do not believe I’ve truly read through anything like this before. So great to discover someone with a few original thoughts on this issue. Really.. thanks for starting this up. This site is one thing that is required on the internet, someone with a bit of originality!

Leave a Reply