You are writing a method to compress an array of bytes. The bytes to be compressed are passed to the method in a parameter named document. You need to compress the contents of the incoming parameter. Which code segment should you use?

You are writing a method to compress an array of bytes. The bytes to be compressed are passed
to the method in a parameter named document.
You need to compress the contents of the incoming parameter.
Which code segment should you use?

A. Dim inStream As New MemoryStream(document)Dim zipStream As New
    GZipStream( _inStream, CompressionMode.Compress)Dim result(document.Length) As
    BytezipStream.Write(result, 0, result.Length)Return result
B. Dim objStream As New MemoryStream(document)Dim zipStream As New
    GZipStream( _
    objStream, CompressionMode.Compress)zipStream.Write(document, 0,
    document.Length)zipStream.Close()Return objStream.ToArray
C. Dim outStream As New MemoryStreamDim zipStream As New GZipStream(
    _outStream, CompressionMode.Compress)zipStream.Write(document, 0,
    document.Length)zipStream.Close()Return outStream.ToArray
D. Dim objStream As New MemoryStream(document)Dim zipStream As New
    GZipStream( _objStream, CompressionMode.Compress)Dim outStream As New
    MemoryStreamDim b As IntegerWhile (b =
    zipStream.ReadByte)outStream.WriteByte(CByte(b))End WhileReturn
    outStream.ToArray

Answer: C 

You need to read the entire contents of a file named Message.txt into a single string variable. Which code segment should you use?

You need to read the entire contents of a file named Message.txt into a single string variable.
Which code segment should you use?


A. String^ result = nullptr;StreamReader^ reader = gcnew
    StreamReader(“Message.txt”);result = reader->Read().ToString();
B. String^ result = nullptr;StreamReader^ reader = gcnew
    StreamReader(“Message.txt”);result = reader->ReadToEnd();
C. String^ result =String::Empty;StreamReader^ reader = gcnew
    StreamReader(“Message.txt”); while (!reader->EndOfStream) {
    result += reader->ToString();}
D. String^ result = nullptr;StreamReader^ reader = gcnew StreamReader(“Message.txt”); result =

 reader->ReadLine();

Answer: B 

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?

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?


A. IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(    
    “Settings.dat”, FileMode.Open); string result = new StreamReader(isoStream).ReadToEnd();
B. IsolatedStorageFile isoFile;isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();    
    IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(    
    “Settings.dat”, FileMode.Open, isoFile); string result = new    
    StreamReader(isoStream).ReadToEnd();
C. IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(    
    “Settings.dat”, FileMode.Open); string result = isoStream.ToString();
D. IsolatedStorageFile isoFile;isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();    
    IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(
    “Settings.dat”, FileMode.Open, isoFile); string result = isoStream.ToString();


A. IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(    
    “Settings.dat”, FileMode.Open); string result = new StreamReader(isoStream).ReadToEnd();
B. IsolatedStorageFile isoFile;isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();    
    IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(    
    “Settings.dat”, FileMode.Open, isoFile); string result = new    
    StreamReader(isoStream).ReadToEnd();
C. IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(    
    “Settings.dat”, FileMode.Open); string result = isoStream.ToString();
D. IsolatedStorageFile isoFile;isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();    
    IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(
    “Settings.dat”, FileMode.Open, isoFile); string result = isoStream.ToString();

Answer: B 

You need to create a class definition that is interoperable along with COM. You need to ensure that COM applications can create instances of the class and can call the GetAddress method. Which code segment should you use?

You need to create a class definition that is interoperable along with COM. You need to ensure
that COM applications can create instances of the class and can call the GetAddress method.
Which code segment should you use?



A. public ref class Customer {
    string addressString;public:
    Customer(string address) : addressString(address) { }
    String^ GetAddress() { return addressString; }}
B. public ref class Customer {
    static string addressString;public:
    Customer() { }
    static String^ GetAddress() { return addressString; }}
C. public ref class Customer {
    string addressString;
    public: Customer() { }
    String^ GetAddress() { return addressString; }}
D. public ref class Customer {
    string addressString;public:
    Customer() { }private:
    String^ GetAddress() { return addressString; }}


Answer: C

You are developing a method to decrypt data that was encrypted with the Triple DES Algorithm. The method accepts the following parameters:

You are developing a method to decrypt data that was encrypted with the Triple DES Algorithm.
The method accepts the following parameters: The byte array to be decrypted, which is named
cipherMessageThe key, which is named key An initialization vector, which is named iv You need
to decrypt the message by using the TripleDES class and place the result in a string.
Which code segment should you use?

A. TripleDES des = new TripleDESCryptoServiceProvider();des.BlockSize =    
    cipherMessage.Length;ICryptoTransform crypto = des.CreateDecryptor(key,
    iv);MemoryStream cipherStream = new MemoryStream(cipherMessage);CryptoStream
    cryptoStream =
    new CryptoStream(
    cipherStream, crypto, CryptoStreamMode.Read); string message;message = new    
    StreamReader(cryptoStream).ReadToEnd();
B. TripleDES des = new TripleDESCryptoServiceProvider();des.FeedbackSize =    
    cipherMessage.Length;ICryptoTransform crypto = des.CreateDecryptor(key,
    iv);MemoryStream cipherStream = new MemoryStream(cipherMessage);CryptoStream
    cryptoStream =
    new CryptoStream(
    cipherStream, crypto, CryptoStreamMode.Read); string message;message = new    
    StreamReader(cryptoStream).ReadToEnd();
C. TripleDES des = new TripleDESCryptoServiceProvider();ICryptoTransform crypto =    
    des.CreateDecryptor();MemoryStream cipherStream = new    
    MemoryStream(cipherMessage);CryptoStream cryptoStream =
    new CryptoStream(
    cipherStream, crypto, CryptoStreamMode.Read); string message;message = new    
    StreamReader(cryptoStream).ReadToEnd();
D. TripleDES des = new TripleDESCryptoServiceProvider();ICryptoTransform crypto =    
    des.CreateDecryptor(key, iv);MemoryStream cipherStream = new    
    MemoryStream(cipherMessage);CryptoStream cryptoStream =
    new CryptoStream(
    cipherStream, crypto, CryptoStreamMode.Read); string message;message = new    
    StreamReader(cryptoStream).ReadToEnd();



Answer: D

You are creating an application that lists processes on remote computers.

You are creating an application that lists processes on remote computers. The application
requires a method that performs the following tasks: Accept the remote computer name as a

string parameter named strComputer.Return an ArrayList object that contains the names of all
processes that are running on that computer. You need to write a code segment that retrieves the
name of each process that is running on the remote computer and adds the name to the ArrayList
object. Which code segment should you use?

A. ArrayList al = new ArrayList();Process[] procs =    
    Process.GetProcessesByName(strComputer);foreach (Process proc in procs) {
    al.Add(proc);}
B. ArrayList al = new ArrayList();Process[] procs = Process.GetProcesses(strComputer);foreach    
    (Process proc in procs) {
    al.Add(proc);}
C. ArrayList al = new ArrayList();Process[] procs =    
    Process.GetProcessesByName(strComputer);foreach (Process proc in procs) {
    al.Add(proc.ProcessName);}
D. ArrayList al = new ArrayList();Process[] procs = Process.GetProcesses(strComputer);foreach    
    (Process proc in procs) {
    al.Add(proc.ProcessName);}


Answer: D

You are testing a newly developed method named PersistToDB. This method accepts a parameter of type EventLogEntry

You are testing a newly developed method named PersistToDB. This method accepts a
parameter of type EventLogEntry. This method does not return a value. You need to create a
code segment that helps you to test the method. The code segment must read entries from the
application log of local computers and then pass the entries on to the PersistToDB method. The
code block must pass only events of type Error or Warning from the source MySource to the
PersistToDB method. Which code segment should you use?

A. EventLog^ myLog = gcnew EventLog(“Application”, “.”);
    for each (EventLogEntry^ entry in myLog->Entries) {
    if (entry->Source == "MySource") {
    PersistToDB(entry);
    }}
B. EventLog^ myLog = gcnew EventLog(“Application”, “.”);
    myLog->Source = “MySource”;
    for each (EventLogEntry^ entry in myLog->Entries) {
    if (entry->EntryType == (EventLogEntryType::Error &
    EventLogEntryType::Warning)) {
    PersistToDB(entry);}}
