Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Dot Net Interview Questions & Answers

Hello friends, I am here with new blog Dot Net Interview Questions & Answers. This blog is very important for all job aspirants who want to become a dot net developer.

First step for getting the job is cracking the technical interview

How you will crack the interview, first you should you have the basic knowledge of dot net concepts ,after studying it in depth you can emphasis more on Coding Practice with an understanding of the concepts . Make sure all your concepts are clear so before going to dot interview just have a glance at following Important dot net interview questions.

1.What is ASP.Net?

Ans-It is a technology developed by Microsoft on which we can develop new generation websites using web forms(aspx), MVC, HTML, Javascript, CSS etc. It’s successor of Microsoft Active Server Pages(ASP). Currently, there is ASP.NET 4.0, which is used to develop websites.

2.What’s the use of Response.Output.Write()?

Ans-We can write formatted output using Response.Output.Write().

3.Explain the Event Lifecycle of ASP.NET 2.0?

Ans-The events occur in the following sequence. Its best to turn on tracing() and track the flow of events :

  • PreInit – This event represents the entry point of the page life cycle. If you need to change the Master page or theme programmatically, then this would be the event to do so. Dynamic controls are created in this event.
  • Init – Each control in the control collection is initialized.
  • Init Complete* – Page is initialized and the process is completed.
  • PreLoad* – This event is called before the loading of the page is completed.
  • Load – This event is raised on the Page and then all child controls. The controls properties and view state can be accessed at this stage. This event indicates that the controls have been fully loaded.
  • LoadComplete* – This event signal indicates that the page has been loaded in the memory. It also marks the beginning of the rendering stage.
  • PreRender – If you need to make any final updates to the contents of the controls or the page, then use this event. It first fires for the page and then for all the controls.
  • PreRenderComplete* – Is called to explicitly state that the PreRender phase is completed.
  • SaveStateComplete* – In this event, the current state of the control is completely saved to the ViewState.
  • Unload – This event is typically used for closing files and database connections. At times, it is also used for logging some wrap-up tasks.

4.What are the different validators in ASP.NET?

Ans-

  •  Required Field Validator
  • Range  Validator
  • Compare Validator
  • Custom Validator
  • Regular expression Validator
  • Validation Summary

4.Which validator control you use if you need to make sure the values in two different controls matched?

Ans-Compare Validator control.

5.What is the difference between overriding and overloading?

Ans-Overloading

  • In this approach, we can define multiple methods with the same name changing their signature. In other words different parameters
  • This can be performed within a class as well as within a child class
  • Doesn’t require any permission from the parent for overloading its method in the child

Overriding

  • It is an approach to defining multiple methods with the same name and the same signature
  • This can be performed only under child classes

Requires an explicit permission from the parent to override its methods in the child.

6.Differences between Array and ArrayList

  • Array
  • ArrayList
  • Array uses the Vector array to store the elements
  • ArrayList uses the LinkedList to store the elements.
  • Size of the Array must be defined until redim is used (vb)
  • No need to specify the storage size.
  • An array is a specific data type storage
  • ArrayList can store everything as an object.
  • No need to do the type casting
  • Type casting must be done every time.
  • It will not lead to Runtime exception
  • It leads to a run time error exception.
  • Element cannot be inserted or deleted in between.
  • Elements can be inserted and deleted.
  • There are no built-in members to do ascending or descending.
  • An ArrayList has many methods to do operations like Sort, Insert, Remove, BinarySeacrh and so on.

 7. Can you use multiple inheritances in dot NET?

Ans-.NET supports only single inheritance. However, the purpose is accomplished using multiple interfaces

8. Why don’t we have multiple inheritances dot NET?

Ans-There are several reasons for this. In simple words, the efforts are more, benefits are less. Different languages have different implementation requirements of multiple inheritances. So in order to implement multiple inheritances, we need to study the implementation aspects of all the languages that are CLR compliant and then implement a common methodology of implementing it. This is too much of efforts. Moreover, multiple interface inheritance very much covers the benefits that multiple inheritances have.

9. What is an Interface?

Ans-An interface is a standard or contract that contains only the signatures of methods or events. The implementation is done in the Class that inherits from this interface. Interfaces are primarily used to set a common standard or contract.

10. What are events and delegates?

Ans-An event is a message sent by a control to notify the occurrence of an action. However it is not known which object receives the event. For this reason, .NET provides a special type called Delegate which acts as an intermediary between the sender object and receiver object.

11. You have created an ASP.NET Application. How will you run it?

Ans-With ASP.NET 2.0, Visual Studio comes with an inbuilt ASP.NET Development Server to test your pages. It functions as a local Web server. The only limitation is that remote machines cannot access pages running on this local server. The second option is to deploy a Web application to a computer running IIS version 5 or 6 or 7.

ASP.NET Core applications are host agnostic i.e they can be run on IIS or even standalone.

12. Explain the AutoPostBack feature in ASP.NET?

Ans-AutoPostBack allows a control to automatically postback when an event is fired. For eg: If we have a Button control and want the event to be posted to the server for processing, we can set AutoPostBack = True on the button.

13. How do you disable AutoPostBack?

Ans-Hence the AutoPostBack can be disabled on an ASP.NET page by disabling AutoPostBack on all the controls of a page. AutoPostBack is caused by a control on the page.

14. What are the different code models available in ASP.NET 2.0?

Ans-There are 2 code models available in ASP.NET 2.0. One is the single-file page and the other one is the code behind page.

15. Which base class does the web form inherit from?

Ans-Page class in the System.Web.UI namespace.

16. What is the relation between Classes and Objects?

Ans-Class applies to a type or model of a GROUP of itedot-ms, objects, or concepts.
Object applies to a specific material item or concept, a group of which may comprise a class.

17.what is IL?
Ans-(IL) Intermediate Language is also known as MSIL is MicroSoft Intermediate Language or Common Language Runtime (CLR) . When we compile.Net applications, its compiled to MSIL, which is not machine read the language. Hence Common Language Runtime (CLR) with JustIn Time Compiler (JIT) , converts this MSIL to native code (binary code) , which is machine language.

18.What are the defining traits of an object-oriented language?
Ans-The defining traits of an object-oriented language are:
a) Inheritance
b) Abstraction
c) Encapsulation
d) Polymorphism

  • Inheritance: The main class or the root class is called as a Base Class. Any class which is expected to have ALL properties of the base class along with its own is called as a Derived class. The process of deriving such a class is Derived class.
  • Abstraction: Abstraction is creating models or classes of some broad concept. Abstraction can be achieved through Inheritance or even Composition.
    Encapsulation: Encapsulation is a collection of functions of a class and object. The “Food” class is an encapsulated form. It is achieved by specifying which class can use which members (private, public, protected) of an object.
  • Polymorphism: Polymorphism means existing in different forms. Inheritance is an example of Polymorphism. A base class exists in different forms as derived classes. Operator overloading is an example of Polymorphism in which an operator can be applied in different situations

19. What is the concept of DISPOSE method?

Ans-DISPOSE method belongs to IDisposable interface. It is used to free unmanaged resources like files, network connection etc. It manages and handles this by an instance of the class that implements this interface. Dispose methods must be called explicitly and hence the any object using IDisposable must also implement finalizer to free resources in situations wherein Dispose is not called. Multiple calls to dispose method must be ignored when called once. The objects disposable methods must be called in the order of containment.

20. What is a CLR?

Ans-The Common Language Runtime (CLR) is a core component of .NET framework. It is Microsoft’s implementation of the Common Language Infrastructure (CLI) standard, which defines an execution environment for program code. In the CLR, code is expressed in a form of bytecode called the Common Intermediate Language (CIL) . Developers using the CLR write code in a language such as C# or VB.NET. At compile time, the .NET compiler converts such code into CIL code. At runtime, the CLR’s just-in-time compiler converts the CIL code into code native to the operating system. Alternatively, the CIL code can be compiled to native code in a separate step prior to runtime by using the Native Image Generator (NGEN) . This speeds up all later runs of the software as the CIL-to-native compilation is no longer necessary.

During the execution of the program, the Common Language Runtime (CLR) manages memory, Thread execution, Garbage Collection (GC) , Exception Handling, Common Type System (CTS) , code safety verifications, and other system services. The Common Language Runtime (CLR) environment is also referred to as a managed environment because during the execution of a program it also controls the interaction with the Operating System.

21. What is CTS?
Ans-CTS stands for Common Type System. The CTS makes available a common set of data types so that compiled code of one language could easily interoperate with a compiled code of another language by understanding each others’ data types. If two languages (c# or vb.net or j# or vc++) want to communicate with each other, they have to convert into some common type (i.e. in COMMON LANGUAGE RUNTIME) . In C# we use int which is converted to Int32 of CLR to communicate with vb.net which uses Integer or vice versa.

22. What is a CLS(Common Language Specification)?
Ans-CLS is a specification that defines the rules to support language integration. This is done in such a way, that programs are written in any language (.NET compliant) can communicate with one another. This also can take full advantage of inheritance, polymorphism, exceptions, and other features. This is a subset of the CTS, which all .NET languages are expected to support.

23. Difference between Abstract Classes and Interfaces.
Ans-Following are the differences between Abstract Classes and Interfaces:
a) When a derived class is inherited from an Abstract class, no other class can be extended then. An interface can be used in any scenario.
b) Abstract class contains abstract method, i.e. actual implementation logic. On the other hand, interfaces have no implementation logic.
c) Every method in an interface must be abstract. This is not necessary in case of abstract classes.

The post Dot Net Interview Questions & Answers appeared first on .



This post first appeared on Career Options After Graduation | ITpreneur Data System Pvt. Ltd., please read the originial post: here

Share the post

Dot Net Interview Questions & Answers

×

Subscribe to Career Options After Graduation | Itpreneur Data System Pvt. Ltd.

Get updates delivered right to your inbox!

Thank you for your subscription

×