.Net Developer Interview Questions

by Rick 6. September 2011 18:40

Incase you end up with one of those interviewers that actually thinks a vocabulary quiz is a good representation of programming ability.

Object Oriented Programming

What are the three pillars of object oriented programming?

This question can be asked in any number of ways.  I've received this question as generically as, "What can you tell me about object oriented programming?"  Basically what the interviewer is looking for is a list of the three following terms and their definitions.

  • Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object
  • Inheritance describes the ability to create new classes based on an existing class
  • Polymorphism means that you can have multiple classes that can be used interchangeably, even though each class implements properties or methods in different ways

What is a virtual funtion?

In object-oriented programming, a virtual function or virtual method is a function or method whose behaviour can be overridden within an inheriting class by a function with the same signature.

Are you familiar with any design patterns?

What is the difference between a class and an object?

An object is an instance of a class.  Classes contain definitions of properties and functions.  Objects use these properties and functions.  Classes do not hold any information, while objects do.

ASP.Net

List the page lifecycle events, preferrably in order.

This is a pretty standard question and it's also part of the MCTS test as well.  I'm not going to go into any detail here, just following the link in the question for more detail.

What is view state?

View state is the method that the ASP.NET page framework uses to preserve page and control values between round trips. 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 or fields.

What are some potential issues with view state?

The ASP.NET view state imposes two performance hits whenever an ASP.NET Web page is requested.

  • Serialization and deserialization of view state occurs on all page requests.
  • The __VIEWSTATE hidden form field adds extra size to the Web page that the client must download.

What is session state?

What is application state?

C#

List and define the access modifiers.

  • public
    • Public access is the most permissive access level. There are no restrictions on accessing public member.
  • protected
    • A protected member is accessible within its class and by derived class instances.
  • internal
    • Internal types or members are accessible only within files in the same assembly.
  • private
    • Private access is the least permissive access level. Private members are accessible only within the body of the class or the struct in which they are declared.

List the three ways a question mark, '?', can be used in C#.

Which keyword prevents a class from being inherited?

When applied to a class, the sealed modifier prevents other classes from inheriting from it.

What is an abstract class?

Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes. Members marked as abstract, or included in an abstract class, must be implemented by classes that derive from the abstract class.

How many base classes can a class in C# inherit?

A derived class can have only one direct base class. However, inheritance is transitive. If ClassC is derived from ClassB, and ClassB is derived from ClassA, ClassC inherits the members declared in ClassB and ClassA.

Additionally, a class may implement more than one interface.

What are generics?

Generics introduce to the .NET Framework the concept of type parameters, which make it possible to design classes and methods that defer the specification of one or more types until the class or method is declared and instantiated by client code.

For example...

var fakeList = new List<int>();

The data type "int" in the above example is a generic.

What is a delegate?

Delegates are used to pass methods as arguments to other methods.

What is a static class or property?

A static member of the class is a property, procedure, or field that is shared by all instances of a class.

When/why would you use an abstract class or an interface?

An abstract class defines characteristics of an object type, specifying what an object is.  An Interface defines capability, establishing a contract of what an object can do.

T-SQL

What is the difference between the TRUNCATE and DELETE keywords?

TRUNCATE removes all rows from a table without logging the individual row deletions.  TRUNCATE TABLE is similar to the DELETE statement with no WHERE clause; however, TRUNCATE TABLE is faster and uses fewer system and transaction log resources.

What are the differences among the various joins?

How is GROUP BY used?

What is the difference between HAVING and WHERE?

HAVING is kind of like a WHERE clause for GROUP BY statements.

Which is more efficient, inline sql or a stored procedure, and why?

IIS

Tags:

.Net | C# | LINQ | Interview Questions | JavaScript | jQuery | SQL Server | T-SQL