C. EventLog^ myLog = gcnew EventLog(“Application”, “.”);
    for each (EventLogEntry^ entry in myLog->Entries) {
    if (entry->Source == "MySource") {
    if (entry->EntryType == EventLogEntryType::Error ||
    entry->EntryType == EventLogEntryType::Warning) {
    PersistToDB(entry);
    }
    }}
D. EventLog^ myLog = gcnew EventLog(“Application”, “.”);
    myLog->Source = “MySource”;
    for each (EventLogEntry^ entry in myLog->Entries) {
    if (entry->EntryType == EventLogEntryType::Error ||
    entry->EntryType == EventLogEntryType::Warning) {
    PersistToDB(entry);
    }}


Answer: C

You are testing a newly developed method named PersistToDB. This method accepts a parameter of type EventLogEntry.

You are testing a newly developed method named PersistToDB. This method accepts a
parameter of type EventLogEntry.  This method does not return a value. You need to create a
code segment that helps you to test the method. The code segment must read entries from the
application log of local computers and then pass the entries on to the PersistToDB method. The
code block must pass only events of type Error or Warning from the source MySource to the
PersistToDB method.
Which code segment should you use?

A. Dim myLog As New EventLog("Application", ".")
    For Each entry As EventLogEntry In myLog.Entries
    If entry.Source = "MySource" Then
    PersistToDB(entry)
    End If
    Next
B. Dim myLog as New EventLog("Application", ".")
    myLog.Source = "MySource"
    For Each entry As EventLogEntry In myLog.Entries
    If entry.EntryType = (EventLogEntryType.Error And _
    EventLogEntryType.Warning) Then
    PersistToDB(entry)
    End If
    Next
C. Dim myLog as New EventLog("Application", ".")
    For Each entry As EventLogEntry In myLog.Entries
    If entry.Source = "MySource" Then
    If (entry.EntryType = EventLogEntryType.Error) Or _
    (entry.EntryType = EventLogEntryType.Warning) Then

    PersistToDB(entry)
    End If
    End If
    Next
D. Dim myLog as New EventLog("Application", ".")
    myLog.Source = "MySource"
    For Each entry As EventLogEntry In myLog.Entries
    If (entry.EntryType = EventLogEntryType.Error) Or _
    (entry.EntryType = EventLogEntryType.Warning) Then
    PersistToDB(entry)
    End If
    Next


Answer: C

You are creating an assembly named Braindumps1. Braindumps1 contains a public method. The global cache contains a second assembly named Braindumps2. You must ensure that the public method is only called from Braindumps2. Which permission class should you use?

You are creating an assembly named Braindumps1. Braindumps1 contains a public method.
The global cache contains a second assembly named Braindumps2.
You must ensure that the public method is only called from Braindumps2.
Which permission class should you use?


A. GacIdentityPermission
B. PublisherIdentityPermission
C. DataProtectionPermission
D. StrongNameIdentityPermission


Answer: A

You create a class library that contains the class hierarchy defined in the following code segment.

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?


A. Insert the following code between lines 1 and 2 of the code segment:
    [XmlArrayItem(Type = typeof(Employee))]
    [XmlArrayItem(Type = typeof(Manager))]
B. Insert the following code between lines 1 and 2 of the code segment:
    [XmlElement(Type = typeof(Employees))]
C. Insert the following code between lines 1 and 2 of the code segment:
    [XmlArray(ElementName="Employees")]
D. Insert the following code between lines 3 and 4 of the code segment:
    [XmlElement(Type = typeof(Employee))]
    andInsert the following code between lines 6 and 7 of the code segment:
    [XmlElement(Type = typeof(Manager))]


Answer: A 

You write the following code to implement the BraindumpsClass.MyMethod function. public class BraindumpsClass { public int MyMethod(int arg) { return arg; }} You need to call the BraindumpsClass.MyMethod function dynamically from an unrelated class in your assembly. Which code segment should you use?

You write the following code to implement the BraindumpsClass.MyMethod function.
public class BraindumpsClass {
public int MyMethod(int arg) {
return arg;
}}
You need to call the BraindumpsClass.MyMethod function dynamically from an unrelated class in
your assembly. Which code segment should you use?



