Exam 70-536 : .NET Framework Application Development Foundation Part – 14

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?

Correct Answer: 3


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

You need to define a methon prototype. Which code segment should you use?

  1. [DllImport(“user32”)]
    public static extern int MessageBox(int hWnd, String text, String caption, uint type);
  2. [DllImport(“user32”)]
    public static extern int MessageBoxA(int hWnd, String text, String caption, uint type);
  3. [DllImport(“user32”)]
    public static extern int Win32API_User32_MessageBox(int hWnd, String text, String caption, uint type);
  4. [DllImport(@”C:\WINDOWS\system32\user32.dll”)]
    public static extern int MessageBox(int hWnd, String text, String caption, uint type);

Correct Answer: 1


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?

Correct Answer: 2


Question: You need to call an unmanaged function from your managed code by using platform invoke services. What should you do?

  1. Create a class to hold DLL functions and then create prototype methods by using managed code.
  2. Register your assembly by using COM and then reference your managed code from COM.
  3. Export a type library for your managed code.
  4. Import a type library as an assembly and then create instances of COM object.

Correct Answer: 1


Question: 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?

  1. Evidence evidence = new Evidence(Assembly.GetExecutingAssembly().Evidence);
  2. Evidence evidence = new Evidence();
    evidence.AddAssembly(new Zone(SecurityZone.Intranet));
  3. Evidence evidence = new Evidence();
    evidence.AddHost(new Zone(SecurityZone.Intranet));
  4. Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence);

Correct Answer: 3

Tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.