| Braindumps
of 70-552
UPGRADE: MCAD Skills to MCPD
Windows
Developer by Using the Microsoft .NET Framework
Exam Questions, Answers,
Braindumps (70-552)
This braindump is provided
with ratings from different students. I used www.examcheets.com
study material and the exam was not a problem for
me.
Q:1 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)
Next
End 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.GetProcessesByName("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
Explanation: Process.GetProcessesByName() should be
used to return all the processes that match a process
name. The modules collection exposes all the modules
loaded by the process and can be added to an ArrayList.
A & B GetProcesses() accepts a computer name for
retrieving the processes on a remote computer. GetProcessesByName()
should be used to return processes by their name.
D the path of the process is not part of the process
name.
Q: 2 You need to write a code segment that transfers
the contents of a byte array named dataToSend by using
a NetworkStream object named netStream. You need to
use a cache of size 8,192 bytes. Which code segment
should you use?
A. Dim memStream As New MemoryStream(8192)memStream.Write(dataToSend,
0, _
CType(netStream.Length, Integer))
B. Dim memStream As New MemoryStream(8192)netStream.Write(dataToSend,
0, _
CType(memStream.Length, Integer))
C. Dim bufStream As New BufferedStream(netStream,
8192)
bufStream.Write(dataToSend, 0, dataToSend.Length)
D. Dim bufStream As New BufferedStream(netStream)
bufStream.Write(dataToSend, 0, 8192)
Answer: C
Explanation: To send data using a cache it is necessary
to use a BufferedStream.
The BufferedStream should be created with the cache
size of 8192 bytes.
A & B do not employ caching.
D does not correctly initialise the BufferedStream
to have a cache size of 8192 bytes.
Q:3 You are creating an undo buffer that stores data
modifications. You need to ensure that the undo functionality
undoes the most recent data modifications first. You
also need to ensure that the undo buffer permits the
storage of strings only. Which code segment should
you use?
A. Dim undoBuffer As New Stack(Of String)
B. Dim undoBuffer As New Stack()
C. Dim undoBuffer As New Queue(Of String)
D. Dim undoBuffer As New Queue()
Answer: A
Explanation: A Stack caters for a last in first out
scenario similar to what is required in an undo buffer.
By using Generics you can force a strongly typed collection
that takes strings only.
B is not strongly typed for strings, it will take
any type of object.
C & D Queue is a First in First out collection,
it is not appropriate in this instance.
Q:4 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. Dim objEvidence As New Evidence( _
Assembly.GetExecutingAssembly.Evidence.
B. Dim objEvidence As New EvidenceobjEvidence.AddAssembly(
_
New Zone(SecurityZone.Intranet))
C. Dim objEvidence As New EvidenceobjEvidence.AddHost(
_
New Zone(SecurityZone.Intranet))
D. Dim objEvidence As New Evidence( _
AppDomain.CurrentDomain.Evidence)
Answer: C
Explanation: Use the evidence.AddHost method to add
Zone evidence.
A simply gets the evidence of the Executing Assembly
and assigns it to a new object, the question explicitly
wants Intranet zone evidence.
B Adds assembly evidence, the question asks for host
evidence because it is concerned with where the assembly
was loaded from.#
D does not create an Evidence object with Intranet
zone evidence.
Q: 5 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) = False Then
Throw New Exception("Could not authenticate user")
End If
Dim RolesArray() As String = LookUpUserRoles(UserName)
You need to complete this code so that it establishes
the user security context. Which code segment should
you use?
A. Dim objID As New GenericIdentity(UserName)
Dim objUser As New GenericPrincipal(objID, RolesArray)
Thread.CurrentPrincipal = objUser
B. Dim objID As New WindowsIdentity(UserName)
Dim objUser As New WindowsPrincipal(objID)
Thread.CurrentPrincipal = objUser
C. Dim objNT As New NTAccount(UserName)
Dim objID As New GenericIdentity(objNT.Value)
Dim objUser As New GenericPrincipal(objID, RolesArray)
Thread.CurrentPrincipal = objUser
D. Dim objToken As IntPtr = IntPtr.Zeroobj
Token = LogonUserUsingInterop(UserName, EncryptedPassword)
Dim objContext As WindowsImpersonationContext =_
WindowsIdentity.Impersonate(objToken)
Answer: A
Explanation: Because the application storing the credentials,
the GenericIdentity & GenericPrincipal classes
should be used instead of the WindowsIdentity\Pricipal
classes.
B uses WindowsIdentity & WindowsPrincipal
C incorrectly uses NTAccount to initialise a GenericPrincipal.
GenericPrincipal requires an implementation of IIdentity.
D the WindowsIdentity.Impersonate() is used for running
code in the context of another user. Impersonation
is not what is required.
70-552
|