Tuesday

LATEST 70-536 DUMPS PART 5 OF 10

                                          PART 5 OF 10(WITH EXPLANATION)


QUESTION 1

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; }
}}

Correct Answer: C



QUESTION 2

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.Deny();
C. set.Assert();
D. set.PermitOnly();

Correct Answer: A

Explanation: Demand forces all callers in the call stack to have the specified permission.
PermitOnly will instruct the runtime to reduce the access by only allowing callers with the permissions explicitly stated and nothing else.
Assert will ignore the permissions of callers and allow them indiscriminately.
Deny will explicitly deny access if the caller has the specified permission.

QUESTION 3

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

A. CompanyClass myClass = new CompanyClass();
Type t = typeof(CompanyClass);
MethodInfo m = t.GetMethod("MyMethod");
int i = (int)m.Invoke(this, new object[] { 1 });

B. CompanyClass myClass = new CompanyClass();
Type t = typeof(CompanyClass);
MethodInfo m = t.GetMethod("MyMethod");
int i = (int) m.Invoke(myClass, new object[] { 1 });

C. CompanyClass myClass = new CompanyClass();
Type t = typeof(CompanyClass);
MethodInfo m = t.GetMethod("CompanyClass.MyMethod");
int i = (int)m.Invoke(myClass, new object[] { 1 });

D. Type t = Type.GetType("CompanyClass");
MethodInfo m = t.GetMethod("MyMethod");
int i = (int)m.Invoke(this, new object[] { 1 });

Correct Answer: B

QUESTION 4

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);
}

Correct Answer: D

Explanation: Call Processes.GetProcesses() supplying the name of the computer and then iterate through the returned collection of processes adding the process name to the arraylist.

QUESTION 5

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 cipherMessage
The 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();
ICryptoTransform crypto = des.CreateDecryptor();
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();
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();
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();

D. 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();

Correct Answer: B

QUESTION 6

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();

Correct Answer: B

Explanation: Retrieve the IsolatedStorageFile for the machine store. Use an IsolatedStorageFileStream to read from the desired file within the machine store.

QUESTION 7

You are developing an assembly to access file system. Need to write a segment code to configure CLR stop loading the assembly if file permssion is absent.

A. [FileIOPermission(SecurityAction.RequestOptional, AllLocalFiles = FileIOPermissionAccess.Read)]

B. [FileIOPermission(SecurityAction.RequestMinimum, AllFiles = FileIOPermissionAccess.Read)]

C. [FileIOPermission(SecurityAction.RequestRefuse, AllFiles = FileIOPermissionAccess.Read)]

D. [FileIOPermission(SecurityAction.RequestOptional, AllFiles = FileIOPermissionAccess.Read)]

Correct Answer: B

QUESTION 8

Given the code like this:
while(!loop)
{
//Thread code here
Dowork();
}
You need to write more code to class to run DoWork() with 30-second intervals using minimum resources

A. Thread.Sleep(30000)
B. Thread.SpinWait(30000)
C. Thread.QueueUserWorkItem(30000)
D. Thread.SpinWait(30)

Correct Answer: A

QUESTION 9

You create an application for your business partners to submit purchase orders. The application deserializes XML documents sent by your partners into instances of an object named PurchaseOrder.
You need to modify the application so that it collects details if the deserialization process encounters any XML content that fails to map to public members of the PurchaseOrder object.

What should you do?

A. Define and implement an event handler for the XmlSerializer.UnknownNode event.
B. Define a class that inherits from XmlSerializer and overrides the XmlSerialize.FromMappings method.
C. Apply an XmlInclude attribute to the PurchaseOrder class definition.
D. Apply an XmlIgnore attribute to the PurchaseOrder class definition

Correct Answer: A

QUESTION 10

You are developing an application that will deploy by using ClickOnce. You need to test if the application executes properly. You need to write a method that returns the object, which prompts the user to install a ClickOnce application. Which code segment should you use?

A. return ApplicationSecurityManager.ApplicationTrustManager;
B. return AppDomain.CurrentDomain.ApplicationTrust;
C. return new HostSecurityManager();
D. return SecurityManager.PolicyHierarchy();

Correct Answer: A

QUESTION 11

You need to write a code segment that will add a string named strConn to the connection string section of the
application configuration file. Which code segment should you use?

A. Configuration myConfig = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None);
myConfig.ConnectionStrings.ConnectionStrings.Add( new ConnectionStringSettings("ConnStr1",
strConn));
myConfig.Save();

B. Configuration myConfig =ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None);
myConfig.ConnectionStrings.ConnectionStrings.Add( new ConnectionStringSettings("ConnStr1",strConn));
ConfigurationManager.RefreshSection( "ConnectionStrings");

C. ConfigurationManager.ConnectionStrings.Add( new
ConnectionStringSettings("ConnStr1",strConn));
ConfigurationManager.RefreshSection( "ConnectionStrings");

D. ConfigurationManager.ConnectionStrings.Add( new
ConnectionStringSettings("ConnStr1",strConn));
Configuration myConfig = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None);
myConfig.Save();

Correct Answer: A

CLICK FOR PART 6 OF 10
CLICK FOR PART 1 OF 10

3 comments:

  1. It's worth
    Thanks for sharing with us
    Tech Ideas

    ReplyDelete
  2. Anonymous3:15 am

    Very nice! When do you post part 6-10?

    ReplyDelete
  3. Anonymous10:37 am

    Very nice. Please post the rest sections....

    ReplyDelete