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
Q#80 – Q#99
Question: 80
You work as a developer at Company.com. You are developing an application to create a new file on the local file system.
You need to define specific security settings for the file. You must deny the file inheritance of any default security settings.
What should you do?
Answer: ?
K8 – not so good of a question. No answers or answer.
Question: 81
You are creating a class to compare a specially-formatted string. The default collation comparisons do not apply. You need to implement the IComparable(Of String) interface. Which code segment should you use?
A. Public Class Person
Implements IComparable(Of String)Public Function CompareTo(ByVal other As String)
As _Integer Implements IComparable(Of String).CompareTo...End FunctionEnd Class
B. Public Class Person
Implements IComparable(Of String)Public Function CompareTo(ByVal other As Object)
As _Integer Implements IComparable(Of String).CompareTo...End FunctionEnd Class
C. Public Class Person
Implements IComparable(Of String)Public Function CompareTo(ByVal other As String)
_As Boolean Implements IComparable(Of String).CompareTo...End FunctionEnd Class
D. Public Class Person
Implements IComparable(Of String)Public Function CompareTo(ByVal other As Object)
_As Boolean Implements IComparable(Of String).CompareTo...End FunctionEnd Class
Answer: A
K8 – String & IComparable as int
Question: 82
You work as a developer at Company.com. You create a service application that monitors free space on a hard disk drive. You must ensure that the service application runs in the background and monitors the free space every minute.
What should you do?
Answer:
K8 – Another not so good question no answers
Question: 83
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();}
Answer: D
K8 – question reads when instance of class is deserialized. Answer is OnDeserialized
Question: 84
You need to write a multicast delegate that accepts a DateTime argument. Which code segment should you use?
A. Public Delegate Function PowerDeviceOn( _
ByVal result As Boolean, _
ByVal autoPowerOff As DateTime) _
As Integer
B. Public Delegate Function PowerDeviceOn( _
ByVal sender As Object, _
ByVal autoPowerOff As EventArgs) _
As Boolean
C. Public Delegate Sub PowerDeviceOn( _
ByVal autoPowerOff As DateTime)
D. Public Delegate Function PowerDeviceOn( _
ByVal autoPowerOff As DateTime) _
As Boolean
Answer: C
K8 – c is the only Sub not a function isn’t that something?
Question: 85
You create a class library that is used by applications in three departments of your company. The library contains a Department class with the following definition. public
ref class Department {
public :
String^ name;
String^ manager;}; Each application uses a custom configuration section to store
department-specific values in the application configuration file as shown in the following
code.
<Department>
<name>Hardware</name>
<manager>Company</manager>
</Department>
You need to write a code segment that creates a Department object instance by using the field values retrieved from the application configuration file. Which code segment should you use?
A. public ref class deptElement : public ConfigurationElement {
protected :
override void DeserializeElement(XmlReader^ reader,
bool^ serializeCollectionKey) {
Department^ dept = gcnew Department();
dept->name = ConfigurationManager::AppSettings[“name”];
dept->manager = ConfigurationManager::AppSettings[“manager”];
return dept; }};
B. public ref class deptElement : public ConfigurationElement {
protected :
override void DeserializeElement(XmlReader^ reader,
bool^ serializeCollectionKey) {
Department^ dept = gcnew Department();
dept->name = reader->GetAttribute(“name”);
dept->manager = reader->GetAttribute(“manager”); }};
C. public ref class deptHandler :
public IConfigurationSectionHandler {
public :
Object^ Create(Object^ parent, Object^ configContext,
System.Xml.XmlNode section) {
Department^ dept = gcnew Department();
dept->name = section->SelectSingleNode(“name”)->InnerText;
dept->manager = section->SelectSinglenode(“manager”)->InnerText;
return dept; }};
D. public ref class deptHandler : public IConfigurationSectionHandler {
public :
Object^ Create(Object^ parent, Object^ configContext,
System.Xml.XmlNode^ section) {
Department^ dept = gcnew Department();
dept->name = section->Attributes[“name”].Value;
dept->manager = section->Attributes[“manager”].Value;
return dept; }};
Answer: C
K8 – IconfigurationSectionHandler
Question: 86
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
K8 – ReadToEnd Now that I’ve seen this question a few times it gets easier.
Question: 87
You write the following code to call a function from the Win32 Application Programming Interface (API) by using platform invoke.
Dim r As Integer = MessageBox(hWnd, strText, strCaption, strType)
You need to define a method prototype. Which code segment should you use?
A. <DllImport("user32")> _Function MessageBox( _
ByVal hWnd As IntPtr, ByVal text As String, _
ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function
B. <DllImport("user32")> _Function MessageBoxA( _
ByVal hWnd As IntPtr, ByVal text As String, _
ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function
C. <DllImport("user32")> _Function Win32API_User32_MessageBox ( _
ByVal hWnd As IntPtr, ByVal text As String, _
ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function
D. <DllImport("C:\WINDOWS\system32\user32.dll ")> _Function MessageBox( _
ByVal hWnd As IntPtr, ByVal text As String, _
ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function
Answer: A
K8 – User32 & function messagebox
Question: 88
You are writing an application that uses isolated storage to store user preferences. The application uses multiple assemblies. Multiple users will use this application on the same
computer. You need to create a directory named Preferences in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly. Which code segment should you use?
A. IsolatedStorageFile^ store;store = IsolatedStorageFile::GetUserStoreForAssembly();store-
>CreateDirectory(“Preferences”);
B. IsolatedStorageFile^ store;store =
IsolatedStorageFile::GetMachineStoreForAssembly();store->CreateDirectory(“Preferences”);
C. IsolatedStorageFile^ store;store = IsolatedStorageFile::GetUserStoreForDomain();store-
>CreateDirectory(“Preferences”);
D. IsolatedStorageFile^ store;store =
IsolatedStorageFile::GetMachineStoreForApplication();store-
>CreateDirectory(“Preferences”);
Answer: A
K8 – GetUserStoreForAssembly
Question: 89
You are writing an application that uses isolated storage to store user preferences. The application uses multiple assemblies. Multiple users will use this application on the same
computer. You need to create a directory named Preferences in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly. Which code segment should you use?
A. IsolatedStorageFile store;store =
IsolatedStorageFile.GetUserStoreForAssembly();store.CreateDirectory(“Preferences”);
B. IsolatedStorageFile store;store =
IsolatedStorageFile.GetMachineStoreForAssembly();store.CreateDirectory(“Preferences”);
C. IsolatedStorageFile store;store =
IsolatedStorageFile.GetUserStoreForDomain();store.CreateDirectory(“Preferences”);
D. IsolatedStorageFile store;store =
IsolatedStorageFile.GetMachineStoreForApplication();store.CreateDirectory(“Preferences”);
Answer: A
K8 - GetUserStoreForAssembly
Question: 90
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)]
Answer: A
K8 – Demand to ensure all callers have required level of trust
Question: 91
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::WriteLinelf(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 - WriteLinelf
Question: 92
Your company 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>
Answer: A
K8 – set supportedRuntime version="1.1.4322"
Question: 93
You are developing a method that searches a string for a substring. The method will be localized to Italy. Your method accepts the following parameters: The string to be searched, which is named searchListThe string for which to search, which is named searchValue You need to write the code. Which code segment should you use?
A. return searchList->IndexOf(searchValue);
B. CompareInfo^ comparer =
gcnew CultureInfo(“it-IT”)::CompareInfo; return comparer->Compare(searchList, search Value);
C. CultureInfo^ comarer = gcnew CultureInfo(“it-IT”);
if (searchList->IndexOf(searchValue) > 0) {
return true;} else {
return false;}
D. CompareInfo^ comparer = gcnew CultureInfo(“it-IT”)::CompareInfo;
if (comparer->IndexOf(searchList, searchValue) > 0) {
return true;
} else {
return false;}
Answer: D
K8 – Method that searches string for substring CompareInfo IndexOf
Question: 94
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::SetuupInformation;
mySetup->ShadowCopyFiles = “true”;
B. System::Diagnostics::Process^ myProcess;
myProcess = gcnew System::Diagnostics::Process();
C. AppDomain^ domain;
domain = AppDomain::CreateDomain(“CompanyDomain”);
D. System::ComponentModel::Component^ myComponent;
myComponent = gcnew
System::ComponentModel::Component();
Answer: C
K8 – CLR isolation Appdomaion CreateDomain
Question: 95
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 = new Evidence(
Assembly.GetExecutingAssembly().Evidence );
B. Evidence evidence = new Evidence();
evidence.AddAssembly(new Zone(SecurityZone.Intranet));
C. Evidence evidence = new Evidence()
;evidence.AddHost(new Zone(SecurityZone.Intranet));
D. Evidence evidence = new Evidence(
AppDomain.CurrentDomain.Evidence );
Answer: C
K8 – Loading Assembly use AddHost along with the Zone(SecurityZone.Intranet)
Question: 96
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?
A. CodeAccessPermission.RevertAssert();
B. CodeAccessPermission.RevertDeny();
C. permission.Deny();
D. permission.PermitOnly();
Answer: A
K8 question text Cancel Assertion - Answer RevertAssert();
Question: 97
You are changing the security settings of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use?
A. Dim objSecurity As New FileSecurity( _
"MyData.xml", AccessControlSections.All)objSecurity.SetAccessRuleProtection(True, True)File.SetAccessControl("MyData.xml", objSecurity)
B. Dim objSecurity As New FileSecurity()objSecurity.SetAccessRuleProtection(True,
True)File.SetAccessControl("MyData.xml", objSecurity)
C. Dim objSecurity As FileSecurity = _File.GetAccessControl("MyData.xml")objSecurity.SetAccessRuleProtection(True, True)
D. Dim objSecurity As FileSecurity =
_File.GetAccessControl("MyData.xml")objSecurity.SetAuditRuleProtection(True, True)File.SetAccessControl("myData.xml", objSecurity)
Answer: A
K8 – Q: prevent the access rules from inheriting changes A: SetAccessRuleProtection
Question: 98
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 void StartService(string serverName){
02 ServiceController crtl = new
03 ServiceController(“FileService”);
04 if (crtl.Status == ServiceControllerStatus.Stopped){
05 }
06 }
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
Q: need to start if stopped therefore E & MachineName in B will start it on the serverName
Question: 99
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" Then
Debug.Print("Test Failed: ")
Debug.Print(fName)End If
D. If fName <> "Company" Then
Debug.WriteLine("Test Failed: ")
Debug.WriteLine(fName)End If
Answer: B
K8 – WriteLineIf prints the message if
No comments:
Post a Comment