A. BraindumpsClass myClass = new BraindumpsClass();
    Type t = typeof(BraindumpsClass);
    MethodInfo m = t.GetMethod(“MyMethod”);
    int i = (int)m.Invoke(this, new object[] { 1 });
B. BraindumpsClass myClass = new BraindumpsClass();
    Type t = typeof(BraindumpsClass);
    MethodInfo m = t.GetMethod(“MyMethod”);
    int i = (int) m.Invoke(myClass, new object[] { 1 });
C. BraindumpsClass myClass = new BraindumpsClass();
    Type t = typeof(BraindumpsClass);
    MethodInfo m = t.GetMethod(“BraindumpsClass.MyMethod”);
    int i = (int)m.Invoke(myClass, new object[] { 1 });
D. Type t = Type.GetType(“BraindumpsClass”);
    MethodInfo m = t.GetMethod(“MyMethod”);
    int i = (int)m.Invoke(this, new object[] { 1 });
   
Answer: B

You need to select a class that is optimized for key-based item retrieval from both small and large collections. Which class should you choose?

You need to select a class that is optimized for key-based item retrieval from both small and large
collections. Which class should you choose?


A. OrderedDictionary class
B. HybridDictionary class
C. ListDictionary class
D. Hashtable class


Answer: B

You are developing an application to assist the user in conducting electronic surveys. The survey consists of 25 true-or-false questions. You need to perform the following tasks: Initialize each answer to true.Minimize the amount of memory used by each survey. Which storage option should you choose?

You are developing an application to assist the user in conducting electronic surveys. The survey
consists of 25 true-or-false questions. You need to perform the following tasks:
Initialize each answer to true.Minimize the amount of memory used by each survey.
Which storage option should you choose?


A. Dim answers As New BitVector32(1)
B. Dim answers As New BitVector32(-1)
C. Dim answers As New BitArray(1)
D. Dim answers As New BitArray(-1)


Answer: B

You are developing a class library. Portions of your code need to access system environment variables. You need to force a runtime SecurityException only when callers that are higher in the call stack do not have the necessary permissions. Which call method should you use?

You are developing a class library. Portions of your code need to access system environment
variables.
You need to force a runtime SecurityException only when callers that are higher in the call stack
do not have the necessary permissions.
Which call method should you use?



A. Demand()
B. Assert()
C. PermitOnly()
D. Deny()



Answer: A

You need to write a code segment that transfers the first 80 bytes from a stream variable named stream1 into a new byte array named byteArray. You also need to ensure that the code segment assigns the number of bytes that are transferred to an integer variable named bytesTransferred. Which code segment should you use?

You need to write a code segment that transfers the first 80 bytes from a stream variable named
stream1 into a new byte array named byteArray. You also need to ensure that the code segment
assigns the number of bytes that are transferred to an integer variable named bytesTransferred.
Which code segment should you use?


A. bytesTransferred = stream1.Read(byteArray, 0, 80)
B. For i As Integer = 1 To 80
    stream1.WriteByte(byteArray(i))
    bytesTransferred = i
    If Not stream1.CanWrite Then
    Exit For
    End IfNext
C. While bytesTransferred < 80
    stream1.Seek(1, SeekOrigin.Current)
    byteArray(bytesTransferred) = _
    Convert.ToByte(stream1.ReadByte())bytesTransferred += 1End While
D. stream1.Write(byteArray, 0, 80)bytesTransferred = byteArray.Length


Answer: A 

You are creating a class named Age. You need to ensure that the Age class is written such that collections of Age objects can be sorted. Which code segment should you use?

You are creating a class named Age.
You need to ensure that the Age class is written such that collections of Age objects can be
sorted. Which code segment should you use?


A. public class Age {
    public int Value;
    public object CompareTo(object obj) {
    if (obj is Age) {
    Age_age = (Age) obj;
    return Value.ComapreTo(obj);
    }
    throw new ArgumentException(“object not an Age”);
    }
    }
B. public class Age {
    public int Value;
    public object CompareTo(int iValue) {
    try {
    return Value.ComapreTo(iValue);
    } catch {
    throw new ArgumentException(“object not an Age”);
    }
    }
    }
