Content: QUESTION 1
You use Reflection to obtain information about a method named MyMethod.
You need to ascertain whether MyMethod is accessible to a derived class. What should
you do? Call the IsAssembly property of the MethodInfo class. Call the IsVirtual property of the MethodInfo class. Call the IsStatic property of the MethodInfo class. Call the IsFamily property of the MethodInfo class. QUESTION 2
You are creating a class that uses unmanaged resources. This class maintains references
to managed resources on other objects. You need to ensure that users of this class can
explicitly release resources when the class instance ceases to be needed. Which three
actions should you perform? (Each correct answer presents part of the solution. Choose
three.) Define the class such that it inherits from the WeakReference class. Define the class such that it implements the IDisposable interface. Create a class destructor that calls methods on other objects to release the managed
resources. Create a class destructor that releases the unmanaged resources. Create a Dispose method that calls System.GC.Collect to force garbage collection. Create a Dispose method that releases unmanaged resources and calls methods on
other objects to release the managed resources. QUESTION 3
You are working on a debug build of an application.
You need to find the line of code that caused an exception to be thrown. Which property
of the Exception class should you use to achieve this goal? Data Message StackTrace Source. QUESTION 4
Your application uses two threads, named thread One and thread Two.
You need to modify the code to prevent the execution of thread One until thread Two
completes execution.
What should you do? Configure threadOne to run at a lower priority. Configure threadTwo to run at a higher priority. Use a WaitCallback delegate to synchronize the threads. Call the Sleep method of threadOne. Call the SpinLock method of threadOne. QUESTION 6
You work as a developer at Certkiller .com. You are creating an assembly named
Certkiller 1. Certkiller 1 contains a public method. The global cache contains a second
assembly named Certkiller 2.
You must ensure that the public method is only called from Certkiller 2.
Which permission class should you use? GacIdentityPermission PublisherIdentityPermission DataProtectionPermission StrongNameIdentityPermission. QUESTION 7
You are developing an application that receives events asynchronously. You create a
WqlEventQuery instance to specify the events and event conditions to which the
application must respond. You also create a ManagementEventWatcher instance to
subscribe to events matching the query. You need to identify the other actions you must
perform before the application can receive events asynchronously. Which two actions
should you perform? (Each correct answer presents part of the solution. Choose two.) Start listening for events by calling the Start method of the
ManagementEventWatcher. Set up a listener for events by using the EventArrived event of the
ManagementEventWatcher. Use the WaitFor
NextEvent method of the ManagementEventWatcher to wait for the events. Create an event handler class that has a method that receives an
ObjectReadyEventArgs parameter. Set up a listener for events by using the Stopped event of the
ManagementEventWatcher. QUESTION 8
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? OrderedDictionary class HybridDictionary class ListDictionary class Hashtable class. QUESTION 9
You need to call an unmanaged function from your managed code by using platform
invoke services. What should you do? Create a class to hold DLL functions and then create prototype methods by using
managed code. Register your assembly by using COM and then reference your managed code from
COM. Export a type library for your managed code. Import a type library as an assembly and then create instances of COM object. QUESTION 10
You need to identify a type that meets the following criteria: ?
Is always a number.?
Is not greater than 65,535. Which type should you choose? System.UInt16 int System.String System.IntPtr. QUESTION 11
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? Set the IdealProcessor property of the ProcessThread object. Set the ProcessorAffinity property of the ProcessThread object. For each calculation, call the QueueUserWorkItem method of the ThreadPool class. Set the Process.GetCurrentProcess().BasePriority property to High. QUESTION 12
Certkiller .com uses an application named Application1 that was compiled by using the
.NET Framework version 1.0. The application currently runs on a shared computer on
which the .NET Framework versions 1.0 and 1.1 are installed.
You need to move the application to a new computer on which the .NET Framework
versions 1.1 and 2.0 are installed. The application is compatible with the .NET
Framework 1.1, but it is incompatible with the .NET Framework 2.0. You need to ensure
that the application will use the .NET Framework version 1.1 on the new computer. What
should you do? A. Add the following XML element to the application configuration file.
<configuration>
<startup>
<supportedRuntime version="1.1.4322" />
<startup>
</configuration> B. Add the following XML element to the application configuration file.
<configuration>
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Application1"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.3075.0"
newVersion="1.1.4322.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> C. Add the following XML element to the machine configuration file.
<configuration>
<startup>
<requiredRuntime version="1.1.4322" />
<startup>
</configuration> D. Add the following XML element to the machine configuration file.
<configuration>
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Application1"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.3075.0"
newVersion="1.1.4322.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>. QUESTION 13
You are creating a strong-named assembly named Certkiller 1 that will be used in multiple
applications. Certkiller 1 will be rebuilt frequently during the development cycle. You
need to ensure that each time the assembly is rebuilt it works correctly with each
application that uses it. You need to configure the computer on which you develop
Certkiller 1 such that each application uses the latest build of Certkiller 1.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Create a DEVPATH environment variable that points to the build output directory for
the strong-named assembly. B. Add the following XML element to the machine configuration file:
<developmentMode developerInstallation="true"/> C. Add the following XML element to the machine configuration file:
<dependentAssembly>
<assemblyIdentity name=" Certkiller 1"
publicKeyToken="32ab4ba45e0a69a1"
language="en-US" version="*.*.*.*" />
<publisherPolicy apply="no" />
</dependentAssembly> D. Add the following XML element to the configuration file of each application that uses
the strong-named assembly:
<supportedRuntime version="*.*.*.*" /> E. Add the following XML element to the configuration file of each application that uses
the strong-named assembly:
<dependentAssembly>
<assemblyIdentity name=" Certkiller 1"
publicKeyToken="32ab4ba45e0a69a1"
language="en-US" version="*.*.*.*" />
<bindingRedirect newVersion="*.*.*.*"/>
</dependentAssembly>. QUESTION 14
You are defining a class named Certkiller Class that contains several child objects.
Certkiller Class contains a method named ProcessChildren that performs actions on the
child objects. Certkiller Class objects will be serializable.
You need to ensure that the ProcessChildren method is executed after the Certkiller Class
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 Certkiller Class implements the IDeserializationCallback interface. C. Specify that Certkiller Class 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. QUESTION 15
You develop a service application that needs to be deployed. Your network administrator
creates a specific user account for your service application. You need to configure your
service application to run in the context of this specific user account. What should you
do? Prior to installation, set the StartType property of the ServiceInstaller class. Prior to installation, set the Account, Username, and Password properties of the
ServiceProcessInstaller class. Use the CONFIG option of the net.exe command-line tool to install the service. Use the installutil.exe command-line tool to install the service. QUESTION 17
You are developing a method to call a COM component. You need to use declarative
security to explicitly request the runtime to perform a full stack walk. You must ensure
that all callers have the required level of trust for COM interop before the callers execute
your method. Which attribute should you place on the method? A. [SecurityPermission(
SecurityAction::Demand,
Flags=SecurityPermissionFlag::UnmanagedCode)] B. [SecurityPermission(
SecurityAction::LinkDemand,
Flags=SecurityPermissionFlag::UnmanagedCode)] C. [SecurityPermission(
SecurityAction::Assert,
Flags = SecurityPermissionFlag::UnmanagedCode)] D. [SecurityPermission(
SecurityAction::Deny,
Flags = SecurityPermissionFlag::UnmanagedCode)]. QUESTION 19
You are developing a custom-collection class.
You need to create a method in your class. You need to ensure that the method you create
in your class returns a type that is compatible with the Foreach statement. Which
criterion should the method meet? A. The method must return a type of either IEnumerator or IEnumerable. B. The method must return a type of IComparable. C. The method must explicitly contain a collection. D. The method must be the only iterator in the class. QUESTION 20
You are developing a custom event handler to automatically print all open documents.
The event handler helps specify the number of copies to be printed. You need to develop
a custom event arguments class to pass as a parameter to the event handler.
Which code segment should you use? A. public class PrintingArgs {
private int copies;
public PrintingArgs(int numberOfCopies) {
this.copies = numberOfCopies;
}
public int Copies {
get {return this.copies;
}
}} B. public class PrintingArgs : EventArgs {
private int copies;
public PrintingArgs(int numberOfCopies) {
this.copies = numberOfCopies;
}
public int Copies {
get {return this.copies;
}
}} C. public class PrintingArgs {
Private EventArgs eventArgs;
public PrintingArgs(EventArgs ea) {
this.eventArgs = ea;
}public EventArgs Args {get {return eventArgs;
}}} D. public class PrintingArgs : EventArgs {
private int copies;
}. QUESTION 21
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 = new EventLog("Application",".");
foreach (EventLogEntry entry in myLog.Entries)
{
if (entry.Source == "MySource")
{
PersistToDB(entry);
}
} B. EventLog myLog = new EventLog("Application",".");
myLog.Source = "MySource";
foreach (EventLogEntry entry in myLog.Entries)
{
if (entry.EntryType == (EventLogEntryType.Error &
EventLogEntryType.Warning))
{
PersistToDB(entry);
}
} C. EventLog myLog = new EventLog("Application",".");
foreach (EventLogEntry entry in myLog.Entries)
{
if (entry.Source == "MySource")
{
if (entry.EntryType == EventLogEntryType.Error ||
entry.EntryType == EventLogEntryType.Warning)
{
PersistToDB(entry);
}
}
} D. EventLog myLog = new EventLog("Application",".");
myLog.Source = "MySource";
foreach (EventLogEntry entry in myLog.Entries)
{
if (entry.EntryType == EventLogEntryType.Error ||
entry.EntryType == EventLogEntryType.Warning)
{
PersistToDB(entry);}. QUESTION 22
You create an application to send a message by e-mail. An SMTP server is available on
the local subnet. The SMTP server is named smtp. Certkiller .com.
To test the application, you use a source address, me@ Certkiller .com, and a target address,
you@ Certkiller .com.
You need to transmit the e-mail message. Which code segment should you use? A. MailAddress addrFrom =
new MailAddress("me@certkiller.com","Me");
MailAddress addrTo =
new MailAddress("you@certkiller.com","You");
MailMessage message = new MailMessage(addrFrom, addrTo);
message.Subject = "Greeting!";
message.Body = "Test";
message.Dispose(); B. String strSmtpClient = smtp.certkiller.com";
string strFrom = "me@certkiller.com";
string strTo = "you@certkiller.com";
String strSubject = "Greetings!";
String strBody = "Test";
MailMessage msg =
new MailMessage(strFrom, strTo, strSubject, strSmtpClient); C. MailAddress addrFrom, = new MailAddress("me@certkiller.com");
MailAddress addrTo, = new MailAddress("you@certkiller.com");
MailAddress message = new MailMessage(addrFrom,addrTo);
message.Subject = "Greeting!";
message.Body = "Test";
SmtpClient client = new SmtpClient("smtp.certkiller.com");
client.Send(message); D. MailAddress addrFrom =
new MailAdress("me@certkiller.com","Me");
MailAddress addrTo = new MailAddress("you@certkiller.com","You");
MailMessage message = new MailMessage(addrFrom,addrTo);
message.Subject = "Greeting!";
message.Body = "Test";
SocketInformation info = new SocketInformation();
Socket client = new Socket(info);
System.Text.ASCIIEncoding enc =
new System.Test.ASCIIENcoding();
byte[] msgBytes = enc.GetBytes(message. ToString());
client.Send(msgBytes);. QUESTION 23
You are developing an application to perform mathematical calculations. You develop a
class named CalculationValues. You write a procedure named PerformCalculation that
operates on an instance of the class. You need to ensure that the user interface of the
application continues to respond while calculations are being performed. You need to
write a code segment that calls the PerformCalculation procedure to achieve this goal.
Which code segment should you use? A. private void PerformCalculation() {...} private void DoWork(){
CalculationValues myValue = new CalculationValues();
Thread newThread = new Thread(
new threadStart(performCalculation));
new threadStart(myValues);
} B. private void PerformCalculation() {...} private void DoWork(){
CalculationValues myValue = new CalculationValues();
ThreadStart delStart = new
ThreadStart(PerformCalculation);
Thread newThread = new Thread(delStart);
if (newThread.IsAlive) {newThread.Start(my Values);
}} C. private void PerformCalculation (CalculationValues values) {...} private void
DoWork(){
CalculationValues myValue = new CalculationValues();
Application.DoEvents();
PerformCalculation(my values);
Application.DoEvents();
} D. private void PerformCalculation(object values) {...} private void DoWork(){
CalculationValues myValue = new CalculationValues();
Thread newThread = new Thread(
new parameterizedThreadStart(PerformCalculation));
newThread.Start(my Values);
}. QUESTION 24
You write the following code. public delegate void FaxDocs(object sender, FaxArgs
args);
You need to create an event that will invoke FaxDocs. Which code segment should you
use? A. public static event FaxDocs Fax; B. public static event Fax Fax Docs; C. public class FaxArgs : EventArgs {
private string coverPageInfo;
public FaxArgs(string coverInfo) {
this.coverPageInfo = coverPageInfo;
}
public string CoverPageInformation {
get {return this.coverPageInfo;
}
}} D. public class FaxArgs : EventArgs {
private sting coverPageinfo;
public string CoverPageInformation {
get {return this.coverPageInfo;
}
}}. QUESTION 25
You write the following code segment to call a function from the Win32 Application
Programming Interface (API) by using platform invoke.
string personName = "N?el";
string msg = "welcome " + personName + "to club"!;
bool rc = User32API.MessageBox(0, msg, personName, 0);
You need to define a method prototype that can best marshal the string data. Which code
segment should you use? A. [DllImport("user32", CharSet = CharSet.Ansi)]public static extern bool
MessageBox(int h Wnd, String text, String caption, unit type);
} B. [DllImport("user32", EntryPoint = "MessageBoxA", CharSet = CharSet.Ansi)]public
static extern bool MessageBox(int hWnd,
[MarshalAs(UnmanagedType.LPWStr)]String text,
[MarshalAs(UnmanagedType.LPWStr)]String caption,
unit type);
} C. [DllImport("user32", CharSet = CharSet.Unicode)]public static extern bool
MessageBox(int h Wnd, String text, String caption, unit type);
} D. [DllImport("user32", EntryPoint = "MessageBoxA", CharSet =
CharSet.Unicode)]public static extern bool MessageBox(int hWnd,
[MarshalAs(UnmanagedType.LPWStr)]String text,
[MarshalAs(UnmanagedType.LPWStr)]String caption,
unit type);
}. QUESTION 26
You are writing a method to compress an array of bytes. The array is passed to the
method in a parameter named document. You need to compress the incoming array of
bytes and return the result as an array of bytes. Which code segment should you use? A. MemoryStream strm = new MemoryStream(document);
DeflateStream deflate = new DeflateStream(strm,
CompressionMode.Compress);
byte[] result = new byte[document.Lenght];
deflate.Write(result, 0, result.Lenght);
return result; B. MemoryStream strm = new MemoryStream(document);
DeflateStream deflate = new DeflateStream(strm,
CompressionMode.Compress);
deflate.Write(document, 0, document .Lenght);
deflate.Close();
return strm.ToArray(); C. MemoryStream strm = new MemoryStream();
DeflateStream deflate = new DeflateStream(strm,
CompressionMode.Compress);
deflate.Write(document, 0, document .Lenght);
deflate.Close();
return strm.ToArray(); D. MemoryStream strm = new MemoryStream(document);
DeflateStream deflate = new DeflateStream(inStream,
CompressionMode.Compress);
MemoryStream outStream = new MemoryStream();
int b;
while ((b = deflate.ReadByte()) != -1) {
outStream. WriteByte((byte)b);
} return outStream.ToArray();. QUESTION 27
You are writing an application that uses SOAP to exchange data with other applications.
You use a Department class that inherits from ArrayList to send objects to another
application. The Department object is named dept.
You need to ensure that the application serializes the Department object for transport by
using SOAP. Which code should you use? A. SoapFormatter formatter = new SoapFormatter();
bytes[] buffer = new byte[dept.Capacity];
MemoryStream stream = new MemoryStream(buffer);
foreach (object o in dept) {
formatter.Serialize(stream, o);
} B. SoapFormatter formatter = new SoapFormatter();
bytes[] buffer = new byte[dept.Capacity];
MemoryStream stream = new MemoryStream(buffer);
formatter.Serialize(stream, dept); C. SoapFormatter formatter = new SoapFormatter();
MemoryStream stream = new MemoryStream();
foreach (object o in dept) {
formatter.Serialize(stream, o);
} D. SoapFormatter formatter = new SoapFormatter();
MemoryStream stream = new MemoryStream();
formatter.Serialize(stream, dept);. QUESTION 28
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 class Customer {
string addressString;
public Customer(string address) {addressString = address;
}
public string GetAddress() {return addressString;
}} B. public class Customer {
static string addressString;
public Customer() { }
public static string GetAddress() {return addressString;
}} C. public class Customer {
string addressString;
public Customer() { }
public static GetAddress() {return addressString;
}} D. public class Customer {
string addressString;
public Customer() { }
internal string GetAddress() {return addressString;
}}. QUESTION 29
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. set.Demand(); B. set.Assert(); C. setPermitOnly(); D. set.Deny();. QUESTION 30
You are developing a method to hash data with the Secure Hash Algorithm. The data is
passed to your method as a byte array named message. You need to compute the hash of
the incoming parameter by using SHA1. You also need to place the result into a byte
array named hash. Which code segment should you use? A. SHA1 sha = newSHA1CryptoServiceProvider();
byte[]hash = null;
sha.TransformBlock(
message, 0, message.Lenght, hash, 0); B. SHA1 sha = newSHA1CryptoServiceProvider();
byte[]hash = BitConverter.GetBytes(sha.GetHashCode()); C. SHA1 sha = newSHA1CryptoServiceProvider();
byte[]hash = sha.ComputeHash(message); D. SHA1 sha = newSHA1CryptoServiceProvider();
sha.GetHashCode();
byte[] hash = sha.Hash;. QUESTION 31
You are developing a method to hash data for later verification by using the MD5
algorithm. The data is passed to your method as a byte array named message. You need
to compute the hash of the incoming parameter by using MD5. You also need to place the
result into a byte array.
Which code segment should you use? A. HashAlgorithm algo = HashAlgorithm.Create("MD5");
byte[] hash = algo.ComputeHash(message); B. HashAlgorithm algo = HashAlgorithm.Create("MD5");
byte[] hash = BitConverter.GetBytes(algo.GetHashCode()); C. HashAlgorithm algo;
algo = HashAlgorithm.Create(message.ToString());
byte[] hash = algo.Hash; D. HashAlgorithm algo = HashAlgorithm.Create("MD5");
byte[] hash = null;
algo.TransformBlock(message, 0, message.Lenth, hash, 0);. QUESTION 32
You need to create a dynamic assembly named MyAssembly. You also need to save the
assembly to disk. Which code segment should you use? A. AssemblyName myAssemblyName =
new AssemblyName();
myAssemblyName.Name = "MyAssembly";
AssemblyBuilder myAssemblyBuilder =
AppDomain.CurrentDomain.DefineDynamicAssembly
(myAssemblyName, AssemblyBuilderAccess.Run);
myAssemblyBuilder.Save("MyAssembly.dll"); B. AssemblyName myAssemblyName =
new AssemblyName();
myAssemblyName.Name = "MyAssembly";
AssemblyBuilder myAssemblyBuilder =
AppDomain.CurrentDomain.DefineDynamicAssembly
(myAssemblyName, AssemblyBuilderAccess.Save);
myAssemblyBuilder.Save("MyAssembly.dll"); C. AssemblyName myAssemblyName =
new AssemblyName();
AssemblyBuilder myAssemblyBuilder =
AppDomain.CurrentDomain.DefineDynamicAssembly
(myAssemblyName, AssemblyBuilderAccess.RunAndSave);
myAssemblyBuilder.Save("MyAssembly.dll"); D. AssemblyName myAssemblyName =
myAssemblyName.Name = ("MyAssembly");
AssemblyBuilder myAssemblyBuilder =
AppDomain.CurrentDomain.DefineDynamicAssembly
(myAssemblyName, AssemblyBuilderAccess.Save);
myAssemblyBuilder.Save("c:\\MyAssembly.dll");. QUESTION 33
You are writing code for user authentication and authorization. The username, password,
and roles are stored in your application data store.
You need to establish a user security context that will be used for authorization checks
such as IsInRole. You write the following code segment to authorize the user.
if (!TestPassword(userName, password))
hrow new Exception("could not authenticate user");
String[] userRolesArray = LookupUserRoles(userName);
You need to complete this code so that it establishes the user security context. Which
code segment should you use? A. GenericIdentity ident = new GenericIdentity(UserName);
GenericPrincipal currentUser =
new GenericPrincipal(ident, userRolesArray);
Thread.CurrentPrincipal = currentUser; B. WindowsIdentity ident = new WindowsIdentity(userName);
WindowsPrinciplal currentUser = new WindowsPrinciplal(ident);
Thread.CurrentPrincipal = currentUser; C. NTAccount userNTName = new NTAccount(userName);
GenericIdentity ident = new GenericIdentity(userNTNmae.Value);
GenericPrincipal currentUser= new GenericPrincipal(ident, userRolesArray);
Thread.CurrentPrincipal = currentUser; D. Intptr token = IntPtr.Zero;
token = LogonUserUsingInterop(userNmae, encryptedPassword);
WindowsImpersonationContext ctx =
WindowsIdentity.Impersonate(token);. QUESTION 34
You are developing an application for a client residing in Hong Kong.
You need to display negative currency values by using a minus sign. Which code
segment should you use? A. NumberFormatInfo culture =
new CultureInfo("zh-HK").NumberFormat;
culture.NumberNegativePattern = 1;
return numberToPrint.ToString("C", culture); B. NumberFormatInfo culture =
new CultureInfo("zh-HK").NumberFormat;
culture.CurrencyNegativePattern = 1;
return numberToPrint.ToString("C", culture); C. CultureInfo culture =
new CultureInfo("zh-HK");
return numberToPrint.ToString("()", culture); D. CultureInfo culture =
new CultureInfo("zh-HK");
return numberToPrint.ToString("()", culture);. QUESTION 35
You need to write a code segment that will create a common language runtime (CLR)
unit of isolation within an application. Which code segment should you use? A. AppDomainSetup mySetup = AppDomain.CurrentDomain.SetupInformation;
mySetup.ShadowCopyFiles = "true"; B. System.Diagnostics.Process myProcess;
myProcess = new System.Diagnostics.Process(); C. AppDomain domain;
domain = AppDomain.CreateDomain("CertKillerDomain"); D. System.ComponentModel.Component my Component;
myComponent = new System.ComponentModel.Component();. QUESTION 36
You are developing an application that dynamically loads assemblies from an application
directory.
You need to write a code segment that loads an assembly named Certkiller 1.dll into the
current application domain. Which code segment should you use? A. Dim domain As AppDomain = AppDomain.CurrentDomain
Dim myPath As String = _ Path.Combine(domain.BaseDirectory, " Certkiller 1.dll")
Dim asm As [Assembly] = [Assembly].LoadFrom(myPath) B. Dim domain As AppDomain = AppDomain.CurrentDomain
Dim myPath As String = _ Path.Combine(domain.BaseDirectory, " Certkiller 1.dll")
Dim asm As [Assembly] = [Assembly].Load(myPath) C. Dim domain As AppDomain = AppDomain.CurrentDomain
Dim myPath As String = _ Path.Combine(domain.DynamicDirectory, " Certkiller 1.dll")
Dim asm As [Assembly] = _ AppDomain.CurrentDomain.Load(myPath) D. Dim domain As AppDomain = AppDomain.CurrentDomain
Dim asm As [Assembly] = domain.GetData(" Certkiller 1.dll"). QUESTION 37
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. Dim objStream As IsolatedStorageFileStreamobjStream = New
IsolatedStorageFileStream( _
"Settings.dat", FileMode.Open)
Dim result As String = New StreamReader(objStream).ReadToEnd B. Dim objFile As IsolatedStorageFileobjFile =
IsolatedStorageFile.GetMachineStoreForAssemblyDim objStream As
IsolatedStorageFileStreamobjStream = New IsolatedStorageFileStream( _
"Settings.dat", FileMode.Open, objFile)
Dim result As String = New StreamReader(objStream).ReadToEnd C. Dim objStream As IsolatedStorageFileStreamobjStream = New
IsolatedStorageFileStream( _
"Settings.dat", FileMode.Open)
Dim result As String objStream.toString D. Dim objFile As IsolatedStorageFileobjFile =
IsolatedStorageFile.GetMachineStoreForAssemblyDim objStream As
IsolatedStorageFileStreamobjStream = New IsolatedStorageFileStream( _
"Settings.dat", FileMode.Open, objFile)
Dim result As String = objStream.ToString. QUESTION 38
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? A. [OnSerializing]internal void UpdateValue (StreamingContext context) {
currRate = GetCurrentRate();
} B. [OnSerializing]internal void UpdateValue(SerializationInfo info) {
info.AddValue("currentRate", GetCurrentRate());
} C. [OnDeserializing]internal void UpdateValue(SerializationInfo info) {
info.AddValue("currentRate", GetCurrentRate());
} D. [OnDeserialized]internal void UpdateValue(StreamingContext context) {
currRate = GetCurrentRate();
}. QUESTION 39
You need to create a method to clear a Queue named q. Which code segment should you
use? A. foreach (object e in q) {
q.Dequeue();
} B. foreach (object e in q) {
Enqueue(null);
} C. q.Clear(); D. q.Dequeue();.
|