Saturday, June 27, 2009

.NET Interview Questions - Part 1

1. What is the difference between ASP.Net and VB.NET?
ASP.Net is an “environment”, and VB.Net is a programming language. You can write ASP.Net pages (called “Web Forms” by Microsoft) using VB.Net (or C#, or J# or Managed C++ or any one of a number of .Net compatible languages).

2. What base class do all Forms inherit from?

3. What is the difference between Debug.Write and Trace.Write? When should each be used?
The Debug.Write call won’t be compiled when the DEBUG symbol is not defined (when doing a release build). Trace.Write calls will be compiled. Debug.Write is for information you want only in debug builds, Trace.Write is for final realease

4. Can you give an example of when it would be appropriate to use a web service as opposed to non-serviced .NET component?
Web service is one of main component in Service Oriented Architecture. You could use web services when your clients and servers are running on different networks and also different platforms. This provides a loosely coupled architecture.

5. Is it possible to restrict the scope/field method of a class to the classes in the same name space?
There is no way to restrict to a namespace. Namespaces are never units of protection. But if you’re using assemblies, you can use the ‘internal’ access modifier to restrict access to only within the assembly.

6. What is the equivalent of exit () for quitting in .NET application?
You can use System.Environment.Exit(int exitCode) to exit the application or Application.Exit() if it’s a Windows Forms app.

7. Is there regular expression (regex) support available to c# developers?
Yes. The .NET class libraries provide support for regular expressions. Look at the System.Text.RegularExpressions namespace.

8. How many types of validation controls are supported in ASP.NET?
RequiredField Validator Control,Range Validator Control, RegularExpression Validator Control,Custom Validator Control and Validation Summary Control are provided by ASP.NET.

9. What is Tracing in ASP.NET?
ASP.NET introduces new functionality that allows you to write debug statements, directly in your code, without having to remove them from your application when it is deployed to production servers. Called tracing, this feature allows you to write variables or structures in a page, assert whether a condition is met, or simply trace through the code.

10. What exactly happens when aspx page is requested from Browser?
At its core, the ASP.NET execution engine compiles the page into a class, which derives from the code behind class (which in turn derives directly or indirectly from the Page class). Then it injects the newly created class into the execution environment, instantiates it, and executes it.

11. Methods of Deployment:
You can deploy an ASP.NET Web application using any one of the following three deployment options
1.XCOPY Deployment2.Using the Copy Project option in VS .NET3.Deployment using VS.NET installer

12. What can be stored in Web.config file?
There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file..
1. Database connections2. Session States3. Error Handling4. Security

13. Is String a value type of Reference Type?
string is actually ref Type but some difference with other ref objectValue type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short,strut, uint, ulong, ushortValue types are stored in the StackReference type - class, delegate, interface, object, stringReference types are stored in the Heap

14. What is the purpose of garbage Collection?
The purpose of Garge collection is to identify and discard objects that are no longer needed by a program so that their resources may be reclaimed and reused.

15. What does AspCompat=”true” mean and when should I use it?
AspCompat is an aid in migrating ASP pages to ASPX pages. It defaults to false but should be set to true in any ASPX file that creates apartment-threaded COM objects–that is, COM objects registered ThreadingModel=Apartment. That includes all COM objects written with Visual Basic 6.0.

No comments:

Post a Comment