C. public class Age : IComparable {
    public int Value;
    public int CompareTo(object obj) {
    if (obj is Age) {
    Age_age = (Age) obj;
    return Value.ComapreTo(_age.Value);
    }
    throw new ArgumentException(“object not an Age”);
    }
    }
D. public class Age : IComparable {
    public int Value;
    public int CompareTo(object obj) {
    try {
    return Value.ComapreTo(((Age) obj).Value);
    } catch {
    return -1;
    }
    }

   }

Answer: C 

You are loading a new assembly into an application. You need to override the default evidence for the assembly. You require the common language runtime (CLR) to grant the assembly a permission set, as if the assembly were loaded from the local intranet zone. You need to build the evidence collection. Which code segment should you use?

You are loading a new assembly into an application. You need to override the default evidence
for the assembly. You require the common language runtime (CLR) to grant the assembly a
permission set, as if the assembly were loaded from the local intranet zone.
You need to build the evidence collection. Which code segment should you use?


A. Evidence^ evidence = gcnew
    Evidence(Assembly::GetExecutingAssembly()->Evidence);
B. Evidence^ evidence = gcnew Evidence();evidence->AddAssembly(gcnew    
    Zone(SecurityZone::Intranet));
C. Evidence^ evidence = gcnew Evidence();evidence->AddHost(gcnew    
    Zone(SecurityZone::Intranet));
D. Evidence^ evidence = gcnew Evidence(AppDomain::CurrentDomain->Evidence);


Answer: C

You develop a service application named FileService.

You develop a service application named FileService. You deploy the service application to
multiple servers on your network. You implement the following code segment. (Line numbers are
included for reference only.)
01 public :
02 void StartService(String^ serverName){
03
04 ServiceController^ crtl = gcnew
05 ServiceController(“FileService”);
06 if (crtl->Status == ServiceControllerStatus::Stopped){}
07 }
You need to develop a routine that will start FileService if it stops. The routine must start
FileService on the server identified by the serverName input parameter.
Which two lines of code should you add to the code segment? (Each correct answer presents
part of the solution. Choose two.)

A. Insert the following line of code between lines 03 and 04:crtl.ServiceName = serverName;
B. Insert the following line of code between lines 03 and 04:crtl.MachineName = serverName;
C. Insert the following line of code between lines 03 and 04:crtl.Site.Name = serverName;
D. Insert the following line of code between lines 04 and 05:crtl.Continue();
E. Insert the following line of code between lines 04 and 05:crtl.Start();
F. Insert the following line of code between lines 04 and 05:crtl.ExecuteCommand(0);



Answer: B, E

You are writing a custom dictionary. The custom-dictionary class is named MyDictionary. You need to ensure that the dictionary is type safe. Which code segment should you use?

You are writing a custom dictionary. The custom-dictionary class is named
MyDictionary. You need to ensure that the dictionary is type safe.
Which code segment should you use?


A. public ref class MYDictionary : public Dictionary<String^, String^>{};
B. public ref class MYDictionary : public Hashtable{};
C. public ref class MYDictionary : public IDictionary{};
D. public ref class MYDictionary {};Distionary<String^, String^>t = gcnew Dictionary<String^,
    String^>();MyDictionary dictionary = (MyDictionary)t;


Answer: A

You are defining a class named BraindumpsClass that contains several child objects.

You are defining a class named BraindumpsClass that contains several child objects.

BraindumpsClass contains a method named ProcessChildren that performs actions on the child
objects. BraindumpsClass objects will be serializable.
You need to ensure that the ProcessChildren method is executed after the BraindumpsClass
object and all its child objects are reconstructed.

Which two actions should you perform? (Each correct answer presents part of the solution.
Choose two.)

A. Apply the OnDeserializing attribute to the ProcessChildren method.
B. Specify that BraindumpsClass implements the IDeserializationCallback interface.
C. Specify that BraindumpsClass inherits from the ObjectManager class.
D. Apply the OnSerialized attribute to the ProcessChildren method.
E. Create a GetObjectData method that calls ProcessChildren.
F. Create an OnDeserialization method that calls ProcessChildren.


Answer: B, F