Hey Now,
Please feel free to check out my MCTS 70-536 reference page on Chris Catto.com. It’s a page with a summary of all of my posts.
As I study for this test I thought this would be good to post on to learn the content & others would be able to view & comment on it.
This content below is from some practice questions from the internet & not sure the answers are correct. There were over 200 questions & some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments.
Thx,
Catto
#151 - #166
Question: 151
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. Dim al As New ArrayList()Dim procs As Process() = _
Process.GetProcessesByName(strComputer)Dim proc As ProcessFor Each proc In procs
al.Add(proc)Next
B. Dim al As New ArrayList()Dim procs As Process() =
Process.GetProcesses(strComputer)
Dim proc As ProcessFor Each proc In procs
al.Add(proc)Next
C. Dim al As New ArrayList()Dim procs As Process() = _
Process.GetProcessesByName(strComputer)Dim proc As ProcessFor Each proc In procs
al.Add(proc.ProcessName)Next
D. Dim al As New ArrayList()Dim procs As Process() =
Process.GetProcesses(strComputer)
Dim proc As ProcessFor Each proc In procs
al.Add(proc.ProcessName)Next
Answer: D
K8 – Q: Retrieves each process A: GetPRocesses & add proc.ProcessName
Question: 152
You are writing a method that returns an ArrayList named al. You need to ensure that changes to the ArrayList are performed in a thread-safe manner. Which code segment should you use?
A. Dim al As ArrayLis t = New ArrayList()
SyncLock al.SyncRoot
Return alEnd SyncLock
B. Dim al As ArrayList = New ArrayList()
SyncLock al.SyncRoot.GetType()
Return alEnd SyncLock
C. Dim al As ArrayList = New
ArrayList()Monitor.Enter(al)Monitor.Exit(al)Return al
D. Dim al As ArrayList = New ArrayList()
Dim sync_al as ArrayList = ArrayList.Synchronized(al)
Return sync_al
Answer: D
K8 – Q: return ArrayList AL in thread safe mannor A: Synchronized(AL)
Question: 153
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
K8 – BitVector32(-1) Q: minimize memory used the right type needs to be selected.
Question: 154
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 ref class Age {
public : Int32 Value;
public : virtual Object CompareTo(Object^ obj) {
if (obj->GetType() == Age::GetType()) {
Age^ _age = (Age^) obj;
return Value.CompareTo(obj);
}
throw gcnew ArgumentException(“object not an Age”);
}};
B. public ref class Age {
public : Int32 Value;
public : virtual Object CompareTo(Int32^ iValue) {
try {
return Value.CompareTo(iValue);
} catch (Exception^ ex) {
throw gcnew ArgumentException(“object not an Age”);
}
}};
C. public ref class Age : public IComparable {
public : Int32 Value;
public : virtual Int32 CompareTo(Object^ obj) {
if (obj->GetType() == Age::GetType()) {
Age^ _age = (Age^) obj;
return Value.CompareTo(_age->Value);
}
throw gcnew ArgumentException(“object not an Age”);
}};
D. public ref class Age : public IComparable {
public : Int32 Value;
public : virtual Int32 CompareTo(Object^ obj) {
try {
return Value.CompareTo(((Age^) obj)->Value);
} catch (Exception^ ex) {
return -1;
}
}};
Answer: C
K8 – Q: Sorting Objects A: IComparable to need to for try/catch
Question: 155
You are developing a server application that will transmit sensitive information on a network. You create an X509Certificate object named certificate and a TcpClient object named client. You need to create an SslStream to communicate by using the Transport Layer Security 1.0 protocol. Which code segment should you use?
A. Dim objSSL As New
SslStream(client.GetStream)objSSL.AuthenticateAsServer(certificate, False, _
SslProtocols.None, True)
B. Dim objSSL As New
SslStream(client.GetStream)objSSL.AuthenticateAsServer(certificate, False, _
SslProtocols.Ssl3, True)
C. Dim objSSL As New
SslStream(client.GetStream)objSSL.AuthenticateAsServer(certificate, False, _
SslProtocols.Ssl2, True)
D. Dim objSSL As New
SslStream(client.GetStream)objSSL.AuthenticateAsServer(certificate, False, _
SslProtocols.Tls, True)
Answer: D
K8 – Q: Transport Layer Security A: SslProtocols.TLS
Question: 156
You are using the Microsoft Visual Studio 2005 IDE to examine the output of a method that returns a string. You assign the output of the method to a string variable named fName. You need to write a code segment that prints the following on a single line The message: "Test Failed: " The value of fName if the value of fName does not equal "Company" You also need to ensure that the code segment simultaneously facilitates uninterrupted execution of the application. Which code segment should you use?
A. Debug.Assert(fName == “Company”, “Test Failed: ”, fName);
B. Debug.WriteLineIf(fName != “Company”, fName, “Test Failed”);
C. if (fName != "Company") {
Debug.Print(“Test Failed: ”);
Debug.Print(fName);
}
D. if (fName != "Company") {
Debug.WriteLine(“Test Failed: ”);
Debug.WriteLine(fName);
}
Answer: B
K8 - Q: Write a line for a condition A: WriteLineIf
Question: 157
You are creating a new security policy for an application domain. You write the following lines of code.
PolicyLevel ^policy = PolicyLevel::CreateAppDomainLevel();
PolicyStatement ^noTrustStatement =
gcnew PolicyStatement(
policy->GetNamedPermissionSet(“Nothing”));
PolicyStatement ^fullTrustStatement = gcnew PolicyStatement(
policy->GetNamedPermissionSet(“FullTrust”));
You need to arrange code groups for the policy so that loaded assemblies default to the Nothing permission set. If the assembly originates from a trusted zone, the security policy must grant the assembly the FullTrust permission set. Which code segment should you use?
A. CodeGroup ^group1 = gcnew FirstMatchCodeGroup(
gcnew ZoneMembershipCondition(SecurityZone::Trusted),
fullTrustStatement); CodeGroup ^group2 = gcnew UnionCodeGroup(
gcnew AllMembershipCondition(),
noTrustStatement); group1->AddChild(group2);
B. CodeGroup ^group1 = gcnew FirstMatchCodeGroup(
gcnew AllMembershipCondition(),
noTrustStatement);
CodeGroup ^group2 = gcnew UnionCodeGroup(
gcnew ZoneMembershipCondition(SecurityZone::Trusted),
fullTrustStatement);
group1->AddChild(group2);
C. CodeGroup ^group = gcnew UnionCodeGroup(
gcnew ZoneMembershipCondition(SecurityZone::Trusted),
fullTrustStatement);
D. CodeGroup ^group = gcnew FirstMatchCodeGroup(
gcnew AllMembershipCondition(),
noTrustStatement);
Answer: B
K8 - Q: 2 Code Group 1st no trust 2nd full trust
Question: 158
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?
A. AppDomain domain = AppDomain.CurrentDomain;
domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
B. AppDomain domain = AppDomain.CurrentDomain;
domain.SetThreadPrincipal(new WindowsPrincipal(null));
C. AppDomain domain = AppDomain.CurrentDomain;
domain.SetAppDomainPolicy(
PolicyLevel.CreateAppDomainLevel());
D. AppDomain domain = AppDomain.CurrentDomain;
domain.SetPrincipalPolicy(
PrincipalPolicy.UnauthenticatedPrincipal);
Answer: D
K8 – Q: Assign unauthenticated Principal Object
A: SetPrincipalPolicy
Question: 159
You are testing a method that examines a running process. This method returns an ArrayList containing the name and full path of all modules that are loaded by the process. You need to list the modules loaded by a process named C:\TestApps\Process1.exe.
Which code segment should you use?
A. Dim ar As New ArrayList()
Dim procs As Process()Dim modules As ProcessModuleCollectionprocs = Process.GetProcesses("Process1")If procs.Length > 0
Thenmodules = procs(0).Modules
For Each pm As ProcessModule In Modules
ar.Add(pm.ModuleName)
NextEnd If
B. Dim ar As New ArrayList()
Dim procs As Process()
Dim modules As ProcessModuleCollectionprocs = Process.GetProcesses("C:\TestApps\Process1.exe")If
procs.Length > 0 Thenmodules = procs(0).Modules
For Each pm As ProcessModule In Modules
ar.Add(pm.ModuleName)
Next End If
C. Dim ar As New ArrayList()
Dim procs As Process()
Dim modules As ProcessModuleCollectionprocs = Process.GetProcesses ByName("Process1")If
procs.Length > 0 Thenmodules = procs(0).Modules
For Each pm As ProcessModule In Modules
ar.Add(pm.FileName)
Next End If
D. Dim ar As New ArrayList()Dim procs As Process()Dim modules As
ProcessModuleCollectionprocs =
_Process.GetProcessesByName("C:\TestApps\Process1.exe")If procs.Length > 0
Thenmodules = procs(0).Modules
For Each pm As ProcessModule In Modules
ar.Add(pm.FileName)
Next End If
Answer: C
K8 - Q: process1.exe A: pm.filename
Question: 160
You are writing a method that accepts a string parameter named message. Your method must break the message parameter into individual lines of text and pass each line to a second method named Process. Which code segment should you use?
A. StringReader^ reader = gcnew
StringReader(message);
Process(reader->ReadToEnd());
reader->Close();
B. StringReader^ reader = gcnew StringReader(message);
while(reader->Peak() != -1) {
String^ line = reader->Read().ToString();
Process(line);
}reader->Close();
C. StringReader^ reader = gcnew
StringReader(message);
Process(reader->ToString());
reader->Close();
D. StringReader^ reader = gcnew StringReader(message);
while(reader->Peak() != -1) {
Process(reader->ReadLine());
}reader->Close();
Answer: D
K8 – Q: string broken into lines of text A: Loop w/ While & ReadLine()
Question: 161
You write the following custom exception class named CustomException.
public ref class CustomException : ApplicationException {public:
literal int COR_E_ARGUMENT = (int)0x80070057;
CustomException(String^ msg) : ApplicationException(msg)
{
HResult = COR_E_ARGUMENT;
}};
You need to write a code segment that will use the CustomException class to immediately return control to the COM caller. You also need to ensure that the caller has access to the error code. Which code segment should you use?
A. return Marshal::GetExceptionForHR(
CustomException::COR_E_ARGUMENT);
B. return CustomException::COR_E_ARGUMENT;
C. Marshal::ThrowExceptionForHR(
CustomException::COR_E_ARGUMENT);
D. throw gcnew CustomException(“Argument is out of bounds”);
Answer: D
K8 – Q: Immediatley return control to COM A: throw an exception
Question: 162
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 = gcnew AssemblyName();
myAssemblyName->Name = “MyAssembly”;
AssemblyBuilder myAssemblyBuilder =
AppDomain::CurrentDomain->DefineDynamicAssembly(
myAssemblyName, AssemblyBuilderAccess::Run);
myAssemblyBuilder->Save(“MyAssembly.dll”);
B. AssemblyName^ myAssemblyName = gcnew
AssemblyName();
myAssemblyName->Name = “MyAssembly”;
AssemblyBuilder myAssemblyBuilder =
AppDomain::CurrentDomain->DefineDynamicAssembly(
myAssemblyName, AssemblyBuilderAccess::Save);
myAssemblyBuilder->Save(“MyAssembly.dll”);
C. AssemblyName^ myAssemblyName = gcnew AssemblyName();
AssemblyBuilder myAssemblyBuilder =
AppDomain::CurrentDomain->DefineDynamicAssembly(
myAssemblyName,
AssemblyBuilderAccess::RunAndSave);
myAssemblyBuilder->Save(“MyAssembly.dll”);
D. AssemblyName^ myAssemblyName =
gcnew AssemblyName(“MyAssembly”);
AssemblyBuilder^ myAssemblyBuilder =
AppDomain::CurrentDomain->DefineDynamicAssembly(
myAssemblyName,
AssemblyBuilderAccess::Save);
myAssemblyBuilder->Save(“c:\\MyAssembly.dll”);
Answer: B
K8 – Q: Create & Save Assembly A: AssemblyBuilderAccess::Save
Question: 163
You write a class named Employee that includes the following code segment. public class
Employee {
string employeeId, employeeName, jobTitleName;
public string GetName() { return employeeName; }
public string GetTitle() { return jobTitleName; }
You need to expose this class to COM in a type
library. The COM interface must also facilitate forward-compatibility across new versions of the Employee class. You need to choose a method for generating the COM interface. What should you do?
A. Add the following attribute to the class
definition.[ClassInterface(ClassInterfaceType.None)]public class Employee {
B. Add the following attribute to the class
definition.[ClassInterface(ClassInterfaceType.AutoDual)]public class Employee {
C. Add the following attribute to the class definition.[ComVisible(true)]public class Employee {
D. Define an interface for the class and add the following attribute to the class
definition.[ClassInterface(ClassInterfaceType.None)]public class Employee : IEmployee
{
Answer: D
K8 – Q: ? A: ClasInterfaceType.None & IEmployee
Question: 164
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. BitVector32^ answers = gcnew BitVector32(1);
B. BitVector32^ answers = gcnew BitVector32(-1);
C. BitArray^ answers = gcnew BitArray(1);
D. BitArray^ answers = gcnew BitArray(-1);
Answer: B
K8 – Q: mem & Init all to True A: True so -1 & BitVector32 for mem.
Question: 165
You need to write a multicast delegate that accepts a DateTime argument and returns a Boolean value. Which code segment should you use?
A. public delegate int PowerDeviceOn(bool,
DateTime);
B. public delegate bool PowerDeviceOn(Object,
EventArgs);
C. public delegate void PowerDeviceOn(DateTime);
D. public delegate bool PowerDeviceOn(DateTime);
Answer: A
K8 – Q: Delagate Accepts DateTime Returns Bool
A: delegate int PowerDeviceOn(bool, DateTime);
Question: 166
You are developing a server application that will transmit sensitive information on a network. You create an X509Certificate object named certificate and a TcpClient object named client. You need to create an SslStream to communicate by using the Transport Layer Security 1.0 protocol. Which code segment should you use?
A. SslStream^ ssl = gcnew
SslStream(Client->GetStream());ssl->AuthenticateAsServer(certificate, false,
SslProtocols::None, true);
B. SslStream ^ssl = gcnew
SslStream(Client->GetStream());ssl->AuthenticateAsServer(certificate, false,
SslProtocols::SSl3, true);
C. SslStream ^ssl = gcnew
SslStream(Client->GetStream());ssl->AuthenticateAsServer(certificate, false,
SslProtocols::SSl2, true);
D. SslStream ^ssl = gcnew
SslStream(Client->GetStream());ssl->AuthenticateAsServer(certificate, false, SslProtocols::Tls,
true);
Answer: D
K8 – I’ve seen this question enough to know TLS Transport Layer Security
No comments:
Post a Comment