P2Pprogrammer 2 programmer

Home > Interview Question and Answer > C# and VB.Net > C# - Advanced .NET Framework interview questions and answers

Advanced .NET Framework interview questions and answers


Interview questions and answers for Advanced .NET Framework Features. Advanced .NET Framework topics, Print Support, Localization, globalization, XML Web Service, accessibility requirements, HelpProvider component, CultureInfo, Unicode format, Com Interoperability,

Advanced .NET Framework C#, VB.NET Interview Question and Answers for .NET Framework Version 2.0, 3.0, 3.5, 4.0, 4.5



Advanced .NET Framework and ADO.NET Interview Question and Answers


1. Briefly describe how to use the PrintDocument component to print a document. Discuss maintaining correct line spacing and multipage documents.

The PrintDocument class exposes the Print method, which raises the PrintPage event. Code to render printed items to the printer should be placed in the PrintPage event handler. The PrintPage event handler provides the objects required to render to the printer in an instance of the PagePrintEventArgs class. Content is rendered to the printer using the Graphics object provided by PagePrintEventArgs. You can calculate correct line spacing by dividing the height of the MarginBounds property by the height of the font you are rendering. If your document has multiple pages, you must set the PagePrintEventArgs.HasMorePages property to true, which causes the PrintPage event to fire again. Because the PrintPage event handler retains no inherent memory of how many pages have been printed, you must incorporate all logic for printing multiple pages into your event handler.

2. Explain how to use the Begin and End methods on a Web Service to make an asynchronous method call.

Every public Web method on a Web Service can be called either synchronously or asynchronously. To make an asynchronous call to a Web method, you call the method named Begin<webmethod>, where <webmethod> is the name of the method. This method requires a delegate to an appropriate callback method and returns a value of IAsyncResult. This value is returned as a parameter in the callback method. To retrieve the data returned by the Web method, call End<webmethod>, supplying a reference to the IAsyncResult returned by Begin<webmethod>. This will allow you to retrieve the actual data returned by the Web method.

3. Briefly describe the five accessibility requirements of the Certified for Windows logo program. The five requirements are

Support standard system settings. This requires your application to ¬be able to conform to system settings for colors, fonts, and other UI elements.

  1. Be compatible with High Contrast mode. This requirement can be met by using only the System palette for UI colors.
  2. Provide documented keyboard access for all UI features. Key points in this requirement are shortcut keys and accessible documentation.
  3. Provide notification of the focus location. This requirement is handled primarily by the .NET Framework.
  4. Convey no information by sound alone. This requirement can be met by providing redundant means of conveying information.

4. Explain how to use the HelpProvider component to provide help for UI elements.

You can provide either a HelpString or a help topic for UI elements with the HelpProvider. The HelpProvider provides HelpString, HelpKeyWord, and HelpNavigator properties for each control on the form. If no value for the HelpProvider.HelpNameSpace is set, the HelpString will be provided as help. If the HelpNameSpace is set, the HelpProvider will display the appropriate help topic as configured by the HelpKeyWord and HelpNavigator properties. Help for a particular element is displayed when the element has the focus and the F1 key is pressed.

5. Describe how to create localized versions of a form.

To create a localized version of a form, set the Localizable property to true. Then set the Language property to the language/region for which you want to create the localized form. Make any localization-related changes in the UI. The changed property values will automatically be stored in resource files and loaded when the CurrentUICulture is set to the appropriate CultureInfo.

6. Explain how to convert data in legacy code page formats to the Unicode format.

You can use the Encoding.Convert method to convert data between encoding types. This method requires instances of both encoding types and an array of bytes that represents the data to be converted. It returns an array of bytes in the target format. You can convert a string or array of chars to an array of bytes with the Encoding.GetBytes method and can convert an array of bytes back to chars with the Encoding.GetChars method.

7. Explain the difference between Globalization and Localization.

Globalization refers to the application of culture-specific format to existing data. Localization refers to providing new culture-specific resources and retrieving the appropriate resources based on the culture setting.

8. Explain how to use the PrintPreviewDialog control to display a preview of a printed document before it is printed.

You display a preview of a printed document with the PrintPreviewDialog control by first setting the PrintDocument property of the PrintPreviewDialog instance to the PrintDocument you want to preview, then by calling the PrintPreviewDialog.Show command to display the dialog box.

9. What are the different approaches to testing?

There are two different approaches to testing: the waterfall approach and the evolutionary approach.

10. Explain the waterfall approach.

The waterfall approach is a traditional approach in which each developer in the development team works in phases. These phases cover requirement analysis, design and specifications requirements, coding, final testing, and release.

11. Explain the evolutionary approach.

In the evolutionary approach, you develop a modular piece or unit of application, test it, fix it, and then add another small piece that adds functionality. You then test the two units as an integrated component, increasing the complexity as you proceed.

12. How does the Visual Studio .NET debugger work?

When you debug a Visual Studio .NET application, the debugger first maps the native code to MSIL, and then maps the MSIL code to source code by using a PDB file.

13. What are the main windows and dialog boxes that you use to debug a Visual Studio .NET application?

The main windows and dialog boxes that you use to debug a Visual Studio .NET application are the Visual Studio .NET debugger window, Breakpoints window, Watch window, Call Stack window, Locals window, Autos window, and Processes window.

14. What is code instrumentation?

Code instrumentation is a set of tasks that you perform to monitor and analyze information about the performance of your applications. It involves activities such as writing tracing code for the application, collecting trace information, analyzing the trace output, and troubleshooting the problems that occur at run time.

15. How do you implement code instrumentation?

You can implement code instrumentation by using tracing, debugging, performance counters, and event logs.

16. Which tool do you need to use to convert .txt files to .resources files?

If you have text files as resources, then you can use the ResGen.exe tool to convert .txt files to .resources files. The syntax for using the ResGen.exe tool is ResGen strings.txt myResources.resource

17. Which tool do you need to use to compile the .resources files into satellite assemblies?

Once you have created .resources files, you can compile them into satellite assemblies by using Al.exe, the Assembly Linker (AL) tool. The AL tool creates satellite assemblies from the .resources files that you specify. As you know, satellite assemblies cannot contain any executable code and can contain only resources. The following command shows you how to use the Al.exe tool to generate a satellite assembly: al /t:lib /embed:myResource.resources /culture:de /out:MyRes.resources.dll

18. What are the deployment features of the .NET Framework?

The .NET Framework provides the following deployment features:

  1. No-impact applications
  2. Private components
  3. Controlled code sharing
  4. Side-by-side versioning
  5. Xcopy deployment
  6. On-the-fly updates
  7. Integration with Microsoft Windows Installer
  8. Enterprise deployment
  9. Downloading and caching
  10. Partially trusted code

19. What is the format of the assembly version stored in the AssemblyInfo file?

The assembly version number is a four-part number. The format of the version number is <\major version>.<minor version>.<build number>.<revision>

20. Which attribute do you use to specify the version number of an assembly?

You use the AssemblyVersion() attribute to specify the version of an assembly.

21. What are Merge Module projects?

Merge Module projects enable you to install and deploy components consistently. Merge Module projects ensure that the correct version of a component is installed on the target computer. A Merge Module project contains a component such as a DLL along with dependent files, resources, registry entries, and setup logic. You cannot install merge modules directly. The modules are merged with an .msi file for each application that uses the component. This ensures that the component is installed consistently for all applications, eliminating problems such as version conflicts, missing registry entries, and improperly installed files. A merge module contains unique version information that the Windows Installer database uses to determine which applications can use the component, preventing the premature removal of a component. Therefore, a new merge module is created for every incremental version of a component. You should not update a merge module after including the module in an installer. The deployment tools in Visual Studio .NET make it easy to create Merge Modules and include them in installers for your applications.

22. What type of Setup project do you create to deploy XML Web services?

To deploy XML Web services, you create a Web Setup project.

23. Which tools does the .NET Framework provide to export types defined in an assembly to a type library?

The .NET Framework provides the Type Library Exporter (Tlbexp.exe) to export types defined in an assembly to a type library.

24. Which tool can you use to register managed types with the Windows registry?

You can use the Assembly Registration Tool (Regasm.exe) to register managed types with the Windows registry.

25. What tasks does the common language runtime perform to locate and bind an assembly?

The common language runtime performs the following tasks, in the order listed, to locate and bind to assemblies:

  1. Determines the correct assembly version
  2. Checks for the previously loaded assembly
  3. Checks the global assembly cache
  4. Locates the assembly through the codebase setting or probing

More C# and VB.Net Interview Question and Answers

  1. .NET Framework interview questions and answers
  2. VB.NET and C# User Interface interview questions and answers
  3. .NET Object-Oriented Programming (OOPs) interview questions and answers
  4. ADO.NET interview questions and answers
  5. Advanced .NET Framework Topics interview questions and answers
  6. Windows Service, COM+ and XML Web Services interview questions and answers
  7. .NET Assemblies, Configuration, and Security interview questions and answers
  8. VB.NET and C# setup and deployment interview questions and answers
  9. VB.NET and C# general interview questions and answers


Home > Interview Question and Answer > C# and VB.Net > .NET Framework