Interview Question

Interview Questions in ASP.NET,C#.NET,SQL Server,.NET Framework 


  1. What are the different types of joins and what dies each do?
  2. What are the four main query statements?
  3. What is a sub-query? When would you use one?
  4. What is a NOLOCK?
  5. What are three SQL keywords used to change or set someone’s permissions?
  6. What is the difference between HAVING clause and the WHERE clause?
  7. What is referential integrity? What are the advantages of it?
  8. What is database normalization?
  9. Which command using Query Analyzer will give you the version of SQL server and operating system?
  10. Using query analyzer, name 3 ways you can get an accurate count of the number of records in a table?
  11. What is the purpose of using COLLATE in a query?
  12. What is a trigger?
  13. What is one of the first things you would do to increase performance of a query? For example, a boss tells you that “a query that ran yesterday took 30 seconds, but today it takes 6 minutes”
  14. What is an execution plan? When would you use it? How would you view the execution plan?
  15. What is the STUFF function and how does it differ from the REPLACE function?
  16. What does it mean to have quoted_identifier on? What are the implications of having it off?
  17. What are the different types of replication? How are they used?
  18. What is the difference between a local and a global variable?
  19. What is the difference between a Local temporary table and a Global temporary table? How is each one used?
  20. What are cursors? Name four types of cursors and when each one would be applied?
  21. What is the purpose of UPDATE STATISTICS?
  22. How do you use DBCC statements to monitor various aspects of a SQL server installation?
  23. How do you load large data to the SQL server database?
  24. How do you check the performance of a query and how do you optimize it?
  25. How do SQL server 2000 and XML linked? Can XML be used to access data?
  26. What is SQL server agent?
  27. What is referential integrity and how is it achieved?
  28. What is indexing?
  29. What is normalization and what are the different forms of normalizations?
  30. Difference between server.transfer and server.execute method?
  31. What id de-normalization and when do you do it?
  32. What is better - 2nd Normal form or 3rd normal form? Why?
  33. Can we rewrite subqueries into simple select statements or with joins? Example?
  34. What is a function? Give some example?
  35. What is a stored procedure?
  36. Difference between Function and Procedure-in general?
  37. Difference between Function and Stored Procedure?
  38. Can a stored procedure call another stored procedure. If yes what level and can it be controlled?
  39. Can a stored procedure call itself(recursive). If yes what level and can it be controlled.?
  40. How do you find the number of rows in a table?
  41. Difference between Cluster and Non-cluster index?
  42. What is a table called, if it does not have neither Cluster nor Non-cluster Index?
  43. Explain DBMS, RDBMS?
  44. Explain basic SQL queries with SELECT from where Order By, Group By-Having?
  45. Explain the basic concepts of SQL server architecture?
  46. Explain couple pf features of SQL server
  47. Scalability, Availability, Integration with internet, etc.)?
  48. Explain fundamentals of Data ware housing & OLAP?
  49. Explain the new features of SQL server 2000?
  50. How do we upgrade from SQL Server 6.5 to 7.0 and 7.0 to 2000?
  51. What is data integrity? Explain constraints?
  52. Explain some DBCC commands?
  53. Explain sp_configure commands, set commands?
  54. Explain what are db_options used for?
  55. What is the basic functions for master, msdb, tempdb databases?
  56. What is a job?
  57. What are tasks?
  58. What are primary keys and foreign keys?
  59. How would you Update the rows which are divisible by 10, given a set of numbers in column?
  60. If a stored procedure is taking a table data type, how it looks?
  61. How m-m relationships are implemented?
  62. How do you know which index a table is using?
  63. How will oyu test the stored procedure taking two parameters namely first name and last name returning full name?
  64. How do you find the error, how can you know the number of rows effected by last SQL statement?
  65. How can you get @@error and @@rowcount at the same time?
  66. What are sub-queries? Give example? In which case sub-queries are not feasible?
  67. What are the type of joins? When do we use Outer and Self joins?
  68. Which virtual table does a trigger use?
  69. How do you measure the performance of a stored procedure?
  70. Questions regarding Raiseerror?
  71. Questions on identity?
  72. If there is failure during updation of certain rows, what will be the state?

What is normalization? 
Normalization is the basic concept used in designing a database. Its nothing but, an advise given to the database to have minimal repetition of data, highly structured, highly secured, easy to retrieve. In high level definition, the Process of organizing data into tables is referred to as normalization. 

What is a stored procedure:
Stored procedures are precompiled T-SQL statements combined to perform a single task of several tasks. Its basically like a Macro so when you invoke the Stored procedure, you actually run a set of statements. As, its precompiled statement, execution of Stored procedure is compatatively high when compared to an ordinary T-SQL statement.

What is the difference between UNION ALL Statement and UNION ?
The main difference between UNION ALL statement and UNION is UNION All statement is much faster than UNION,the reason behind this is that because UNION ALL statement does not look for duplicate rows, but on the other hand UNION statement does look for duplicate rows, whether or not they exist. 
Example for Stored Procedure?
They are three kinds of stored procedures,1.System stored procedure – Start with sp_2. User defined stored procedure – SP created by the user.3. Extended stored procedure – SP used to invoke a process in the external systems.Example for system stored proceduresp_helpdb - Database and its propertiessp_who2 – Gives details about the current user connected to your system. sp_renamedb – Enable you to rename your database

What is a trigger? 
Triggers are precompiled statements similar to Stored Procedure. It will automatically invoke for a particular operation. Triggers are basically used to implement business rules. 

What is a view?
If we have several tables in a db and we want to view only specific columns from specific tables we can go for views. It would also suffice the needs of security some times allowing specfic users to see only specific columns based on the permission that we can configure on the view. Views also reduce the effort that is required for writing queries to access specific columns every time. 

What is an Index?
When queries are run against a db, an index on that db basically helps in the way the data is sorted to process the query for faster and data retrievals are much faster when we have an index. 


What is normalization? Explain different levels of normalization?

Check out the article Q100139 from Microsoft knowledge base and of course, there's much more information available in the net. It will be a good idea to get a hold of any RDBMS fundamentals text book, especially the one by C. J. Date. Most of the times, it will be okay if you can explain till third normal form.

What is de-normalization and when would you go for it?

As the name indicates, de-normalization is the reverse process of normalization. It is the controlled introduction of redundancy in to the database design. It helps improve the query performance as the number of joins could be reduced.

How do you implement one-to-one, one-to-many and many-to-many relationships while designing tables?

One-to-One relationship can be implemented as a single table and rarely as two tables with primary and foreign key relationships. One-to-Many relationships are implemented by splitting the data into two tables with primary key and foreign key relationships. Many-to-Many relationships are implemented using a junction table with the keys from both the tables forming the composite primary key of the junction table.

It will be a good idea to read up a database designing fundamentals text book.

What's the difference between a primary key and a unique key?

Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a non-clustered index by default. Another major difference is that, primary key does not allowNULLs, but unique key allows one NULL only.

What are user defined data types and when you should go for them?

User defined data types let you extend the base SQL Server data types by providing a descriptive name, and format to the database. Take for example, in your database, there is a column called Flight_Num which appears in many tables. In all these tables it should bevarchar(8). In this case you could create a user defined data type called Flight_num_typeof varchar(8) and use it across all your tables.

See sp_addtypesp_droptype in books online.

What is bit data type and what's the information that can be stored inside a bit column?

Bit data type is used to store Boolean information like 1 or 0 (true or false). Until SQL Server 6.5 bit data type could hold either a 1 or 0 and there was no support for NULL. But from SQL Server 7.0 onwards, bit data type can represent a third state, which is NULL.

Define candidate key, alternate key, composite key.

candidate key is one that can identify each row of a table uniquely. Generally a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys.

A key formed by combining at least two or more columns is called composite key.

What are defaults? Is there a column to which a default cannot be bound?

A default is a value that will be used by a column, if no value is supplied to that column while inserting data. IDENTITY columns and timestamp columns can't have defaults bound to them. See CREATE DEFAULT in books online.

What is a transaction and what are ACID properties?

A transaction is a logical unit of work in which, all the steps must be performed or none. ACIDstands for Atomicity, Consistency, Isolation, Durability. These are the properties of a transaction. For more information and explanation of these properties, see SQL Server books online or any RDBMS fundamentals text book.

Explain different isolation levels

An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. Here are the other isolation levels (in the ascending order of isolation): Read Uncommitted, Read Committed, Repeatable Read, Serializable. See SQL Server books online for an explanation of the isolation levels. Be sure to read about SET TRANSACTION ISOLATION LEVEL, which lets you customize the isolation level at the connection level.

CREATE INDEX myIndex ON myTable (myColumn)

What type of Index will get created after executing the above statement?

Non-clustered index. Important thing to note: By default a clustered index gets created on the primary key, unless specified otherwise.

What is the maximum size of a row?

8060 bytes. Do not be surprised with questions like 'What is the maximum number of columns per table'. Check out SQL Server books online for the page titled: "Maximum Capacity Specifications".

Explain Active/Active and Active/Passive cluster configurations

Hopefully you have experience setting up cluster servers. But if you do not, at least be familiar with the way clustering works and the two clustering configurations Active/Active and Active/Passive. SQL Server books online has enough information on this topic and there is a good white paper available on Microsoft site.

Explain the architecture of SQL Server

This is a very important question and you better be able to answer it if consider yourself a DBA. SQL Server books online is the best place to read about SQL Server architecture. Read up the chapter dedicated to SQL Server Architecture.

What is Lock Escalation?

Lock escalation is the process of converting a lot of low level locks (like row locks, page locks) into higher level locks (like table locks). Every lock is a memory structure too many locks would mean, more memory being occupied by locks. To prevent this from happening, SQL Server escalates the many fine-grain locks to fewer coarse-grain locks. Lock escalation threshold was definable in SQL Server 6.5, but from SQL Server 7.0 onwards it's dynamically managed by SQL Server.

What's the difference between DELETE TABLE and TRUNCATE TABLE commands?

DELETE TABLE is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow. TRUNCATE TABLE also deletes all the rows in a table, but it will not log the deletion of each row, instead it logs the de-allocation of the data pages of the table, which makes it faster. Of course, TRUNCATE TABLE can be rolled back.

Explain the storage models of OLAP

Check out MOLAPROLAP and HOLAP in SQL Server books online for more information.

What are the new features introduced in SQL Server 2000 (or the latest release of SQL Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?

This question is generally asked to see how current is your knowledge. Generally there is a section in the beginning of the books online titled "What's New", which has all such information. Of course, reading just that is not enough, you should have tried those things to better answer the questions. Also check out the section titled "Backward Compatibility" in books online which talks about the changes that have taken place in the new version.

What are constraints? Explain different types of constraints.

Constraints enable the RDBMS enforce the integrity of the database automatically, without needing you to create triggers, rule or defaults.


For an explanation of these constraints see books online for the pages titled: "Constraints" and "CREATE TABLE", "ALTER TABLE"

What is an index? What are the types of indexes? How many clustered indexes can be created on a table? I create a separate index on each column of a table. what are the advantages and disadvantages of this approach?

Indexes in SQL Server are similar to the indexes in books. They help SQL Server retrieve the data quicker.

Indexes are of two types. Clustered indexes and non-clustered indexes. When you create a clustered index on a table, all the rows in the table are stored in the order of the clustered index key. So, there can be only one clustered index per table. Non-clustered indexes have their own storage separate from the table data storage. Non-clustered indexes are stored as B-tree structures (so do clustered indexes), with the leaf level nodes having the index key and it's row locater. The row located could be the RID or the Clustered index key, depending up on the absence or presence of clustered index on the table.

If you create an index on each column of a table, it improves the query performance, as the query optimizer can choose from all the existing indexes to come up with an efficient execution plan. At the same time, data modification operations (such as INSERT, UPDATE, DELETE) will become slow, as every time data changes in the table, all the indexes need to be updated. Another disadvantage is that, indexes need disk space, the more indexes you have, more disk space is used.

What is RAID and what are different types of RAID configurations?

RAID stands for Redundant Array of Inexpensive Disks, used to provide fault tolerance to database servers. There are six RAID levels 0 through 5 offering different levels of performance, fault tolerance. MSDN has some information about RAID levels and for detailed information, check out the RAID advisory board's homepage

What are the steps you will take to improve performance of a poor performing query?

This is a very open ended question and there could be a lot of reasons behind the poor performance of a query. But some general issues that you could talk about would be: No indexes, table scans, missing or out of date statistics, blocking, excess recompilations of stored procedures, procedures and triggers without SET NOCOUNT ON, poorly written query with unnecessarily complicated joins, too much normalization, excess usage of cursors and temporary tables.

Some of the tools/ways that help you troubleshooting performance problems are:

  • SQL Server Profiler,
  • Windows NT /2000 Performance monitor,
  • Graphical execution plan in Query Analyzer.
Download the white paper on performance tuning SQL Server from Microsoft web site.

What are the steps you will take, if you are tasked with securing an SQL Server?

Again this is another open ended question. Here are some things you could talk about: Preferring NT authentication, using server, database and application roles to control access to the data, securing the physical database files using NTFS permissions, using an unguessableSA password, restricting physical access to the SQL Server, renaming the Administrator account on the SQL Server computer, disabling the Guest account, enabling auditing, using multi-protocol encryption, setting up SSL, setting up firewalls, isolating SQL Server from the web server etc.

Read the white paper on SQL Server security from Microsoft website. Also check out My SQL Server security best practices

What is a deadlock and what is a live lock? How will you go about resolving deadlocks?

Deadlock is a situation when two processes, each having a lock on one piece of data, attempt to acquire a lock on the other's piece. Each process  would wait indefinitely for the other to release the lock, unless one of the user processes is terminated. SQL Server detects deadlocks and terminates one user's process.

A livelock is one, where a  request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely.

Check out SET DEADLOCK_PRIORITY and "Minimizing Deadlocks"  in SQL Server books online. Also check out the article Q169960 from Microsoft knowledge base.

What is blocking and how would you troubleshoot it?

Blocking happens when one connection from an application holds a lock and a second connection requires a conflicting lock type. This forces the second connection to wait, blocked on the first.

Read up the following topics in SQL Server books online: Understanding and avoiding blocking, Coding efficient transactions.

Explain CREATE DATABASE syntax

Many of us are used to creating databases from the Enterprise Manager or by just issuing the command:


But what if you have to create a database with two file groups, one on drive C and the other on drive D with log on drive E with an initial size of 600 MB and with a growth factor of 15%? That's why being a DBA you should be familiar with the CREATE DATABASE syntax. Check out SQL Server books online for more information.

How to restart SQL Server in single user mode? How to start SQL Server in minimal configuration mode?

SQL Server can be started from command line, using the SQLSERVR.EXE. This EXE has some very important parameters with which a DBA should be familiar with. -m is used for starting SQL Server in single user mode and -f is used to start the SQL Server in minimal configuration mode. Check out SQL Server books online for more parameters and their explanations.

As a part of your job, what are the DBCC commands that you commonly use for database maintenance?


But there are a whole load of DBCC commands which are very useful for DBAs. Check out SQL Server books online for more information.

What are statistics, under what circumstances they go out of date, how do you update them?

Statistics determine the selectivity of the indexes. If an indexed column has unique values then the selectivity of that index is more, as opposed to an index with non-unique values. Query optimizer uses these indexes in determining whether to choose an index or not while executing a query.

Some situations under which you should update statistics:

  1. If there is significant change in the key values in the index
  2. If a large amount of data in an indexed column has been added, changed, or removed (that is, if the distribution of key values has changed), or the table has been truncated using the TRUNCATE TABLE statement and then repopulated
  3. Database is upgraded from a previous version
Look up SQL Server books online for the following commands:


What are the different ways of moving data/databases between servers and databases in SQL Server?

There are lots of options available, you have to choose your option depending upon your requirements. Some of the options you have are:

Detaching and attaching databases, 


creating INSERT scripts to generate data.

Explain different types of BACKUPs available in SQL Server? Given a particular scenario, how would you go about choosing a backup plan?

Types of backups you can create in SQL Sever 7.0+ are Full database backup, differential database backup, transaction log backup, filegroup backup. Check out the BACKUP andRESTORE commands in SQL Server books online. Be prepared to write the commands in your interview. Books online also has information on detailed backup/restore architecture and when one should go for a particular kind of backup.

What is database replication? What are the different types of replication you can set up in SQL Server?

Replication is the process of copying/moving data between databases on the same or different servers. SQL Server supports the following types of replication scenarios:

    * Snapshot replication
    * Transactional replication (with immediate updating subscribers, with queued updating subscribers)
    * Merge replication

See SQL Server books online for in-depth coverage on replication. Be prepared to explain how different replication agents function, what are the main system tables used in replication etc.

How to determine the service pack currently installed on SQL Server?

The global variable @@Version stores the build number of the sqlservr.exe, which is used to determine the service pack installed. To know more about this process visit SQL Server service packs and versions.

What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you avoid cursors?

Cursors allow row-by-row processing of the resultsets.

Types of cursors:


See books online for more information.

Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network roundtrip, where as a normal SELECT query makes only one round trip, however large the resultset is. Cursors are also costly because they require more resources and temporary storage (results in more IO operations). Further, there are restrictions on the SELECTstatements that can be used with some types of cursors.

Most of the times, set based operations can be used instead of cursors. Here is an example:

If you have to give a flat hike to your employees using the following criteria:

Salary between 30000 and 40000 -- 5000 hike
Salary between 40000 and 55000 -- 7000 hike
Salary between 55000 and 65000 -- 9000 hike

In this situation many developers tend to use a cursor, determine each employee's salary and update his salary according to the above formula. But the same can be achieved by multiple update statements or can be combined in a single UPDATE statement as shown below:

UPDATE tbl_emp SET salary =
CASE WHEN salary BETWEEN 30000 AND 40000 THEN salary + 5000
WHEN salary BETWEEN 40000 AND 55000 THEN salary + 7000
WHEN salary BETWEEN 55000 AND 65000 THEN salary + 10000

Another situation in which developers tend to use cursors: You need to call a stored procedure when a column in a particular row meets certain condition. You don't have to use cursors for this. This can be achieved using WHILE loop, as long as there is a unique key to identify each row.

Write down the general syntax for a SELECT statements covering all the options.

Here's the basic syntax: (Also checkout SELECT in books online for advanced syntax).

SELECT select_list
[INTO new_table_]
FROM table_source
[WHERE search_condition]
[GROUP BY group_by__expression]
[HAVING search_condition]
[ORDER BY order__expression [ASC | DESC] ]

What is a join and explain different types of joins?

Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table.

Types of joins:


OUTER JOINs are further classified as


For more information see pages from books online titled: "Join Fundamentals" and "Using Joins".

Can you have a nested transaction?


What is an extended stored procedure? Can you instantiate a COM object by using T-SQL?

An extended stored procedure is a function within a DLL (written in a programming language like C, C++ using Open Data Services (ODS) API) that can be called from T-SQL, just the way we call normal stored procedures using the EXEC statement. See books online to learn how to create extended stored procedures and how to add them to SQL Server.

Yes, you can instantiate a COM (written in languages like VB, VC++) object from T-SQL by using sp_OACreate stored procedure.

Also see books online for sp_OAMethodsp_OAGetPropertysp_OASetProperty,sp_OADestroy.

What is the system function to get the current user's user id?

USER_ID(). Also check out other system functions like


What are triggers? How many triggers you can have on a table? How to invoke a trigger on demand?

Triggers are special kind of stored procedures that get executed automatically when anINSERT, UPDATE or DELETE operation takes place on a table.

In SQL Server 6.5 you could define only 3 triggers per table, one for INSERT, one for UPDATEand one for DELETE. From SQL Server 7.0 onwards, this restriction is gone, and you could create multiple triggers per each action. But in 7.0 there's no way to control the order in which the triggers fire. In SQL Server 2000 you could specify which trigger fires first or fires last usingsp_settriggerorder

Triggers cannot be invoked on demand. They get triggered only when an associated action (INSERT, UPDATE, DELETE) happens on the table on which they are defined.

Triggers are generally used to implement business rules, auditing. Triggers can also be used to extend the referential integrity checks, but wherever possible, use constraints for this purpose, instead of triggers, as constraints are much faster.

Till SQL Server 7.0, triggers fire only after the data modification operation happens. So in a way, they are called post triggers. But in SQL Server 2000 you could create pre triggers also. Search SQL Server 2000 books online for INSTEAD OF triggers.

Also check out books online for 'inserted table', 'deleted table' andCOLUMNS_UPDATED()

There is a trigger defined for INSERT operations on a table, in an OLTP system. The trigger is written to instantiate a COM object and pass the newly inserted rows to it for some custom processing.

What do you think of this implementation? Can this be implemented better?

Instantiating COM objects is a time consuming process and since you are doing it from within a trigger, it slows down the data insertion process. Same is the case with sending emails from triggers. This scenario can be better implemented by logging all the necessary data into a separate table, and have a job which periodically checks this table and does the needful.

In Database Systems What Is Meant By Referential Integrity?

Referential integrity is a rule that also helps in maintaining the organized form of data. It preserves the relationships defined between the data entities during the data updates. In the case of relational data model, relations/tables are the data entities. All these entities in adatabase are connected with on another via one or more attributes. These attributes are normally called 'primary key 'of the table.

By applying the rules of referential integrity, you ensures that no any update can be effective that destroy the relations defined between tables , i.e. no any value of foreign key can be entered that does not has a corresponding primary key value in the related table.
In a database, data is stored in more than one relation, thus complete information about an entity may be stored in more than one tables. When two relations/tables are linked with each other through a relationship, one is called a master table and other is called child table.

The referential integrity rules are used in such cases to provide the following advantages:
1. If the record does not exist in master table, it can not be stored in child table.
2. A record can not be deleted from master table unless that record is deleted first from relevant child table

What Is The Scope Of Good Database Design?

A good database is one that is simple to understand and well planned. The database doesn't have redundant tables. One can use ERD's (Entity-Relationship Diagrams) or EER's (Enhanced-Entity Relationship Diagrams) in order to make a good database.

Now about the scope; well if you have good database then
  1. Easy to locate the data or information in no time.
  2. No redundant data.
  3. No repetition.
  4. More security. Like if one is accessing or changing the data other can not change the same data at that time.
  5. Table references (keys like : Primary and foreign keys) are easy to maintain.

What Is A Key? Describe Different Types Of Keys Used In Database?

A key is a single or combination of multiple fields. Its purpose is to access or retrieve data rows from table according to the requirement. The keys are defined in tables to access or sequence the stored data quickly and smoothly. They are also used to create links between different tables.

Types of Keys
The following tables or relations will be used to define different types of keys.

Primary Key
The attribute or combination of attributes that uniquely identifies a row or record in a relation is known as primary key.

Secondary key
A field or combination of fields that is basis for retrieval is known as secondary key. Secondary key is a non-unique field. One secondary key value may refer to many records.

Candidate Key or Alternate key
A relation can have only one primary key. It may contain many fields or combination of fields that can be used as primary key. One field or combination of fields is used as primary key. The fields or combination of fields that are not used as primary key are known as candidate key or alternate key.
Composite key or concatenate key
A primary key that consists of two or more attributes is known as composite key.

Sort Or control key
A field or combination of fields that is used to physically sequence the stored data called sort key. It is also known s control key.

Foreign Key
A foreign key is an attribute or combination of attribute in a relation whose value match a primary key in another relation. The table in which foreign key is created is called as dependent table. The table to which foreign key is refers is known as parent table

Dotnet Framework Interview Questions for 1 Year Experience:

1. What is CLR and it's functions?
2. How memory is managed in Dotnet applications?
Hint: Automatically by Garbage collector
3. What is an assembly?
4. What is a strong name?
5. What is MSIL?

C# Interview Questions for 1 Year Experience:

1. What are the 4 pillars of Object Oriented Programming?
2. What is a Class? What is an Object?
3. What is a partial class?
4. What is a sealed class?
5. What is constructor?
6. What is stringbuilder?

ADO.Net Interview Questions for 1 Year Experience:

1. What is connection string?
2. What is Datareader?
3. Difference between Dataset and datareader?
4. What is Ado.Net?
5. Namespace for using sqlserver database?

ASP.Net Interview Questions for 1 Year Experience:

1. What is web.config file and it's use?
2. What is global.asax?
3. What is session?
4. Which all controls you have used in your project?
5. What is gridview?
6. What is Authentication in ASP.Net and types of authentication?

SQL Server Interview Questions for 1 Year Experience:

1. What is Primary key, unique key and difference between them?
2. What is index? Types of index?
3. What is a stored procedure? Why it is better than inline query?
Hint: Stored Procedure is precompiles and has a execution plan. Hence faster execution.
4. You might be asked to write simple query
5. What is inner join

Basic .NET, ASP.NET, OOPS and SQL Server Interview questions and answers.
  • What is IL code, CLR, CTS, GAC & GC?
  • How can we do Assembly versioning?
  • can you explain how ASP.NET application life cycle and page life cycle events fire?
  • What is the problem with Functional Programming?
  • Can you define OOP and the 4 principles of OOP?
  • What are Classes and Objects?
  • What is Inheritance?
  • What is Polymorphism, overloading, overriding and virtual?
  • Can you explain encapsulation and abstraction?
  • What is an abstract class?
  • Define Interface & What is the diff. between abstract & interface?
  • What problem does Delegate Solve ?
  • What is a Multicast delegate ?
  • What are events and what's the difference between delegates and events?
  • How can we make Asynchronous method calls using delegates ?
  • What is a stack, Heap, Value types and Reference types ?
  • What is boxing and unboxing ?
  • Can you explain ASP.NET application and Page life cycle ?
  • What is Authentication, Authorization, Principal & Identity objects?
  • How can we do Inproc and outProc session management ?
  • How can we windows , forms and passport authentication and authorization in ASP.NET ?
  • In a parent child relationship which constructor fires first ?
MVC ASP.NET Q & A series
  • How to create a simple "Hello World" using ASP.NET MVC template? - Lab 1
  • How to pass data from controller to views? - Lab 2
  • Can we see a simple sample of model using MVC template? - Lab 3
  • How can we create simple input screens using MVC template? - Lab 4
  • How can we create MVC views faster and make them strong typed by using HTML helper? - Lab 5
  • Can we see how easy it is do unit testing for MVC application? - Lab 6
  • What is MVC routing? - Lab 7
  • How can we set default values & validate MVC routes? - Lab 8
  • How we can define actions & navigate from one page to other page? - Lab 9
WCF, WPF, Silverlight, LINQ, Azure and EF 4.0 interview question and answers
  • What is SOA, Services and Messages ?
  • What is the difference between Service and Component?
  • What are basic steps to create a WCF service ?
  • What are endpoints, address, contracts and bindings?
  • What are various ways of hosting WCF service?
  • What is the difference of hosting a WCF service on IIS and Self hosting?
  • What is the difference between BasicHttpBinding and WsHttpBinding?
  • How can we do debugging and tracing in WCF?
  • Can you explain transactions in WCF (theory)?
  • How can we self host WCF service ?
  • What are the different ways of implementing WCF Security?
  • How can we implement SSL security on WCF(Transport Security)?
  • How can we implement transport security plus message security in WCF ?
  • How can we do WCF instancing ?
  • How Can we do WCF Concurency and throttling?
  • Can you explain the architecture of Silverlight ?
  • What are the basic things needed to make a silverlight application ?
  • How can we do transformations in SilverLight ?
  • Can you explain animation fundamentals in SilverLight?
  • What are the different layout methodologies in SilverLight?
  • Can you explain one way , two way and one time bindings?
  • How can we consume WCF service in SilverLight?
  • How can we connect databases using SilverLight?
  • What is LINQ and can you explain same with example?
  • Can you explain a simple example of LINQ to SQL?
  • How can we define relationships using LINQ to SQL?
  • How can we optimize LINQ relationships queries using ‘DataLoadOptions’?
  • Can we see a simple example of how we can do CRUD using LINQ to SQL?
  • How can we call a stored procedure using LINQ?
  • What is the need of WPF when we had GDI, GDI+ and DirectX?
  • Can you explain how we can make a simple WPF application?
  • Can you explain the three rendering modes i.e. Tier 0 , Tier 1 and Tier 2?
  • Can you explain the Architecture of WPF?
  • What is Azure?
  • Can you explain Azure Costing?
  • Can we see a simple Azure sample program?
  • What are the different steps to create a simple Worker application?
  • Can we understand Blobs in steps, Tables & Queues ?
  • Can we see a simple example for Azure tables?
  • What is Package and One click deploy(Deployment Part - 1) ?
  • What is Web.config transformation (Deployment Part-2)?
  • What is MEF and how can we implement the same?
  • How is MEF different from DIIOC?
  • Can you show us a simple implementation of MEF in Silverlight ?
Design pattern, Estimation, VSTS, Project management interview questions and answers

Design Pattern Training / Interview Questions and Answers
  • Introduction
  • Factory Design Pattern
  • Abstract Factory Design Pattern
  • Builder Design Pattern
  • Prototype Design Pattern
  • Singleton Design Pattern
  • Adapter Design Pattern
  • Bridge Design Pattern
  • Composite Design Pattern
  • Decorator Design Pattern
  • Facade Design Pattern
  • Flyweight Design Pattern
  • Proxy Design Pattern
  • Mediator Design Pattern
  • Memento Design Pattern
  • Interpreter Design Pattern
  • Iterator Design Pattern
  • COR Design Pattern
  • Command Design Pattren
  • State Design Pattern
  • Strategy Design Pattern
  • Observer Design Pattern
  • Template Design Pattern
  • Visitor Design Pattern
  • Dependency IOC Design pattern
  • MVC , MVP , DI IOC and MVVM Training / Interview Questions and Answers

UML Training / Interview Questions and Answers
  • Introduction
  • Use Case Diagrams
  • Class Digrams
  • Object Diagrams
  • Sequence Digrams
  • Collaboration Diagrams
  • Activity Diagram
  • State chart Diagrams
  • Component Diagrams
  • Deployment Diagrams
  • Stereo Types Diagrams
  • Package Diagram and UML Project Flow.
Function points Training / Interview Questions and Answers
  • Introduction
  • Application Boundary
  • EI Fundamentals
  • EO Fundamentals
  • EQ Fundamentals
  • EIF
  • Fundamentals
  • ILF Fundamentals
  • GSC Fundamentals
  • Productivity Factor
  • Costing and a complete estimation of customer screen using function points.
  • FXCOP and Stylecop Training / Interview Questions and Answers

VSTS Training / Interview Questions and Answers
  • VSTS questions and answer videos
  • What is Unit Testing & can we see an example of the same?
  • How can we write data driven test using NUNIT & VS Test?
  • Can we see simple example of a unit test for database operation?
  • How can we do automated testing using Visual Studio Test?
  • How can we do Load Testing using VSTS test?
  • Can you explain database unit testing?
  • How can we do test coverage using VSTS system?
  • How can we do manual Testing using VSTS?
  • What is Ordered Test in VSTS test?

Enterprise Application Blocks Training
  • Introduction
  • Validation Application Block
  • Logging Application Block
  • Exception error Handling
  • Data Application Block
  • Caching Application Block
  • Security Application Block
  • Policy Injection Application Block and
  • Unity Application Block

Complete .NET invoicing project end to end
  • Introduction to .NET Projects
  • Different levels of Programming
  • Necessary Tools
  • What should we learn ?
  • The IIS
  • Making UI using .net IDE
  • Database, The SQL Server
  • Connecting with Database
  • Loading the Data Grid
  • Update and Delete
  • Validations
  • Issue with the Code
  • Two Tier Architecture
  • Three Tier Architecture
  • Database Normalization
  • Session and State Management
  • Using Enterprise Application Block
  • Aggregation and Composition
  • Implementing Interfaces and Factory
  • Inheritance relationship
  • Abstract Class Implementation

Share point interview Training / Interview Questions and Answers videos
  • What is SharePoint, WSS and MOSS?
  • How does WSS actually work?
  • What is Site and SiteCollection?
  • What is the use of SQL server in SharePoint & use of Virtual path provider?
  • What is Ghosting and UnGhosting in SharePoint?
  • How can we create a site in SharePoint?
  • How can we Customize a SharePoint Site?
  • What kind of readymade functional modules exists collaboration?
  • Can you display a simple Custom Page in SharePoint?
  • How can we implement behind code ASPX pages in SharePoint?
  • What is the concept of features in SharePoint?
  • I want a feature to be only displayed to admin?
  • How do we debug SharePoint error’s?
  • Why customized pages are parsed using no-compile mode?
  • Can you explain WSS model?
  • How can we use custom controls in SharePoint?
  • How can we display ASCX control in SharePoint pages?
  • What are Web Parts?
  • How can we deploy a simple Webpart in SharePoint?
  • How can we achieve customization and personalization using WebParts?
  • How can we create custom editor for WebPart?
  • SharePoint is about centralizing documents, how similar is to the windows folder?
  • What are custom fields and content types?
  • Can you explain SharePoint Workflows?
  • What is a three-state Workflow in SharePoint?
  • How can we create sharepoint workflow using sharepoint designer?

.NET best practices and SQL Server Training / Interview Questions and Answers
  • Basics :- Query plan, Logical operators and Logical reads
  • Point 1 :- Unique keys improve table scan performance.
  • Point 2 :- Choose Table scan for small & Seek scan for large records
  • Point 3 :- Use Covering index to reduce RID (Row Identifier) lookup
  • Point4:- Keep index size as small as possible.
  • Point5:- use numeric as compared to text data type.
  • Point6:- use indexed view for aggregated SQL Queries
  • Finding high memory consuming functions
  • Improve garbage collector performance using finalize/dispose pattern
  • How to use performance counters to gather performance data
ALTER PROCEDURE [dbo].[AdminSectionFactLinkSave]
        @RegXML AS XML


    DECLARE @SectionFact AS INT

            DELETE FROM SectionFactKnowFactLink WHERE SFKF_SFID IN (
            SELECT SectionFactLink.ITEM.query('./SFKF_SFID').value('.','INT')
            FROM @RegXML.nodes('/DocumentElement/SectionFactLink') AS SectionFactLink(ITEM))

            INSERT INTO SectionFactKnowFactLink(SFKF_SFID,SFKF_KFMasterID)
            SELECT SectionFactLink.ITEM.query('./SFKF_SFID').value('.','INT'),
            FROM @RegXML.nodes('/DocumentElement/SectionFactLink') AS SectionFactLink(ITEM)           
            WHERE SectionFactLink.ITEM.query('./SFKF_KFMasterID').value('.','INT') > 0
        RETURN 0


        EXEC CatchError
        RETURN -1


Catch Error:

CREATE PROCEDURE [dbo].[CatchError]   

    --To keep the error message
    Declare @ErrMsg as varchar(1000)
        INSERT INTO dbo.Error_Log(Error_Date,Error_Msg,Error_Number,Error_Source )

    END TRY 

    set @ErrMsg = ERROR_MESSAGE()
    Raiserror(@ErrMsg -- Error Message
        , 16 --Severity Level
        , 1 --State


-----------------------------------------------------------Dot Net Framework----------------------------------------------

Why would you like to change the company?

1) I am looking for a more challenging career in a firm with a larger employee base such as yours.
2) Keeping in mind my career goals, the time has come for me to move onto the next rung of 
the ladder and make a mark for myself. This can be achieved in a company like this.
3) It is just a career move to enhance my knowledge in my own area of interest.
After completion of this question only interview will go for further questions

Difference between stored procedure and function
1) Procedure can return zero or n values whereas function can return one value which is mandatory.
2) Procedures can have input, output parameters for it whereas functions can have only input parameters.
3) Procedure allows select as well as DML statement in it whereas function allows only select statement in it.
4) Functions can be called from procedure whereas procedures cannot be called from function.
5) Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.
6) We can go for transaction management in procedure whereas we can't go in function.
7) Procedures cannot be utilized in a select statement whereas function can be embedded in a select statement.
Difference between Abstract and Interface
Abstract Class:

-Abstract class provides a set of rules to implement next class
-Rules will be provided through abstract methods
-Abstract method does not contain any definition
-While inheriting abstract class all abstract methods must be override
-If a class contains at least one abstract method then it must be declared as an “Abstract Class”
-Abstract classes cannot be instantiated (i.e. we cannot create objects), but a reference can be created
-Reference depends on child class object’s memory
-Abstract classes are also called as “Partial abstract classes”
-Partial abstract class may contain functions with body and functions without body
-If a class contains all functions without body then it is called as “Fully Abstract Class” (Interface)


-If a class contains all abstract methods then that class is known as “Interface”
-Interfaces support like multiple inheritance
-In interface all methods r public abstract by default
-Interfaces r implementable
-Interfaces can be instantiated, but a reference cannot be created
Index types in SQL Server
Clustered Index

Only 1 allowed per table physically rearranges the data in the table to confirm to the index constraints for use on columns that are frequently searched for ranges of data for use on columns with low selectivity.
Non-Clustered Index

Up to 249 allowed per table creates a separate list of key values with pointers to the location of the data in the data pages For use on columns that are searched for single values 

A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages. A non-clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a non-clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
Included Column Index (New in SQL Server 2005) 

In SQL Server 2005, the functionality of non-clustered indexes is extended by adding non-key columns to the leaf level of the non-clustered index. Non-key columns can help to create cover indexes. By including non-key columns, you can create non-clustered indexes that cover more queries. The Database Engine does not consider non-key columns when calculating the number of index key columns or index key size. Non-key columns can be included in non-clustered index to avoid exceeding the current index size limitations of a maximum of 16 key columns and a maximum index key size of 900 bytes. Another advantage is that using non-key column in index we can have index data types not allowed as index key columns generally.

In following example column Filename is varchar(400), which will increase the size of the index key bigger than it is allowed. If we still want to include in our cover index to gain performance we can do it by using the Keyword INCLUDE.

USE AdventureWorks
CREATE INDEX IX_Document_Title
ON Production.Document (Title, Revision)
INCLUDE (FileName)

Non-key columns can be included only in non-clustered indexes. Columns can’t be defined in both the key column and they INCLUDE list. Column names can’t be repeated in the INCLUDE list. Non-key columns can be dropped from a table only after the non-key index is dropped first. For Included Column Index to exist there must be at least one key column defined with a maximum of 16 key columns and 1023 included columns.

