.NET, C# ,SQL Server Interview Questions


I attended interviews on .NET. I faced some 4 tecnical interviews. Some, I cleared and some I did not. Thought it would be useful if I post the questions.Here, I have compiled a list of all the questions in 4 interview questions. I think I have covered most of them.

Below questions I faced in 4 interviews. I have compiled them and written here.

Questions :


.NET and OOPS :

What are different models of programming ?

What is structured and object-oriented programming?

What is abstraction and interface? Differences between them. (faced this in 3 interviews)

what are the uses of abstract classes and iinterface. In which situation , you will use abstract class and when interface

What is inheritance and can you inherit from 2 classes.

Can you call a parent class method from child class object?

what is a constructor and its uses?

what is a sealed class?

what is a generic class (got this in almost every interview)

why is generics used?

what are data structures?

Differences between sortedlist and hashtable.

what is a dictionary?

what happens if there are duplicate keys in a dictionary?

what are extension methods and lambda expressions?

what is an assembly?

what are private and shared assemblies?

what is gac?

how a assembly is registered in gac?

what is a stong key?

what is a com component and how is it used in .NET framework as in how does the .net framework works with it?

what is serialisation and deserialisation, its uses and different types of serialisation?

what are appdomain and apppool

what is connection pooling

describe ADO.NET , how does it function?

differences between datasets and datareaders, give situations in which each one will be advantageous to be used?

differences between xml and html

can we have custom tags in html and is it necessary to close tags in html

how to populate a tree view control from an xml

different types of parsers for xml and code samples for it.

difference between dataset clone() and copy()

what is a delegate, why is it used and its advantages?

what are events, relation b/w events and delegates

what are threads, why is it used

what are optional parameters and give the code for that

In one interview, he gave me a situation where an application has some 20 classes implementing an interface. Later at some point of time, a class needs one extra method to be added (new functionality). So, what will be your approach? Will you add the method signature to the interface and implement it in all the classes?

what are design patterens?

what is a singleton and factory pattern?


MS SQL Sever :

what is an index?, types of indexes (clustered and non-clustered) and describe each

what are constraints in sql

how to remove duplicate records in a table

how to get the second highest value in a column from a table

what is a stored procedure, trigger and a function

Regards,
Raman S V


Comments

Author: Aswini Aluri17 Dec 2013 Member Level: Silver   Points : 1

5.What is inheritance and can you inherit from 2 classes.
Ans:no You cannot inherit two classes using inheritance instead of that you will use interfaces in c# .net.

Author: Karunanidhi17 Dec 2013 Member Level: Gold   Points : 5

2. What is structured and object-oriented programming?

Structured : c Lang is Structured Programming Lang. it is top down process.It doesn't depends on any objects which u create.
Object-Oriented: It is bottom up approach. it is fully based on what we create objects in program. C++,Java, C# and so on.. All working based on what you create as objects.
5. What is inheritance and can you inherit from 2 classes?
Ans : Inheritance is serving from base class. in other words, it is re usability. We can use the base class properties from derived class.
Yes.. We can inherits from two classes through Interface in .net.

what is a sealed cl

Author: naveensanagasetti17 Dec 2013 Member Level: Gold   Points : 6

1) What is abstraction and interface? Differences between them. (faced this in 3 interviews)

A) Interfaces – C#, doesn't supports multiple inheritance using interface class we can able to inherit multiple classes.
Abstract – In base class we declare the method as Abstract keyword and it is optional to implement that in base class. But that is mandatory to implement that in derived classes.



2) what are the uses of abstract classes and interface. In which situation , you will use abstract class and when interface

A) Interfaces – C#, doesn't supports multiple inheritance using interface class we can able to inherit multiple classes.
Abstract – In base class we declare the method as Abstract keyword and it is optional to implement that in base class. But that is mandatory to implement that in derived classes.

3) Can you call a parent class method from child class object?
A)Yes, Using Override keyword we can able to call parent class method in child class. But that class Should be Virtual class or Abstract class. Then only you can able to derive that in child class.


4) what is a sealed class?
A) To prevent Override the methods and properties from base class to derived class using Sealed class. By default every class is sealed class only. But using Abstract and Virtual keywords we can able to override base class properties.

5)what is an assembly?
A)An assembly is a collection of classes and objects and methods we can developed that in any language but packed as a dll, we are called that as a assembly.
6) what are private and shared assemblies?
A)Private Assembly – we will use private assembly with in single application only. During this multiple copies to be generated.
SharedAssemblies – we will use Shared Assembly throughout project / solution. During this one instance to be created we can call that at n no.of times in our applications.

7) what is gac?
A)GAC, global assembly cache- when the assembly requires more than one project or application then we need to make that as a strong name and keep that in GAC folder.
When we called the assembly is strong named, to follow below steps then we are calling that as a strong named assembly.
• Public key token
• Name
• Versioning
8) how a assembly is registered in gac?
A) open command prompt and execute the below command
For install purpose
GACUTIL – I dllname.dll
For unstill purpose
GACUTIL –U dllname.dll


9) what is a stong key?
A)if the assembly maintain the following features then we are called that as a strong named assembly.
• Public key token
• Name
• Versioning


10)what is serialisation and deserialisation, its uses and different types of serialisation?
A) Serialization - The process of converting in- memory form of data into byte format is called Serialization.
DeSerialization is the total reverse process of Serialization.

Author: naveensanagasetti17 Dec 2013 Member Level: Gold   Points : 5

11)differences between datasets and datareaders, give situations in which each one will be advantageous to be used?
A)Dataset: This is disconnected architecture.
For filling data to dataset we will use DataAdapter.
Forword and backword action.

DAtaReader: This is connected architecture,
For filling data to objects we will use DataReader,
Only forword action to be done.

12)difference between dataset clone() and copy()
A)DataSet.Clone() – it clone the columns and give same structure of a table.
DataSet.Copy() – it will copy one table data into another table.




13) what is an index?, types of indexes (clustered and non-clustered) and describe each
A)For faster execution purpose we will use Indexes during this we can fetch table data very fastly.
There are 2 types of indexes
1) Clustered index – it fetch data based on column names.
2) Non-ClusteredIndex – It fetch data based on references.
14)what are constraints in sql
A)To overcome the duplicates in a table purpose we are using constraint. In SQL Server we have around 5 types of constraint available in sql server. Those are
Primary Key Constraint
Foreign Key Constraint
Unique Key Constraint
Not Null Constraint
Default Constraint.

15)how to remove duplicate records in a table
A) using constraints we can easily overcome duplicate records in a table.

16)how to get the second highest value in a column from a table
A) declare @table table
(
empname varchar(100),
sal money
)

insert into @table
values('naven',25000),
('raj',45000),
('karthi',15000)

select top(1)* from @table
where sal not in ( select max(sal) from @table)
order by sal desc


17)what is a stored procedure, trigger and a function
A)StoredProcedure- using SP we can compile the script at once and we can use that n no.of time in our application.
Function – We just create one function and we can able to use that function in our application whenever we need.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: