More searching about interviews questions and answers click these links ADO.Net, C#, and .Net Design Pattern
Question for interview
1 ) what is Serialization and De serializtion?
Answer:
Serialization is the process of converting an object into a stream of bytes in order to store
the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object
in order to be able to recreate it when needed. The reverse process is called deserialization.
2)what is deiffrent between static and sealed ?
Answer: Static
It can not be inheritance its have a static method and can be a private constructor. It has no object it is called by its own class name.
Sealed: It can not be inheritance its can non a static and static method and can public constructor.
3)what is different between Dispose and finalize?
Answer: Dispose
Release the unmanaged resources. Explicitly, it is called by user code and the class implementing dispose of the method must implement an IDisposable interface. It belongs to ID disposable interface. There are no performance costs associated with Dispose method.
Finalize :
Release the free unmanaged resources and hold the object before it is destroyed. It belongs to the Object class. There are performance costs associated with Finalize method
.
4) what is Namespaces and different between Assembly?
Answer: Namespaces :
1) it is a Collection of names wherein each name is Unique.
2) They form the logical boundary for a Group of classes.
3) Namespace must be specified in Project-Properties.
Assembly :
1) It is an Output Unit.
2) It is a unit of Deployment & a unit of versioning.
3) Assemblies contain MSIL code.
4) Assemblies are Self-Describing. [e.g. metadata,manifest]
5)An assembly is the primary building block of a .NET Framework application.
6) It is a collection of functionality that is built,
versioned, and deployed as a single implementation unit (as one or more files).
7) All managed types and resources are marked either as
accessible only within their implementation unit, or by code outside that unit.
5) what is Aggregate Functions?
Answer :
Aggregate functions perform a calculation on a set of values and return a single value.
Except for COUNT, aggregate functions ignore null values. Aggregate functions are frequently used with the GROUP BY clause of the SELECT statement.
6) What is different between Store Procedure and Function?
- Function is mainly used in the case where it must return a value. Where as a procedure may or may not return a value or may return more than one value using the OUT parameter.
- Function can be called from SQL statements where as procedure can not be called from the sql statements
- Functions are normally used for computations where as procedures are normally used for executing business logic.
- You can have DML (insert,update, delete) statements in a function. But, you cannot call such a function in a SQL query.
- Function returns 1 value only. The procedure can return multiple values (max 1024).
Store Procedure :
- Stored Procedure: supports deferred name resolution. Example while writing a stored procedure that uses a table named tabl1 and tabl2 etc.. but actually does not exist in a database is allowed only in during creation but runtime throws error Function won’t support deferred name resolution.
- Stored procedure returns always integer value by default zero. whereas function return type could be scalar or table or table values
- Stored procedure is precompiled execution plan where as functions are not.
- A procedure may modify an object where a function can only return a value The RETURN statement immediately completes the execution of a subprogram and returns control to the caller.
7) What is a Delegate?
Answer: Delegate is a type that holds the method(s) reference in an object. It is also referred to as a type-safe function pointer
Advantages :
Encapsulating the method’s call from a caller
Effective use of delegates improves the performance of the application
Used to call a method asynchronously
8) What is Multicast Delegate?
Answer :
It is a delegate that holds the reference of more than one method.
Multicast delegates must contain only methods that return void, else there is a run-time exception.
9) whats is Access modifiers in OOP?
Answer:
- Public Accessible outside the class through object reference.
- Private Accessible inside the class only through member functions.
- Protected Just like private but Accessible in derived classes also through member functions.
- Internal Visible inside the assembly. Accessible through objects.
- Protected Internal — Visible inside the assembly through objects and in derived classes outside the assembly through member functions.
Next… the topic link is given below
Design Patterns in ASP.NET
10)What is an Abstract Class?
Answer:
An abstract class is a special kind of class that cannot be instantiated. So the question is why do we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards
11)What is an Interface?
Answer :
An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines a specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn’t t support multiple inheritances, interfaces are used to implement multiple inheritances
Both Together
| Feature | Interface | Abstract class |
| Multiple inheritances | A class may inherit several interfaces. | A class may inherit only one abstract class. |
| Default implementation | An interface cannot provide any code, just the signature. | An abstract class can provide complete, default code and/or just the details that have to be overridden. |
| Access Modfiers | An interface cannot have access modifiers for the subs, functions, properties, etc everything is assumed as public | An abstract class can contain access modifiers for the subs, functions, properties |
| Core VS Peripheral | Interfaces are used to define the peripheral abilities of a class. In other words, both Humans and Vehicles can inherit from an IMovable interface. | An abstract class defines the core identity of a class and there it is used for objects of the same type. |
| Homogeneity | If various implementations only share method signatures then it is better to use Interfaces. | If various implementations are of the same kind and use common behavior or status then abstract class is better to use. |
| Speed | Requires more time to find the actual method in the corresponding classes. | Fast |
| Adding functionality (Versioning) | If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method. | If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly. |
| Fields and Constants | No fields can be defined in interfaces | An abstract class can have fields and constants defined |
12) What’s the .NET datatype that allows the retrieval of data by a unique key?
Answer: HashTable
13) Can you store multiple data types in System.Array?
Answer: No
14)How do you debug an ASP.NET Web application?
Answer: Attach the aspnet_wp.exe process to the DbgClr debugger
15) What’s the role of the DataReader class in ADO.NET connections?
Answer: It returns a read-only dataset from the data source when the command is executed.
16 )what is polymorphism in oop?
Answer:
Polymorphism is one of the core concepts of object-oriented programming (OOP) polymorphism is the use of a single symbol to represent multiple different types. It describes the concept that you can access objects of different types through the same interface.
The example of polymorphism :
- Function overloading
- Function overriding
17)Different bewteen function overloading and function overding in OOP ?
Answer :
| Basis | Function Overloading | Function Overriding |
|---|---|---|
| Signature | Function signatures of overloaded functions must be different | Same function signatures |
| Polymorphism | Compile-time | Runtime |
| Scope | Overloaded functions are in the same scope | Functions are in different scope |
18) What is View State in Asp.net?
Answer :
View state is nothing but a method that the ASP.NET uses to preserve page and control values between postbacks. When the HTML markup for the page is rendered, the current state of the page and values that must be retained during postback are serialized into base64-encoded strings. This information is then put into the view state hidden field
19) View state is client-side or server side state management techenique?
Answer :
View state is client-side state management techniques.
20) What are the client-side state management techenique supported by ASP.NET?
Answer :
- View state
- Control state
- Hidden fields
- Cookies
- Query strings
21) View state is used by Asp.net page atomatically or we need to apply it manuly?
Answer :
View state is used automatically by the ASP.NET page framework to persist information that must be preserved between postback.
22) What are the limitations of view state?
Answer:
Limitations:
Because the view state is stored in the page, it results in a larger total page size. ASP.NET uses view state only with page and control properties. View state isn’t a good place to store sensitive information that the client shouldn’t be allowed to see.
23)What is state management?
Answer:
State management is the process by which you maintain state and page information over multiple requests for the same or different pages.
24)What is Session?
Answer :
We know that HTTP is stateless, which means when we open a webpage and fill in some information, and then move to the next page then the data which we have entered will lose. It happed due to the HTTP protocol’s stateless nature. So here session comes into existence, Session provides us a way of storing data in server memory. So you can store your page data on the server.
25) What are the Advantage and disadvantage of Session?
Answer :
The session provides us with a way of maintaining user state/data.
It is very easy to implement.
One big advantage of the session is that we can store any kind of object in it. : eg, database, dataset.. etc
By using sessions we don’t need to worry about data collection, because it stores every client’s data separately.
The session is secure and transparent from the user.
Disadvantages:
Performance overhead in case of large volumes of data/user, because session data is stored in server memory.
Overhead involved in serializing and de-serializing session data because, in the case of StateServer and SQLServer session modes, we need to serialize the objects before storing them.
26) What is Session ID in Asp.net?
Answer :
Asp.Net uses the 120-bit identifier to track each session. This is secure enough and can’t be reverse-engineered. When clients communicate with the server, only the session id is transmitted, between them. When the client request data, ASP.NET looks on to session ID and retrieves corresponding data.
27)What are Session Events?
Answer :
There are two types of session events available in ASP.NET:
1)Session_Start
2) Session_End
You can handle both these events globally.asax file of your web application. When a new session initiates, the session_start event is raised, and the Session_End event is raised when a session is abandoned or expires.
28) How you can disable session?
Answer:
If we set session Mode=”off” in web.config, session will be disabled in the application. For this, we need to configure web.config the following way:
Code:
<configuration>
<sessionstate Mode=”off”/>
</configuration>
29) What is the default session modes in asp.net?
Answer: InProc
30) Difference between ASP.NET WebForms and ASP.NET MVC?
Answer :
ASP.NET Web Forms uses a Page controller pattern approach for rendering layout. In this approach, every page has its own controller i.e. code-behind file that processes the request.
On the other hand, ASP.NET MVC uses the Front Controller approach. In this approach, a common controller for all pages processes the requests.
31)what is ASP.NET Page life Cycle?
Answer :
ASP.NET page passes through a series of steps during its life cycle. Following is the high-level explanation of life cycle stages/steps.
Initialization: Controls raise their Init event in this stage. Objects and variables are initialized for the complete lifecycle of the request.
LoadViewState: is a post backstage and loads the view state for the controls that enabled its view state property.
LoadPostBackData: is also a post back stage and loads the data posted for the controls and updates them.
Load: In this stage page as well as all the controls raise their Load event. Till this stage, all the controls are initialized and loaded. In most cases, we are coding this event handler.
RaisePostBackEvent: is again a postback stage. For example, it’s raised against a button click event. We can easily put our code here to perform certain actions.
SaveViewState: Finally, the controls state is saved in this stage before Rendering HTML.
Render: This is the stage where HTML is generated for the page.
Dispose: Lastly, all objects associated with the request are cleaned up.
32)What are the different types of Validation controls in ASP.NET?
Answer :
In order to validate user input, ASP.NET provides validation server controls. All validation controls inherits from BaseValidator class which contains the common validation properties and methods like ControlToValidate, Enabled, IsValid, EnableClientScript, ValidationGroup,Validate() etc.
ASP.Net provides a range of validation controls:
- RequiredFieldValidator validates compulsory/required input.
- RangeValidator validates the range. Validates that input falls between the given range values.
- CompareValidator validates or compares the input of a control with another control value or with a fixed value.
- RegularExpressionValidator validates input value against a defined regular expression pattern.
- CustomValidator allows to customize the validation logic with respect to our application logic.
- ValidationSummary displays all errors on page collectively.
33)What are the types of Authentication in ASP.NET?
Answer :
There are three types of authentication available in ASP.NET:
- Windows Authentication: This authentication method uses built-in windows security features to authenticate user.
- Forms Authentication: authenticate against a customized list of users or users in a database.
- Passport Authentication: validates against Microsoft Passport service which is basically a centralized authentication service.
34 ) What are Session state modes in ASP.NET?
Answer :
ASP.NET supports different session state storage options:
- In-Process is the default approach. It stores session state locally on same web server memory where the application is running.
- StateServer mode stores session state in a process other than the one where application is running. Naturally, it has added advantages that session state is accessible from multiple web servers in a Web Farm and also session state will remain preserved even web application is restarted.
- SQLServer mode stores session state in SQL Server database. It has the same advantages as that of StateServer.
- Custom modes allows to define our custom storage provider.
- Off mode disables session storage.
35 ) Difference between method overloading and method overriding ?
Answer :
Method Overloading and Method Overriding are both the techniques used to implement FUNCTIONAL POLYMORPHISM
Method Overloading (COMPILE TIME Polymorphism)
Method Overloading means having two or more methods with the same name but with different signatures (different parameters list and different types of parameters) in the same class or in different classes.
Method Overloading forms compile-time polymorphism.
Method overriding (RUN TIME Polymorphism)
Method overriding means having two methods with the same name and same signature, one method in the base class and another method in the derived class.
More searching about interviews questions and answers click these links ADO.Net, C#, and .Net Design Pattern
Leave a Reply