Thursday, July 28, 2011

Basic ASP.Net 4.0 Interview Questions using VB.Net

Recently, one of my team mates turned in his notice.  Two weeks after his final day, I also turned in my notice.  During my last two weeks, I was tasked with finding a replacement for both positions, not to mention the interview process that I went through.  I was immediately disheartened by the candidates and their lack of ability to answer basic ASP.Net questions.  Here in Atlanta, the .Net development market is exploding (even in the economic downturn).  I was contacted with over 300 recruiters the first week I put my resume out.  I was completely overwhelmed.

So I decided to come up with a list of extremely basic questions.  In my head, I was saying if you can’t answer these questions, you need to call Microsoft and ask for a refund on your Visual Studio license because you aren’t going to be able to accomplish anything with it anyways.

In VB.Net, what method would you use to concatenate two strings?
This is a fairly easy and straight forward question.  It is an ice-breaker and meant to ease the candidate into the questioning process.
9/10ths of the candidates answered string = string1 & string2 (uggghhh)
What I was looking for is string = String.Concat(string1, string2) or the concat method/function.

Describe the concepts behind Application Pooling (What is it)?
I was extremely surprised that not a single candidate we interviewed knew anything Application Pooling.  Although it is more of an Admin role, it is still extremely important for a developer to understand the concept and how to implement it.
Application Pooling is an IIS feature that allows you to define collections of ASP.Net applications into pools (typically by Framework or other like structure).  The idea behind it is that if an application fails, it will only bring down the pool and not the entire server.  Imagine if Google was on a single server.  Their Docs application hits an application level error.  This would bring down the entire server and that means no email or search capability.  Which would mean they would lose their bread and butter applications due to a less important application.  However, using Application Pooling, you can separate the applications and if Docs goes down, you can still get to your calendar.

What is the significance of the Web.Config and what do we use it for.
One of the candidates actually said “This questions keeps coming up during every interview..” and then could not answer it.  My thought process would be that if it continually comes up, might be a point to learn a little about it.
The web.config is used to set configuration to the application.  The single most important tag in the web.config is the <connectionString /> tag.  This allows you to connect to data sources such as SQL, MySQL, ACCESS, EXCEL and other type data warehouses.  There are many things that get defined in the web.config to include but not limited to application wide variables, custom error pages, debugging and tracing information, authentication methods, role definition, profile definition, membership definition, email functionality, handlers, and modules.

Using ADO.Net to connect to a SQL Database, what Namespace would I have to Import?
This is also another lead in question.  I was giving away a lot with this question by telling them that we want to connect to a SQL Database.
However, If I had said a database instead of defining that it is SQL, depending on the datasource, you would need to Import one of three Namespaces.

In SQL, What is the difference between the TRUNCATE and DROP commands when used against a table?
The responses I received back were dismal at best.  Again, In the question I have given half the answer.  You know the commands are used against tables.  I’m still shaking my head at some of the answers.
TRUNCATE is used to remove the data from a table.  However, the table structure is left in place. 
DROP is used to simply remove the table (in its entirety)

Can you use a WHERE clause when issuing the DELETE command?
You either need to use a WHERE clause or start making use of the Job Sites that are out there.  Without the WHERE clause, you are effectively TRUNCATING the table (everything gets deleted).

How many Catch blocks can you have in a Try/Catch block?
Infinite.  You can try to match the exception to as many Catch blocks as you wish.

What is the drawback of Throw New Exception(“Exception Message.”)?
You lose the reference to the original Exception and thus its parameters.

How do you reference the original Exception when you Throw New Exception?
Throw New Exception(“Exception Message”, originalException)

If you receive an Exception and enter the Catch block, does the Finally block run in a Try/Catch/Finally block?
Yes.  Regardless of the outcome, the Finally block ALWAYS will be executed.  This is so that you can close any open data connections, clean up memory issues, or dispose of any unneeded variables.

As an 11th question (If I was on the fence about someone), I would ask the following question:
Define the four basic concepts behind OOP Programming..
There are many definitions (or they are referred to as rules) that have been defined to fit the answer to this question, however the most accepted are:
Encapsulation – This is the wizard behind the curtain.  I know what I have and what I expect in return and that is all I care about.  What gears and buttons the wizard has to push are irrelevant to me.  So in the .Net world, we can take an object, reference it, and pass it some variables and get an expected result.
Polymorphism – Polymorphism allows us to take a method and reference it depending on the number (or type) of variables we pass to it.  For instance:
         Public Sub New(ByVal someVariable As String)
            'Some code goes here
         End Sub
         Public Sub New()
            'Some code goes here
         End Sub
         Public Sub New(ByVal someVariable As Integer)
            'Some code goes here
         End Sub
Before .Net (in reference to Classic ASP), methods could not have the same name.  Here we have three separately defined methods, however they are actually the same NEW method and can exist in the same object.
Inheritance – Inheritance allows you to inherit the properties and methods of one object into another.  So, if I have a Person object and an Employee object, I can inherit the Name property from the Person object into the Employee object.  This makes sense as in order to be an Employee you need to be a Person (unless you own a dogsled team).
Abstraction – This is the breaking down of complex objects into more manageable sub pieces.  This allows you to distinctly define the significant difference between an object and all the other objects. 

At this point, if they were doing fairly well, I would start the technical interview.  There are other basic questions I could have asked, but I think this represents a broad range of the functionality and programming in ASP.NET.  The problem is, some of the recruiters out there don’t know the drug they are pushing.  For instance, I had one recruiter ask me if I develop in ASP.NET (Which was clearly on my resume).  I responded with “Yes, in VB.Net.” She then said, “No. I said ASP.Net.” I couldn’t believe it and responded “Yes, I have done it in VB.Net.” Her next reply floored me, “They want someone who knows ASP.Net, not VB.Net.  Perhaps you are not understanding my question.”  Now, had they of wanted someone who knew C#, that would have been a different matter (I do happen to know C#) but as it were, picking my chin off the floor “Uhmmm, I JUST NOW accepted a position with another company, have a good day.” and I hung up the phone.

Happy .Netting… Saleh

1 comment:

  1. Great work, really appreciate your effort for the information and being enrolled in the OOps, .NET and SQL INTERVIEW Preparation i found your information very helpful.