Another interview and another set of questions to answer. Personally, I enjoy most interviews. You get to test yourself out and work on your communication skills a bit. And on the other hand, I hate interviews. Alot. They're sometimes awkward and within the first 5 minutes, you'll realize that you're wasting your time there. This latest interview I had, was the former. Here's a few questions I was asked, plus my answers, plus the correct answers where applicable.
I mumbled my way across a few of these latest questions, like with most interviews. It happens. Many times it's due to a disconnect in the interviewer's vocabulary. When I write code I don't usually remember the official name given to the particular technology that I am using, and as such when asked about it I mumble my way through it. Important lesson: Technology keywords are important.
None of these are "bad" questions in any way. Some might be irrelevant to the job position and others are pretty trivial, but they still need to be answered. And for the questions that I didn't know, well, lucky for me there is Google so I'll write what the appropriate answer is here. Each interview is a good excuse to go back and learn and try out something that you haven't done before. I'll only mention the technical questions, as the non-technical ones can be answered differently by everybody such as "What scares you? @_@ ". One of my favorites.
1. What Is In An HTTP Response Header?
I've only actually looked at a response header maybe once or twice before. So when asked, all I could answer was "X-Powered-By", and that's because that's the one that I needed to know for a project once. So let's take a look at what's inside of a Response Header:
And there you go. Not an overly important question, but at least now it has scarred me for life and I won't forget it.
2. Weak Typing vs Strong Typing
Another question that isn't very practical, but requires and answer. And technically should be known by anyone that has studied computer science. Usually weak vs strong typing is a programming language property that doesn't have a 100% set definition. But since we need one, and fast, it represents how a language treats variable types. Weak typed languages don't require you to explicitly state the type of a variable, such as javascript:
var number = 10;
var number2 = "10";
We'll leave it up to Javascript here to figure out what type our values are. While one does look like an integer and the other a string, depending on the usage they could end up being treated differently.
C# however would be considered a strongly-typed language, as it requires us to explicitly tell it what types each variable declared are.
int number = 10;
string number2 = "10";
Normally, Strong Typing is preferred as it allows the compiler to optimize your code better and more importantly we don't have to worry with how the variables will get treated in our code. For example, integers will be integers, and if we need them as strings, we will need to explicitly state so.
3. What Is The Difference Between A Thread And A Process?
i can haz answerz. The technical difference is that a thread runs in a shared memory space while processes run in separate memory spaces, apparently. My answer was not that. It was not that at all. Personally, I've never seen a project where knowing the difference would be of benefit, but maybe that's just me.
And for a slightly more technical definition thanks to Microsoft:
Each process provides the resources needed to execute a program.
A thread is the entity within a process that can be scheduled for execution.
I will have forgotten that by next interview.
4. What Is The Difference Between Early Binding And Late Binding
I've only heard of the term in passing, and maybe in a classroom some years ago. Again, this is one of those questions where you probably don't need to know the answer to do your job. Early and Late Binding relates to Visual Basic as C# only does early binding. Early binding refers to an object whose type is explicitly stated, such as:
' Create a variable to hold a new object.
Dim FS As System.IO.FileStream
' Assign a new object to the variable.
FS = New System.IO.FileStream("C:\tmp.txt", System.IO.FileMode.Open)
Early Biding allows the compiler to make optimizations and allocate memory before the application runs, which is why it is the preferred approach.
Late Binding occurs when an object is assigned to a variable of type Object. These objects can hold a reference to any type, however does come with it's pitfalls, such as lack of optimization like I mentioned above.
5. Name A Few .NET View Engines
This one threw me off initially with an akward mantra of "View Engines..." repeating off of me every 3 seconds or so. There are currently 2 view engines in .NET. You have your traditional .aspx pages that make use of the <%= %> tags to bind server-side data. And then you have your Razor view engine which makes use of the @ symbol to incorporate binding code to the front-end. I've personally used both, of course I didn't refer to them as View Engines. I just called it Razor, or the other one. Once again, keywords are important.
6. What Is A Namespace
The concept of a namespace is pretty simple. It's a way to bundle similar classes together into a single grouping, and allows for classes to have identical names system wide. At least in my world that's what it is. It doesn't exactly have to be classes, but it's how I mainly come into contact with namespaces nowadays. Yet another slightly less than practical question. Alot of those it appears.
7. What's In The BundleConfig File
This is a very specific question, of which I'm not a big fan of. I've never seen a bundle config. And while that is as good an answer as any, it makes one look very idiotic. .NET has thousands upon thousands of modules, and it's a shame that sometimes getting the job comes down to being lucky enough to have used the ones you get asked about. I once had an interview where I was asked the namespace for about a dozen classes. Lucky for me I nailed 11/12 and so the manager hiring was very impressed. Had he asked me about multithreading/javascript/css or any of a dozen things I would of been out of luck.
So, onto a better answer. The BundleConfig is a .NET 4.5 feature that aids in bundling multiple files into a single file in order to reduce the amount of HTTP requests and speed up the first page load. If you've worked on a website you've probably worked on custom implementations of this feature. You grab all the javascript files and throw them into one giant one. I've done that on every website I've worked on so far, but that wasn't important, as what matters here is the BundleConfig. Helpful sometimes. While you will have only one HTTP request for a JS file, you'll have a much larger JS file to work with. I used to work on a website with custom JS files for each page generated, so this would not have applied, otherwise instead of loading one small JS file for a particular page, I'd be loading the entire websites JS files.
The Interview Went Well
The interview actually went surprisingly well, regardless of my hymn's and haws and mantras of confusion. Personally, the longer you do this job, the more keywords you tend to forget. Which is definitely a problem during interviews, because keywords tend to be a big part of the process. You can ask me about View Engines and Late Binding and watch me struggle for a bit, but at the end of the day, if you need to create a custom customer support module on your website, then give me a day and the magic will happen.
I hope these questions help someone out there or at least keep them in the back of your mind if in case you find yourself being asked about them. And as for me, I got to learn about the BundleConfig and Visual Basic late binding. The more you know :)