1. Question: You write the following class that has three methods.
    Public Class SimpleEmployee
    Private m_EmployeeId As String
    Private m_EmployeeName As String
    Private m_JobTitleName As String
    Public Function GetID() As String Return m_EmployeeID
    End Function
    Public Function GetName() As String Return m_EmployeeName
    End Function
    Public Function GetTitle() As String Return m_JobTitleName
    End Function
    End Class
    You need to expose the class to COM in a type library. The COM
    interface must not expose the method GetEmployeeId. The GetEmployeeId
    method must still be available to managed code. You need to hide the
    GetEmployeeID method from the COM interface. What should you do?

    A
    Apply the ComVisible attribute to the class and methods in the following manner.
    <ComVisible(False)> _
    Public Class SimpleEmployee
    Private m_EmployeeId As String
    Private m_EmployeeName As String
    Private m_JobTitleName As String
    Public Function GetID() As String
    Return m_EmployeeId
    End Function
    <ComVisible(True)> _
    Public Function GetName() As String
    Return m_EmployeeName
    End Function
    <ComVisible(True)> _
    Public Function GetTitle() As String
    Return m_JobTitleName
    End Function End Class

    B
    Apply the ComVisible attribute to the class and methods in the following manner.
    [ <ComVisible(True)> _ Public Class SimpleEmployee
    Private m_EmployeeId As String
    Private m_EmployeeName As String
    Private m_JobTitleName As String
    Public Function GetID() As String
    "A Composite Solution With Just One Click" - Certification Guaranteed 147 Microsoft 70-536 Exam Return m_EmployeeId
    End Function <ComVisible(True)> _
    Public Function GetName() As String
    Return m_EmployeeName
    End Function
    <ComVisible(True)> _
    Public Function GetTitle() As String
    Return m_JobTitleName
    End Function End Class

    C
    Apply the ComVisible attribute to the GetEmployeeId method in the following manner.
    Public Class SimpleEmployee
    Private m_EmployeeId As String
    Private m_EmployeeName As String
    Private m_JobTitleName As String
    <ComVisible(False)> _
     Public Function
    GetID() As String
    Return m_EmployeeID
    End Function Public Function GetName() As String
    Return m_EmployeeName
    End Function
    Public Function GetTitle() As String
    Return m_JobTitleName
    End Function End Class

    D
    Change the access modifier for the GetEmployeeId method in the following manner.
    Public Class SimpleEmployee
    Private m_EmployeeId As String
    Private m_EmployeeName As String
    Private m_JobTitleName As String
    Protected Function GetID() As String
    Return m_EmployeeID
    End Function
    Public Function GetName() As String
    Return m_EmployeeName
    End Function Public Function GetTitle() As String
    Return m_JobTitleName
    End Function End Class

    Note: Not available
    1. Report
  2. Question: You write the following custom exception class named CustomException.
    Public Class CustomException
    Inherits ApplicationException
    Public Shared COR_E_ARGUMENT As Int32 = &H80070057
    Public Sub New(ByVal strMessage As String)
    MyBase.New(strMessage)
    HResult = COR_E_ARGUMENT
    End Sub
    End Class
    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 CustomException.COR_E_ARGUMENT

    B
    Return Marshal.GetExceptionForHR( _ CustomException.COR_E_ARGUMENT)

    C
    Throw New CustomException("Argument is out of bounds")

    D
    Marshal.ThrowExceptionForHR( _ CustomException.COR_E_ARGUMENT)

    Note: Not available
    1. Report
  3. Question: You write the following code to implement the MyClass.MyMethod function.
    Public Class NewClass
    Public Function MyMethod(ByVal Arg As Integer) As Integer
    Return Arg
    End Function
    End Class
    You need to call the MyClass.MyMethod function dynamically from an unrelated class in your assembly.
    Which code segment should you use?

    A
    Dim objNewClass As New NewClass
    Dim objType As Type = objNewClass.GetType
    Dim objInfo As MethodInfo = _
    objType.GetMethod("MyMethod")
    Dim objParams() As Object = {1}
    Dim i As Integer = _
    DirectCast(objInfo.Invoke(Me, objParams), Integer)

    B
    Dim objNewClass As New NewClass
    Dim objType As Type = objNewClass.GetType
    Dim objInfo As MethodInfo = objType.GetMethod("MyMethod")
    Dim objParams() As Object = {1}
    Dim i As Integer = _
    DirectCast(objInfo.Invoke(objNewClass, objParams), Integer)

    C
    Dim objNewClass As New NewClass
    Dim objType As Type = objNewClass.GetType
    Dim objInfo As MethodInfo = _
    objType.GetMethod("NewClass.MyMethod")
    Dim objParams() As Object = {1}
    Dim i As Integer = _
    DirectCast(objInfo.Invoke(objNewClass, objParams), Integer)

    D
    Dim objType As Type = Type.GetType("NewClass")
    Dim objInfo As MethodInfo = objType.GetMethod("MyMethod")
    Dim objParams() As Object = {1} Dim i As Integer = _
    DirectCast(objInfo.Invoke(Me, objParams), Integer)

    Note: Not available
    1. Report
  4. Question: 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 Integer End Function

    B
    <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 Integer End 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 Integer End Function

    D
    <DllImport("user32")>_
    Function MessageBoxA( _
    ByVal hWnd As IntPtr, ByVal text As String, _
    ByVal Caption As String, ByVal t As UInt32) As Integer End Function

    Note: Not available
    1. Report
  5. Question: 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
    Dim objAssembly As New AssemblyName() objAssembly.Name = "MyAssembly" Dim objBuilder As AssemblyBuilder = _ AppDomain.CurrentDomain.DefineDynamicAssembly( _  objAssembly, AssemblyBuilderAccess.Save) objBuilder.Save("MyAssembly.dll")

    B
    Dim objAssembly As New AssemblyName() objAssembly.Name = "MyAssembly" Dim objBuilder As AssemblyBuilder = _ AppDomain.CurrentDomain.DefineDynamicAssembly( _ objAssembly, AssemblyBuilderAccess.Save) objBuilder.Save("c:\MyAssembly.dll")

    C
    Dim objAssembly As New AssemblyName() objAssembly.Name = "MyAssembly" Dim objBuilder As AssemblyBuilder = _ AppDomain.CurrentDomain.DefineDynamicAssembly( _ objAssembly, AssemblyBuilderAccess.Run) objBuilder.Save("MyAssembly.dll")

    D
    Dim objAssembly As New AssemblyName() objAssembly.Name = "MyAssembly" Dim objBuilder As AssemblyBuilder = _ AppDomain.CurrentDomain.DefineDynamicAssembly( _ objAssembly, AssemblyBuilderAccess.RunAndSave) objBuilder.Save("MyAssembly.dll")

    Note: Not available
    1. Report
  6. Question: 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 WindowsIdentity(UserName)
    Dim objUser As New WindowsPrincipal(objID)
    Thread.CurrentPrincipal = objUser

    B
    Dim objID As New GenericIdentity(UserName)
    Dim objUser As New GenericPrincipal(objID, RolesArray) Thread.CurrentPrincipal = objUser

    C
    Dim objToken As IntPtr = IntPtr.Zero
    objToken = LogonUserUsingInterop(UserName, EncryptedPassword) Dim objContext As WindowsImpersonationContext = _
    WindowsIdentity.Impersonate(objToken)

    D
    Dim objNT As New NTAccount(UserName)
    Dim objID As New GenericIdentity(objNT.Value)
    Dim objUser As New GenericPrincipal(objID, RolesArray) Thread.CurrentPrincipal = objUser

    Note: Not available
    1. Report
  7. Question: You create a DirectorySecurity object for the working directory. You
    need to identify the user accounts and groups that have read and write
    permissions. Which method should you use on the DirectorySecurity
    object?

    A
    the GetAuditRules method

    B
    the GetAccessRules method

    C
    the AccessRuleFactory method

    D
    the AuditRuleFactory method

    Note: Not available
    1. Report
  8. Question: 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.
    Dim objPermission As SocketPermission = New _
    SocketPermission(System.Security.Permissions.PermissionState.Unrestrict
    ed) objPermission.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
    objPermission.Deny()

    D
    objPermission.PermitOnly()

    Note: Not available
    1. Report
  9. Question: You create a method that runs by using the credentials of the end user. You need to use Microsoft Windows groups to authorize the user. You must add a code segment that identifies whether a user is in the local group named Clerk. Which code segment should you use?

    A
    Dim objUser As WindowsPrincipal = _
    DirectCast(Thread.CurrentPrincipal, WindowsPrincipal) Dim blnAuth As Boolean = _ objUser.IsInRole(Environment.MachineName)

    B
    Dim objUser As WindowsPrincipal = _
    DirectCast(Thread.CurrentPrincipal, WindowsPrincipal) Dim blnAuth As Boolean = objUser.IsInRole ("Clerk")

    C
    Dim objUser As GenericPrincipal = _
    DirectCast(Thread.CurrentPrincipal, GenericPrincipal) Dim blnAuth As Boolean = objUser.IsInRole
    ("Clerk")

    D
    Dim objUser As WindowsIdentity = WindowsIdentity.GetCurrent For Each objGroup As
    IdentityReference In objUser.Groups "A Composite Solution With Just One Click" - Certification
    Guaranteed 154 Microsoft 70-536 Exam
    Dim objNT As NTAccount = _
    DirectCast(objGroup.Translate( _
    Type.GetType("NTAccount")), NTAccount)
    Dim blnAuth As Boolean = objNT.Value.Equals( _
    Environment.MachineName & "\Clerk")
    If blnAuth Then Exit ForNext

    Note: Not available
    1. Report
  10. Question: 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
    Dim objDomain As AppDomain = AppDomain.CurrentDomain objDomain.SetAppDomainPolicy( _ PolicyLevel.CreateAppDomainLevel())

    B
    Dim objDomain As AppDomain = AppDomain.CurrentDomain objDomain.SetPrincipalPolicy( _ PrincipalPolicy.WindowsPrincipal)

    C
    Dim objDomain As AppDomain = AppDomain.CurrentDomain objDomain.SetPrincipalPolicy( _ PrincipalPolicy.UnauthenticatedPrincipal)

    D
    Dim objDomain As AppDomain = AppDomain.CurrentDomain objDomain.SetThreadPrincipal(New WindowsPrincipal(Nothing))

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd