1. Question: 

    You write the following code to implement the MyClass.MyMethod function.

    public class MyClass {

    public int MyMethod(int arg) {

    return arg;

    }

    }

    You need to call the MyClass.MyMethod function dynamically from an unrelated class in your assembly.

    Which code segment should you use?

    A
    MyClass= myClass = gcnew MyClass();
    Type= t = MyClass::typeid;
    MethodInfo= m = t->GetMethod("MyMethod");
    int i =
    "A Composite Solution With Just One Click" - Certification Guaranteed 231 Microsoft 70-536 Exam (int)m->Invoke(this, gcnew array<Object=> { 1 });

    B
    Type= t = Type::GetType("MyClass");
    MethodInfo= m = t->GetMethod("MyMethod");
    int i =
    (int)m->Invoke(this, gcnew array<Object=> { 1 });

    C
    MyClass= myClass = gcnew MyClass();
    Type= t = MyClass::typeid;
    MethodInfo= m = t->GetMethod("MyMethod");
    int i =
    (int)m->Invoke(myClass, gcnew array<Object=> { 1 });

    D
    MyClass= myClass = gcnew MyClass();
    Type= t = MyClass::typeid;
    MethodInfo= m = t->GetMethod("MyClass.MyMethod");
    int i =
    (int)m->Invoke(myClass, gcnew array<Object=> { 1 });

    Note: Not available
    1. Report
  2. Question: You are developing a method to hash data for later verification by using the MD5 algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using MD5. You also need to place the result into a byte array. Which code segment should you use?

    A
    HashAlgorithm algo = HashAlgorithm.Create("MD5");
    byte[] hash = null;
    algo.TransformBlock(message, 0, message.Length, hash, 0);

    B
    HashAlgorithm algo;
    algo = HashAlgorithm.Create(message.ToString());
    byte[] hash = algo.Hash;

    C
    HashAlgorithm algo = HashAlgorithm.Create("MD5");
    byte[] hash = algo.ComputeHash(message);

    D
    HashAlgorithm algo = HashAlgorithm.Create("MD5");
    byte[] hash = BitConverter.GetBytes(algo.GetHashCode());

    Note: Not available
    1. Report
  3. Question: 

    You write the following code to call a function from the Win32 Application Programming Interface (API) by using platform invoke.

    int rc = MessageBox(hWnd, text, caption, type);

    You need to define a method prototype.

    Which code segment should you use?

    A
    [DllImport("C:\\WINDOWS\\system32\\user32.dll")]
    extern int MessageBox(int hWnd,
    String= text,
    String= caption, uint type);

    B
    [DllImport("user32")]
    extern int MessageBox(int hWnd,
    String= text,
    String= caption, uint type);

    C
    [DllImport("user32")]
    extern int MessageBoxA(int hWnd,
    String= text,
    String= caption, uint type);

    D
    [DllImport("user32")]
    extern int Win32API_User32_MessageBox(
    int hWnd, String= text, String= caption, uint type);

    Note: Not available
    1. Report
  4. 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))

    throw new Exception("could not authenticate user");

    String[] userRolesArray = LookupUserRoles(userName);

    You need to complete this code so that it establishes the user security context.

    Which code segment should you use?

    A
    NTAccount userNTName = new NTAccount(userName);
    GenericIdentity ident = new GenericIdentity(userNTName.Value); GenericPrincipal currentUser= new GenericPrincipal(ident, userRolesArray); Thread.CurrentPrincipal = currentUser;

    B
    IntPtr token = IntPtr.Zero;
    token = LogonUserUsingInterop(userName, encryptedPassword); WindowsImpersonationContext ctx =
    WindowsIdentity.Impersonate(token);

    C
    WindowsIdentity ident = new WindowsIdentity(userName); WindowsPrincipal currentUser = new WindowsPrincipal(ident); Thread.CurrentPrincipal = currentUser;

    D
    GenericIdentity ident = new GenericIdentity(userName); GenericPrincipal currentUser =
    new GenericPrincipal(ident, userRolesArray);
    Thread.CurrentPrincipal = currentUser;

    Note: Not available
    1. Report
  5. Question: You need to create a class definition that is interoperable along with COM. You need to ensure that COM applications can create instances of the class and can call the GetAddress method. Which code segment should you use?

    A
    public ref class Customer {
    string addressString;
    public:
    Customer(string address) : addressString(address) { } String= GetAddress() { return addressString; }
    }

    B
    public ref class Customer {
    string addressString;
    public:
    Customer() { }
    private:
    String= GetAddress() { return addressString; }
    }

    C
    public ref class Customer {
    string addressString;
    public:
    Customer() { }
    String= GetAddress() { return addressString; }
    }

    D
    public ref class Customer {
    static string addressString;
    public: Customer() { }
    static String= GetAddress() { return addressString; } }

    Note: Not available
    1. Report
  6. Question: 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->ReadToEnd();

    B
    String= result = nullptr;
    StreamReader= reader = gcnew StreamReader("Message.txt"); result = reader->ReadLine();

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

    Note: Not available
    1. Report
  7. Question: You are developing a utility screen for a new client application. The utility screen displays a thermometer that conveys the current status of processes being carried out by the application. You need to draw a rectangle on the screen to serve as the background of the thermometer as shown in the exhibit. The rectangle must be filled with gradient shading. (Click the Exhibit button.) Which code segment should you choose?

    A
    Rectangle= rectangle = gcnew Rectangle(10, 10, 450, 25); LinearGradientBrush= rectangleBrush = gcnew LinearGradientBrush(rectangle, Color::AliceBlue, Color::CornflowerBlue, LinearGradientMode::ForwardDiagonal);
    Pen= rectanglePen = gcnew Pen(rectangleBrush);
    Graphics= g = this->CreateGraphics();
    g->FillRectangle(rectangleBrush, rectangle);

    B
    RectangleF= rectangle = gcnew RectangleF(10f, 10f, 450f, 25f); SolidBrush= rectangleBrush =
    gcnew SolidBrush(Color::AliceBlue);
    Pen= rectanglePen = gcnew Pen(rectangleBrush);
    Graphics= g = this->CreateGraphics();
    g->DrawRectangle(rectangleBrush, rectangle);

    C
    Rectangle= rectangle = gcnew Rectangle(10, 10, 450, 25); LinearGradientBrush= rectangleBrush = gcnew LinearGradientBrush(rectangle, Color::AliceBlue, Color::CornflowerBlue, LinearGradientMode::ForwardDiagonal);
    Pen= rectanglePen = gcnew Pen(rectangleBrush);
    Graphics= g = this->CreateGraphics();
    g->DrawRectangle(rectanglePen, rectangle);

    D
    RectangleF= rectangle = gcnew RectangleF(10f, 10f, 450f, 25f); array= points = gcnew array= {gcnew Point(0, 0), gcnew Point(110, 145)};
    LinearGradientBrush= rectangleBrush =
    gcnew LinearGradientBrush(rectangle, Color::AliceBlue,
    Color::CornflowerBlue,
    LinearGradientMode::ForwardDiagonal);
    Pen= rectanglePen = gcnew Pen(rectangleBrush);
    Graphics= g = this->CreateGraphics();
    g->DrawPolygon(rectanglePen, points);

    Note: Not available
    1. Report
  8. Question: You need to write a multicast delegate that accepts a DateTime argument. Which code segment should you use?

    A
    public delegate void PowerDeviceOn(DateTime autoPowerOff);

    B
    public delegate bool PowerDeviceOn(DateTime autoPowerOff);

    C
    public delegate int PowerDeviceOn(bool result,
    DateTime autoPowerOff);

    D
    public delegate bool PowerDeviceOn(object sender,
    EventArgs autoPowerOff);

    Note: Not available
    1. Report
  9. Question: 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
    ArrayList al = new ArrayList();
    lock (al.SyncRoot){
    return al;
    }

    B
    ArrayList al = new ArrayList();
    ArrayList sync_al = ArrayList.Synchronized(al);
    return sync_al;

    C
    ArrayList al = new ArrayList();
    Monitor.Enter(al);
    Monitor.Exit(al);
    return al;


    D
    ArrayList al = new ArrayList();
    lock (al.SyncRoot.GetType()){
    return al;
    }

    Note: Not available
    1. Report
  10. Question: You need to generate a report that lists language codes and region codes. Which code segment should you use?

    A
    for each (CultureInfo= culture in CultureInfo::GetCultures(CultureTypes::SpecificCultures)) {
    // Output the culture information...
    }

    B
    for each (CultureInfo= culture in CultureInfo::GetCultures(CultureTypes::NeutralCultures)) {
    // Output the culture information...
    }

    C
    for each (CultureInfo= culture in CultureInfo::GetCultures(CultureTypes::ReplacementCultures)) {
    // Output the culture information...
    }

    D
    CultureInfo= culture = gcnew CultureInfo("");
    CultureTypes= types = culture->CultureTypes;
    // Output the culture information...

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