Practice Questions

Question 1

After importing your favorite ActiveX control using the .NET Toolbox, you insert an instance of it as MyControl and need to manipulate a property named State . Which line of code should you use to set this property?

  • A. MyControl.CtlState = 1

  • B. MyControl.AxState = 1

  • C. MyControl.State = 1

  • D. CtlState.MyControl = 1

A1:

Answer A is correct. The State property will be renamed CtlState during the import process to avoid conflicting with the existing .NET property. Answer B is incorrect because the normal renaming method will result in a property named CtlState . Answer C is incorrect because State is a standard .NET property that requires the renaming of the import property to CtlState . Answer D is incorrect because the property specification must follow the name of the control, which is reversed here.

Question 2

Which of the following are reasons for using legacy code within .NET applications? [Select all that apply.]

  • A. Other developers may be continuing to develop COM and ActiveX elements.

  • B. Third-party components may use older technologies.

  • C. COM+ components may be faster than their .NET equivalents.

  • D. It is possible to migrate in stages.

A2:

Answers A, B, and D are correct. The ability to use legacy components in your .NET applications allows you to begin a staged migration while other developers continue using technologies they are more familiar with as well as to support third-partyprovided components. Answer C is incorrect because the use of the proxy wrapper between .NET code and encapsulated COM or COM+ components will generally cause legacy components to suffer a performance penalty compared to .NET components running within the CLR.

Question 3

Which of the following components can be made available to .NET code by using the Type Library Importer, tlbimp.exe ? [Select all correct answers.]

  • A. A COM component

  • B. An ActiveX control

  • C. A COM+ component

  • D. A Windows API call

A3:

Answers A and C are correct. Both COM and COM+ components may be converted into a format that is usable by your .NET application using the Type Library Importer. Answer B is incorrect because you use the ActiveX Importer, aximp.exe , to import ActiveX controls for use with .NET applications. Answer D is incorrect because you use the PInvoke facility to call the Windows API from .NET applications.

Question 4

Which of the following methods may be used to create a runtime-callable wrapper for a COM component? [Select all that apply.]

  • A. Placing the COM component directly on your form

  • B. Using the aximp.exe utility

  • C. Adding a direct reference to the COM component

  • D. Using the tlbimp.exe utility

A4:

Answers C and D are correct. You may create the necessary wrapper for a COM component by adding a reference to the COM component directly or by using the Type Library Importer utility ( tlbimp.exe ). Answer A is incorrect because COM components in general may not be placed directly on a form. Answer B is incorrect because the Windows Forms ActiveX Control Importer ( aximp.exe ) can only be used with ActiveX controls.

Question 5

Which one of the following statements is true regarding the inclusion of legacy components in your .NET application?

  • A. COM components cannot take advantage of the enhanced support provided by the CLR, whereas COM+ components can.

  • B. Legacy components cannot be used when their property names conflict with existing .NET properties.

  • C. Legacy components suffer performance loss due to the presence of the wrapper class.

  • D. Legacy component use is transparent to users within .NET applications.

A5:

Answer C is correct. The proxy wrapper adds an extra processing step during calls to legacy components, thus creating a loss of performance over .NET components. Answer A is incorrect because both COM and COM+ components are unmanaged code and therefore cannot use the CLR's support capabilities. Answer B is incorrect because conflicting property names will be automatically renamed during conversion. Answer D is incorrect because legacy component use will be slower and may require extra steps to properly deploy the additional components to users'workstations.

Question 6

Your company has developed a COM component that you want to use from more than one .NET application. Which utilities should you use to make the component available to all .NET applications on your computer? [Select all that apply.]

  • A. aximp.exe

  • B. signcode.exe

  • C. gacutil.exe

  • D. tlbimp.exe

A6:

Answers C and D are correct. You must use the Type Library Importer ( tlbimp.exe ) to create a Runtime Callable Wrapper (RCW) for the COM component and to sign the RCW. You can then use gacutil.exe to place the signed assembly in the GAC, where it is available to all applications. Answer A is incorrect because aximp is only used to import ActiveX controls. Answer B is incorrect because a signcode signature is unnecessary for components to be placed in the GAC.

Question 7

For which of the following requirements can you use PInvoke ?

  • A. PInvoke may be used to include legacy interoperability support for ActiveX components.

  • B. PInvoke may be used to include legacy interoperability support for COM components.

  • C. PInvoke may be used to include legacy interoperability support for COM and COM+ components.

  • D. PInvoke may be used to include legacy interoperability support for Windows API calls.

A7:

Answer D is correct. Platform Invoke ( PInvoke ) is used to provide access to Windows API calls. Answers A, B, and C are incorrect because PInvoke does not provide support for COM, COM+, or ActiveX components, all of which require a proxy wrapper class.

Question 8

Which of the following legacy items may be directly added using the Visual Studio .NET interface? [Select all that apply.]

  • A. ActiveX controls

  • B. COM components

  • C. COM+ components

  • D. Windows API calls

A8:

Answers A, B, and C are correct. An ActiveX component may be directly imported using the Visual Studio .NET Toolbox, whereas COM and COM+ components may be directly added to the References node of the Solution Explorer. Answer D is incorrect because PInvoke calls to the Windows API require code within your application.

Question 9

Which information do you need to specify to call a Windows API function via PInvoke ? [Select all that apply.]

  • A. The name of the API call

  • B. The name of the computer

  • C. The library containing the API call

  • D. The parameters to the API call

A9:

Answers A, C, and D are correct. PInvoke requires you to specify the details of the API call, including its name, library, and parameters. Answer B is incorrect because API calls are independent of the computer name.

Question 10

Which of the following are advantages gained by using .NET components rather than legacy components? [Select all that apply.]

  • A. Errors are contained.

  • B. Memory is better managed.

  • C. Resources are better managed.

  • D. Performance is increased.

A10:

Answers A, B, C, and D are correct. Unmanaged legacy code does not operate within the .NET Common Language Runtime (CLR). .NET components share the CLR's ability to handle errors, manage memory, and perform automatic garbage collection to better manage available resources. Due to legacy components' need for a proxy wrapper, .NET components show improved performance over older versions included within .NET applications.



Developing and Implementing WindowsR-based Applications with Visual BasicR. NET and Visual StudioR. NET Exam CramT 2 (Exam 70-306)
Developing and Implementing WindowsR-based Applications with Visual BasicR. NET and Visual StudioR. NET Exam CramT 2 (Exam 70-306)
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 188

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net