Avoid adding unnecessary columns. Adding too many index columns, key or non-key as they will affect negatively on performance. Fewer index rows will fit on a page. This could create I/O increases and reduced cache efficiency. More disk space will be required to store the index. Index maintenance may increase the time that it takes to perform modifications, inserts, updates, or deletes, to the underlying table or indexed view.
Another example to test:

Create following Index on Database AdventureWorks in SQL SERVER 2005

USE AdventureWorks
ON Person.Address (PostalCode)
INCLUDE (AddressLine1, AddressLine2, City, StateProvinceID)

Test the performance of following query before and after creating Index. The performance improvement is significant.
SELECT AddressLine1, AddressLine2, City, StateProvinceID, PostalCode
FROM Person.Address
WHERE PostalCode BETWEEN '98000'
AND '99999';
Interview questions 
What are differences between Array list and Hash table?

Ans: 1) Hash table store data as name, value pair. While in array only value is store.
2) To access value from hash table, you need to pass name. While in array, to access value, you need to pass index number.
3) you can store different type of data in hash table, say int, string etc. while in array you can store only similar type of data.
What are differences between system.stringbuilder and system.string?

The main difference is system.string is immutable and system.stringbuilder is a mutable. Append keyword is used in string builder but not in system.string.
Immutable means once we created we cannot modified. Suppose if we want give new value to old value simply it will discarded the old value and it will create new instance in memory to hold the new value.
What are the differences between Application object and session object?

Ans: The session object is used to maintain the session of each user. If one user enter in to the application then they get session id if he leaves from the application then the session id is deleted. If they again enter in to the application they get different session id.
But for application object the id is maintained for whole application. 
What are the different types of indexes?

Ans: Two types of indexes are there one is clustered index and non-clustered index
How many types of memories are there in .net? 

Ans: Two types of memories are there in .net stack memory and heap memory
Is it possible to set the session out time manually? 

Ans: Yes we can set the session out time manually in web.config.
What are differences between function and stored procedure?

1) Function returns only one value but procedure returns one or more than one value.
2) Function can be utilized in select statements but that is not possible in procedure.
3) Procedure can have an input and output parameters but function has only input parameters only.
4) Exceptions can be handled by try catch block in procedures but that is not possible in function.
What are the differences between Abstract and interface?

Ans:  1) Abstract cannot be instantiated but we can inherit. Interface it cannot be inherit it can be instantiate
2) Interface contain only declarations no definitions. Abstract contain declarations and definitions.
3) The class which contains only abstract methods is interface class. A class which contains abstract method is called abstract class
4) Public is default access specifier for interface we don’t have a chance to declare other specifiers. In abstract we have chance to declare with any access specifier
Can you Explain Page lifecycle in .net?
Can you Explain .NET architecture in .net?
What is the difference between primary key and unique key with not null?

Ans: There is no difference between primary key and unique key with not null.
What is boxing and unboxing concepts in .net? 

Ans: Boxing is a process of converting value type into reference type
Unboxing is a process of converting reference type to value type.
What are the differences between value type and reference type?

Ans: Value type contain variable and reference type are not containing value directly in its memory.
Memory is allocated in managed heap in reference type and in value type memory allocated in stack. Reference type ex-class value type-struct, enumeration
Is it possible to host the website from desktop?

Ans: Yes 
Why we go for page rendering in Asp.Net Page life cycle?

Ans: Browser understands an only html control that’s why in page rendering we will convert the aspx controls into html controls.
Write a sample query for self join?

Ans: Select e1.ename, e2.empid from emp e1, emp e2 where e1.empid=e2.mgrid;
Can we change the index of primary key on table?

Ans: No
How to change the name of the table or stored procedure in sql?

Ans: sp_rename oldtablename newtablename
For changing the column name
Sp_rename  ‘tablename.[Oldcolumnname]’,’newcolumnname’,’Column’
Ex:sp_rename ‘tblemp.first’,’namechange’,’Column’
How to find out which index is defined on table?

Ans: sp_helpindex tablename
Can you write the program to find the length of string without using library function?

Ans: for (int i=0; str[i]!=”\n”; i++)
What is the difference between scope_identity() and current_identity()?

Ans: Scope_identity and current _identity both are similar and it will return the last identity value generated in the table.
Scope_Identity will return the identity value in table that is currently in scope
What are difference between GET and POST Methods?

GET Method (): 

1) Data is appended to the URL.
2) Data is not secret.
3) It is a single call system
4) Maximum data that can be sent is 256.
5) Data transmission is faster
6) this is the default method for many browsers

POST Method (): 

1) Data is not appended to the URL.
2) Data is Secret
3) it is a two call system.
4) There is no Limit on the amount of data. That is characters any amount of data can be sent.
5) Data transmission is comparatively slow.
6) No default and should be explicitly specified.
What are difference between truncate and delete?

Ans: 1) Delete keep the lock over each row where Truncate keeps the lock on table not on all the row.
2) Counter of the Identity column is reset in Truncate where it is not reset in Delete.
3) Trigger is not fired in Truncate where as trigger is fired in Delete.
4) In TRUNCATE we cannot rollback.
5) In DELETE we can rollback
What is the difference Grid View and between Data Grid (Windows)?

1) GridView Control Enables you to add sorting, paging and editing capabilities without writing any code.
2)GridView Control Automatically Supports paging by setting the ‘PagerSetting’ Property.The Page Setting Property supports four Modles 

a. Numeric(by default)
b. Next Previous
c. NumericFirstLast
d. Next PreviousLast

3)It is Used in
4)GridView Supports RowUpdating and RowUpdated Events.
5)GidView is Capable of Pre-Operations and Post-Operations.
6)GridView Has EditTemplates for this control
7)It has AutoFormat


1)DataGid Control raises single Event for operations
2)DataGird Supports the SortCommand Events that occur when a column is Soted.
3)DataGrid Supports UpdataCommand Event that occurs when the UpdateButton is clicked for an item in the grid.
4)DataGrid is used in Windows GUI Application.
5)It doesnot have EditTemplates for this control
6)It doesnot have AutoFormat
If I write System.exit (0); at the end of the try block, will the finally block still execute?

Ans: No in this case the finally block will not execute because when you say system.exit(0),the control immediately goes out of the program, and thus finally never executes.
What are the different levels of State management in ASP.NET?

State management is the process by which you maintain state and page information over multiple requests for the same or different pages.

There are 2 types State Management:

1. Client – Side State Management
This stores information on the client's computer by embedding the information into a Web page, a uniform resource locator (url), or a cookie. The techniques available to store the state information at the client end are listed down below:

a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.

b. Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state.

c. Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed.

d. Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site.

e. Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.

2. Server – Side State Management
a. Application State - Application State information is available to all pages, regardless of which user requests a page.

b. Session State – Session State information is available to all pages opened by a user during a single visit.

Both application state and session state information is lost when the application restarts. To persist user data between application restarts, you can store it using profile properties.
Abstract Class:
Abstract class is a class which can’t be instantiate. Class should have “Abstract” key word with the name.  In any one of the method of class having abstract method with in it, then it should be define as abstract class. The class which derived the abstract class should have definition of the abstract method. These classes which derived the abstract class and implement the abstract methods call concrete class.
Abstract class may have the definition of function or may not.  Below is the simple example of an abstract class
public abstract alass AbstractStudent
        String Roll

        String FirstName
        String LastName

        Public String GetStudentDetails()

                  // Implementation of Method   

        public String SaveStudentDetails ()
                  // Implementation of Method   

        public abstract String CalculateWage();

So, the class having one abstract method so we need to mention the class as "abstract" .
Difference between Abstract Class and Interface?
Abstract class is a class which can’t be instantiated and which can have methods with definition as well as declaration also. This can be inherited. 

As for Example:

public abstract class AbstractStudent
        String Roll

        String FirstName
        String LastName

        Public String GetStudentDetails()
                 // Implementation of Method  

        public String SaveStudentDetails ()
                  // Implementation of Method  

        public abstract String CalculateWage();


Interface can only contain the methods declaration and can be implemented in the class.

As for Example:
Public interface IStudnet
        String Roll

        String FirstName
        String LastName
        String GetStudentDetails();
        String SaveStudentDetails ();

Below are the few main difference between Abstract Class and Interface

a.    In abstract class method can have definition as well as declaration also. But Interface should have only definition.
b.    All the Methods are Public as default and don’t have any access Modifier Controls in interface, whereas for abstract class we can have access modifier for methods.
c.    Abstract class can have constructor or destructor, whereas interface not.
d.    Abstract class can’t be part of multiple inheritance and we can implement multiple interface.
What do you mean by String objects are immutable?

String objects are immutable as its state cannot be modified once created. Every time when we perform any operation like add, copy, replace, and case conversion or when we pass a string object as a parameter to a method a new object will be created.

String str = "ABC";

Here Replace() method will not change data that "str" contains, instead a new string object is created to hold data "XBC" and the reference to this object is returned by Replace() method.

So in order to point str to this object we need to write below line.
str = str.Replace("A","X");
Now the new object is assigned to the variable str. earlier object that was assigned to str will take care by garbage collector as this one is no longer in used.
What is dll hell problem in .NET and how it will solve?

Ans: Dll hell, is kind of conflict that occurred previously, due to the lack of version supportability of dll for (within) an application
.NET Framework provides operating system with a global assembly cache. This cache is a repository for all the .net components that are shared globally on a particular machine. When a .net component installed onto the machine, the global assembly cache looks at its version, its public key and its language information and creates a strong name for the component. The component is then registered in the repository and indexed by its strong name, so there is no confusion between the different versions of same component, or DLL
What is a Partial class?

Ans: Instead of defining an entire class, you can split the definition into multiple classes by using partial class keyword. When the application compiled, c# compiler will group all the partial classes together and treat them as a single class. There are a couple of good reasons to use partial classes. Programmers can work on different parts of classes without needing to share same physical file
Public partial class employee
Public void somefunction()
Public partial class employee
Public void function ()
What is difference between constants, read-only and, static?

Constants: The value can’t be changed
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.
What is the cross page post backing?

Asp.Net 2.0 fixed this with built-in features that allowed us to easily send information from one page to another.

Button control has property PostBackUrl that can be set to URL of any page in our ASP.Net WebSite where we want to transfer all form values to.
Along with that Asp.Net 2.0 Page class has a property PreviousPage that allows us to get reference to the Page object that initiated the postback (in other words to get the actual reference to the Page object of the aspx page on which user clicked the Submit button on a HTML form).

So for example lets create two sample pages in our Web Application:  
  • SourcePage.aspx
  • DestinationPage.aspx
In SoucePage in Html form we will put two TextBox controls (one for First Name and one for Last Name) and one Button component  and set its PostBackUrl property to "~/DestinationPage.aspx".

    <form id="form1" runat="server">
            First Name:&nbsp;<asp:TextBox ID="FirstName" runat="server"></asp:TextBox><br />
            Last Name:&nbsp;<asp:TextBox ID="LastName" runat="server"></asp:TextBox><br /><br />
            <asp:Button ID="Button1" runat="server" Text="Submit To Destination Page" PostBackUrl="~/CrossPagePostbacks/DestinationPage.aspx" />

When our user clicks the Submit button, all the values from the HTML Form on SourcePage.aspx will be transfered to the DestinationPage.aspx and we will also be able to get reference to the SourcePage.aspx in our DestinationPage with the PreviousPage property like this:

So in our DestinationPage.aspx.cs code-behind we can easily access two TextBox controls on SourcePage.aspx and show them in two label controls like this:
    protected void Page_Load(object sender, EventArgs e)
        // first check if we had a cross page postback
        if ( (PreviousPage != null) && (PreviousPage.IsCrossPagePostBack) )
            Page previousPage = PreviousPage;
            TextBox firstName = (TextBox)previousPage.FindControl("FirstName");
            TextBox lastName = (TextBox)previousPage.FindControl("LastName");
            // we can now use the values from TextBoxes and display them in two Label controls..
            labelFirstName.Text = firstName.Text;
            labelLastName.Text = lastName.Text;

