Good Content to know for .Net


Q1: What is ASP.NET? What is the main difference between ASP and ASP.NET?

A: ASP.NET is Microsoft’s server-side technology for creating dynamic and user-friendly Web applications, Web sites and Web services. You can create ASP.NET applications in most of the .NET compatible languages, such as VB, C#, and J#. The ASP.NET compiles the Web pages and provides much better performance than scripting languages. The main difference between ASP and ASP.NET is that ASP is interpreted; whereas, ASP.NET is compiled.

 

Q2: What is the concept of Postback in ASP.NET? How can we identify that the Page is Post Back?

A: A postback is a request sent from a client to the server from the same page where a user is already working. It’s basically posting a complete page back to server (i.e. sending all of its data) on the same page. So, the whole page is refreshed.

Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.

 

Q3: What is an assembly?

A: An assembly is one of the elements of a .NET application and is termed as a primary unit of all .NET applications. This assembly can be either a DLL or an executable file.

 

Q4: What is the difference between method overriding and method overloading?

A: Overriding involves the creation of two or more methods with the same name and same signature in different classes.

Overloading is a concept of using a method at different places with the same name and different signatures within the same class.

 

Q5: What is constructor and why we use constructor?

A: Constructor is a special method of a class, which is called automatically when the instance of a class is created. It is created with the same name as the class and initializes all class members, whenever you access the class.

The main features of a constructor are as follows:

  • Constructors do not have any return type
  • Constructors are always public
  • It is not mandatory to declare a constructor; it is invoked automatically by .NET Framework

 

Q6: What is a delegate and multicast delegates?

A: A delegate is similar to a class, used for storing the reference to a method and invoking that method at runtime, if required. Some of the examples of delegates are type-safe functions, pointers or callbacks.

A delegate object is to hold references of and invoke multiple methods. Such delegate objects are called multicast delegates or combinable delegates.

 

Q7: What is a namespace?

A: Namespace is considered as a container that contains a functionally related group of classes and other types.

 

Q8: Can you declare a private class in a namespace?

A: The classes in a namespace are internal, by default. However, you can explicitly declare them as public only and not as private, protected, or protected internal.

 

Q9: What is garbage collection?

A: Garbage collection prevents memory leaks during execution of programs. Garbage collection is a low-priority process that manages the allocation and de-allocation of memory for your application. If GC finds any object that is no longer used by the application, it frees up the memory from that object.

 

Q10: Difference between Response.Redirect and Server.Transfer?

A: In case of Response.Redirect, a new request is generated from client-side for redirected page. It’s a kind of additional round trip. As a new request is generated from the client, the new URL is visible to users in the browser after redirection.

While in the case of Server.Transfer, a request is transferred from one page to another without making a round trip from the client. For the end user, the URL remains the same in the browser even after transferring to another page.

 

Q11: Briefly explain the use of Global.asax.

A: Global.asax is basically ASP.NET Application file. It’s a place to write code for Application-level events such as Application start, Application end, Session start and end, Application error etc. raised by ASP.NET.

 

Social Media


Categories



All Posts



Contact Info