.Net Interview Questions and Answers
I recently attended a .net written test for those possessing 2 - 5 years relevant work experience. In this article I have shared the some of the theoretical questions and answers with you people.Hope this will help you all.
Lately I attended a .Net written test. It was for 2-5 yrs experience in Dotnet. It was supposed to be an interview,but when i reached there it turned to be a written test.
These are some of the theoretical questions asked in the written exam.
Others were Output based questions.
1)What is the difference between thread and process?
A process is an execution of a program.Its consist a program code to be executed.Each process needs different memory space.
These are known as “heavyweight process" as they consume large amount of memory space.A process can contain multiple
threads.
A thread is a path of execution within a process.Threads are used for small task and are known as lightweight process.
Threads within the same process share the same address space.
Switching between different process take more resources unlike threads which requires minimal resources for communicating with
other threads.
Modifying a main thread may affect subsequent threads while changes on a parent process will not necessarily affect
child processes.
2)What is Thread pool?
3)What is an Object Pool?
Object pool is a container of objects.The objects are stored in memory to be used later based on the request.When there
is a request for a new object,it will be served by allocating an object from the pool.If the object is not there a
new object will be created in the pool.
4)Difference between delegate and events?
5)What is Serialization and De-serialization in .net?
Serialization is the process of converting an object into a stream of data so that it can be easily transmittable over the
network or can be stored in a location.The storage location can be a file or database.
De-serialization is the reverse process of converting the stream of data back to an object.
6)What is HttpModule?
When an application runs in a web-server,HTTPModules are found before and after the HTTPHandlers.These are used if we want to add some extra functionality to the existing code or add some new functionality.
7)Difference between dispose and finalize methods in C#.
Finalize method is implicitly called by GarbageCollector to delete the object if it is no longer in use whereas Dispose method is explicitly called inside a class through IDisposible interface to forcefully remove the object
and its references.
8)What is the difference between Abstract and Interface?With Examples.
First of all, the interface is not a class. An interface can only contain the method definition without the body.
On the other-hand, an abstract class is a class that contains the method definition and may or may not contain the method body.
It acts as a base class can be inherited from other child class.
One class can inherit only one abstract class at a given time where is it can implement one or more interface.
9)What is MVVM?
Model View View Model is an architectural design pattern used mainly with WPF applications.
Types of SQL Keys
We have following types of keys in SQL which are used to fetch records from tables and to make relationship among tables or views.
1. Super Key
Super key is a set of one or more than one keys that can be used to identify a record uniquely in a table.
Example : Primary key, Unique key, Alternate key are subset of Super Keys.
2. Candidate Key
A Candidate Key is a set of one or more fields/columns that can identify a record uniquely in a table. There can be multiple Candidate Keys in one table. Each Candidate Key can work as Primary Key.
Example: In below diagram ID, RollNo and EnrollNo are Candidate Keys since all these three fields can be work as Primary Key.
3. Primary Key
Primary key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It can not accept null, duplicate values. Only one Candidate Key can be Primary Key.
4. Alternate key
A Alternate key is a key that can be work as a primary key. Basically it is a candidate key that currently is not primary key.
Example: In below diagram RollNo and EnrollNo becomes Alternate Keys when we define ID as Primary Key.
5. Composite/Compound Key
Composite Key is a combination of more than one fields/columns of a table. It can be a Candidate key, Primary key.
6. Unique Key
Unique key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It is like Primary key but it can accept only one null value and it can not have duplicate values.
7. Foreign Key
Foreign Key is a field in database table that is Primary key in another table. It can accept multiple null, duplicate values.
Example : We can have a DeptID column in the Employee table which is pointing to DeptID column in a department table where it a primary key.