You probably noticed that we first checked if PreviousPage property of current page (DestinationPage.aspx) is NOT NULL, this is done to avoid running our code in case that user opens our DestinationPage.aspx directly, without running a cross page postback.

Also here we checked the another PreviousPage property called IsCrossPagePostBack to see if we really had a CrossPagePostback.
(If Server.Transfer is used to redirect to this page, IsCrossPagePostBack property will be set to FALSE.

TIP: We can be completely sure that we have a  real CrossPagePostback ONLY IF:
  1. Page.PreviousPage is NOT NULL,
  2. PreviousPage.IsCrossPagePostback is true
This important to check to avoid errors in code.

Now this is very useful and i'm sure you are eager to use this in your next project. But wait, we are not over yet!

Finding the controls on PreviousPage with FindControl method and type-casting them from object to their real type is a little messy.
It feels like there must be a better solution for this!

And here it is: We can use the <%@ PreviousPageType %> directive in the header of our DestinationPage.aspx like this
    <%@ PreviousPageType VirtualPath="~/SourcePage.aspx" %>
to declare our previous page type, and then we can access Public properties of the PreviousPage without typecasting.
Now all we need to do is to create some public properties on our SourcePage.aspx.cs to expose data/Controls we want to the destionation page:
    public partial class SourcePage : System.Web.UI.Page
        public string FormFirstName
            get { return FirstName.Text; }
        public string FormLastName
            get { return LastName.Text; }

And then we can change the Page_Load code in our DestinationPage.aspx to much cleaner code like this:
    protected void Page_Load(object sender, EventArgs e)
        // first check if we had a cross page postback
        if ( (PreviousPage != null) && (PreviousPage.IsCrossPagePostBack) )
            SourcePage prevPage = PreviousPage;
            // we can now use the values from textboxes and display them in two Label controls..
            labelFirstName.Text = prevPage.FormFirstName;
            labelLastName.Text = prevPage.FormLastName;     

SourcePage type used in the code is offcourse name of the partial class defined is SourcePage.aspx.cs that inherits System.Web.UI.Page that is automatically created for us when we created new WebForm in VisualStudio.

This code is much cleaner and easier to follow, there is no ugly typecasting, just simple property values to use to retrieve the data from previous page.

When should you use Abstract Class vs Interface while programming?

 Ans: When we want that sub class must implement all the methods of base class. In such a situation we will implement the interface. In the other hand when we want only some method of base class in our sub class then use base class as abstract class.
What is the difference between application exception and system exception?

Ans: The difference between application exception and system exception is that system exceptions are thrown by CLR and application exceptions are thrown by applications.
What is the difference between authorization and authentication?

Ans: Authorization is a process of allowing or denying resources to particular user or record 
Declaration of authorization is

<allow users=”Suresh, Sanjay”/>
<deny users=”Ramana, Rakesh”>
Sometimes authorization allows the unauthorized persons at that time we will use
<deny users=”?”/>
Authentication means

Authentication is a process where we identify the credentials of user i.e. username, password and create an identity to mention user as an authenticated.  
What is the use of n-tier architecture and 3-tier architecture?

Check this article for 3-tier architecture 3 tier architecture example in
How to get the version of the assembly?

Ans: lbltxt.text=Assembly. GetExecutingAssembly().GetName().Version.ToString();
What is the location of Global Assembly Cache on the system?

Ans: c:\Windows\assembly
 What is the serialization?

Ans: Serialization is a process of converting object into a stream of bites.
What is synchronization?

Ans: The mechanism needed to block one thread access to the data. If the data is being accessed by another thread.
Synchronization can be accessed by using system.monitor class
A monitor class methods are enter, exit, pulse for this lock statement is also used
Suppose if we need to synchronize some data at that time we need to place that data in this block
Whatever the data has been placed into the lock block that data has been blocked
What are the thread priority levels?

Ans: Thread priority levels are five types
         0 - Zero level
         1 - Below Normal
         2 - Normal
         3 - Above Normal
         4 - Highest
By Default priority level is 2
What is the difference between .tostring(), Convert.tostring()?

Ans: The basic difference between them is “Convert” function handles NULLS while
“.ToString()” does not it will throw a NULL reference exception error. So as a good coding
practice using “convert” is always safe.
What is Collation?

Ans: Collation refers to a set of rules that determine how the data is sorted and compared.
What is the difference between Primary key and unique key?

Ans: Primary key does not allow the null values but unique key allows one null value.
Primary key will create clustered index on column but unique key will create non-clustered index by default.
How many web.config files are there in 1 project?

Ans: There might be multiple web.config files for a single project depending on the hierarchy of folders inside the root folder of the project, so for each folder we can use one web.config file
What is the difference between throw and throw ex?
What is the difference between view state and hidden field?

Ans: viewstate is secured hidden field is insecure
Viewstate will store large amount of data but hidden filed will store small amount of data. 
What is the difference between binary serialization and xml serialization?
What is the Difference between read only and constant variables?

Ans: Read only can assign the values at runtime only.
Constant will assign the values at compile time only.
We cannot modify the both variable values.
What is static keyword in .Net?

Ans: Static is same as constant variable but we can change the value of static variable and we can access the variables without creating any instances
What is the use of business logic layer in 3-tier architecture in .net?

Ans: Though a web site could talk to the data access layer directly, it usually goes through another layer called the business layer. The business layer is vital in that it validates the input conditions before calling a method from the data layer. This ensures the data input is correct before proceeding, and can often ensure that the outputs are correct as well. This validation of input is called business rules, meaning the rules that the business layer uses to make “judgments” about the data.

However, business rules don’t only apply to data validation; these rules apply to any calculations or any other action that takes place in the business layer. Normally, it’s best to put as much logic as possible in the business layer, which makes this logic reusable across applications.

One of the best reasons for reusing logic is that applications that start off small usually grow in functionality. For instance, a company begins to develop a web site, and as they realize their business needs, they later decide to add a smart client application and windows service to supplement the web site. The business layer helps move logic to a central layer for “maximum reusability.”
What happens when I enter a URL in my browser and click enter?

You type in the URL and hit go. The browser needs to translate that URL into an IP address so it knows what computer on the internet to connect to (That URL is just there to make it easier for us humans - kinda like speed-dial for phone numbers I guess). So your browser will see if it already has the appropriate IP address cached away from previous visits to the site. If not, it will make a DNS query to your DNS server (might be your router or your ISP's DNS server) - see… for more on DNS. Once your browser knows what IP to use, it will connect to the appropriate webserver and ask for the page. The webserver then returns the requested page and your browser renders it to the screen.

The firewall will control connections to & from your computer. For the most part it will just be controlling who can connect to your computer and on what ports. For web browsing your firewall generally won't be doing a whole lot.

Your router (see ) essentially guides your request through the network, helping the packets get from computer to computer and potentially doing some NAT (see… ) to translate IP addresses along the way (so your internat LAN request can be transitioned onto the wider internet and back).

IP Addresses (see ) are unique addresses for computers that basically allow computers to find each other. Think of the IP address as a computer's well address or phone number, you've got to know someone's phone number before you can call them and you've got to know a computer's IP address before you can connect to it. Going back to the start - that's what those URLS and DNS make possible, you don't know John Doe's phone number so you look in the phone book; likewise your computer doesn't know's IP address so it looks in DNS.