• 0

What Great .NET developers should know


Question

I came across these "interview questions" on the web for anyone who'd like to become a .NET developer.

I found a bit depressing that I wasn't able to answer most of these questions, often not even recognizing the terms used. I don't think I'll learn about many of these concepts in university, and it has me wondering on how will I ever get that knowledge. What do you think about that list, can you answer most of the questions ?

Anyway, here's how I fared without resorting to Google or any external reference :

What Great .NET Developers Ought To Know

Describe the difference between a Thread and a Process?

Threads share global variables, they take less time to create and communication between them is easier.

What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

A service runs in background while a “standard” exe has some kind of GUI ?

What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?

Uh, 128MB ? Yeah, not the same as system virtual memory which is quite large… and no idea what the last question is about.

What is the difference between an EXE and a DLL?

DLL = code library, can be used by programs. EXE = a program.

What is strong-typing versus weak-typing? Which is preferred? Why?

Strong typing means each object has a definite type, weak-typing means the type can change at run-time depending on use. Strong-typing is generally preferred because it allows the compiler to do more validating.

Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.

Uh, what ?

What is a PID? How is it useful when troubleshooting a system?

Process Identification number ? If so, used to identify a process, but I couldn’t give an example.

How many processes can listen on a single TCP/IP port?

I’ve no idea.

What is the GAC? What problem does it solve?

Garbage Collector ? If so, solves the problem of memory management.

Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.

I’ve no idea what is interface- and aspect-oriented programming.

Describe what an Interface is and how it’s different from a Class.

An interface holds no data members (at least in C#), it only contains public method declarations. A class can implement multiple interfaces; each is a contract specifying a few methods the class has to support. C# supports only single inheritance for classes.

What is Reflection?

Ability for a program to look at its own types and methods through metadata, but I couldn’t give an example.

What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?

What did you just say ?

Are the type system represented by XmlSchema and the CLS isomorphic?

XmlSchema ? CLS ? isomorphic ? aaargh

Conceptually, what is the difference between early-binding and late-binding?

Early-binding consists in that the compiler knows all the types, late-binding means they will be resolved at run-time (really not sure).

Is using Assembly.Load a static reference or dynamic reference?

What ?

When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?

You decide !

What is an Asssembly Qualified Name? Is it a filename? How is it different?

It’s an attribute of an assembly, a filename is not. (phew)

Is this valid? Assembly.Load("foo.dll");

How should I know.

How is a strongly-named assembly different from one that isn’t strongly-named?

Uh…

Can DateTimes be null?

NO BECAUSE THEY’RE VALUE TYPES! Woohoo answered one question correctly !

What is the JIT? What is NGEN? What are limitations and benefits of each?

JIT is just-in-time compilation, it means that code is compiled just before it is ran, and it can be optimized specifically for the platform. NGEN means all the code is compiled once, so it prevents that kind of optimization. I don’t know why someone would use NGEN though it’s likely because of my ignorance. Hire me please I need the money.

How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?

Basically when an object is not referenced from the application, it becomes a candidate for garbage collection. Generational garbage collection means that candidates are split according to how long they have lived in terms of number of gc passes. An object that has survived many garbage collections is less likely to be collected than one that has not survived one.

Non-deterministic finalization means that you never know when objects will be “finalized”, that is, destroyed by the GC.

What is the difference between Finalize() and Dispose()?

Dispose is a method the user calls, Finalize is a method the GC calls. Both are used to do some special treatment before the object is released.

How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?

The using() pattern makes it so that the object being “used” will automatically be “disposed” (with its method Dispose(), presented by interface IDisposable) by C#. So it’s useful when you need to make sure that after a certain code block, a resource is freed, such as TCP port or a printer or whatever finite resource. This is a form of deterministic finalization.

What does this useful command line do? tasklist /m "mscor*"

That’s a nice question.

What is the difference between in-proc and out-of-proc?

Hey, that one too.

What technology enables out-of-proc communication in .NET?

Ok ok, I get it.

When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

A very nice process for sure.

What’s wrong with a line like this? DateTime.Parse(myString);

Parse returns a DateTime, so it should be assigned to some variable otherwise the line is useless. I’m not sure that’s what you were expecting though.

What are PDBs? Where must they be located for debugging to work?

Files that contain debug symbols, they should be located in the debug folder.

What is cyclomatic complexity and why is it important?

It’s how many paths there are through a method, and it’s important when you need to test the said method.

Write a standard lock() plus “double check” to create a critical section around a variable access.

The only example I know is an implementation of Singleton :

if (instance_ == null) {
	lock();
	if (instance_ == null) {
		instance_ = new Singleton();
	}
	unlock(); 
}

What is FullTrust? Do GAC’ed assemblies have FullTrust?

Uh…

What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?

Weee !

What does this do? gacutil /l | find /i "Corillian"

Weee !

What does this do? sn -t foo.dll

Weee !

What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

Weee !

Contrast OOP and SOA. What are tenets of each?

OOP = global variables/methods are EVIL. Use objects for representing everything and storing every method.

SOA = it’s like soap, but without the p.

How does the XmlSerializer work? What ACL permissions does a process using it require?

Weee !

Why is catch(Exception) almost always a bad idea?

That’s swallowing the exception, right ? Well, exceptions are supposed to tell you about something that shouldn’t have happened, so if the code swallows them they lose their purpose.

What is the difference between Debug.Write and Trace.Write? When should each be used?

Weee !

What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?

Debug means there are all the debug symbols and no optimizations, release is optimizations and no debug symbols, and yes release can be much faster because of said optimizations, but you can’t easily debug it of course.

Does JITting occur per-assembly or per-method? How does this affect the working set?

I guess it’s per-method, but what’s a working set ?

Contrast the use of an abstract base class against an interface?

An interface is just a contract to support certain public methods. An abstract base class can contain data and implementations and private methods. A type could implement multiple interfaces, but it can only have one base class.

What is the difference between a.Equals(b) and a == b?

a.Equals(b) returns an integer, a==b returns a bool.

In the context of a comparison, what is object identity versus object equivalence?

Identity = same object, physically (both references point to the same object). Equivalence = a.Equals(b) returns 0, what it means depends on the implementation of Equals.

How would one do a deep copy in .NET?

I should read that Base Class Library book one more time.

Explain current thinking around IClonable.

Weee !

What is boxing?

It means putting a value type inside an object, making it collectable by the GC. It happens automatically when, say, you add an int to an ArrayList.

Is string a value type or a reference type?

Reference type.

What is the significance of the "PropertySpecified" pattern used by the XmlSerializer? What problem does it attempt to solve?

Um.

Why are out parameters a bad idea in .NET? Are they?

I don’t see why they would be a bad idea, as long as they’re used carefully.

Can attributes be placed on specific parameters to a method? Why is this useful?

Attributes ? Care to explain ?

Juxtapose the use of override with new. What is shadowing?

Can you repeat the question ?

Explain the use of virtual, sealed, override, and abstract.

Virtual is placed in front of methods that can be overridden in derived classes.

Sealed is placed in front of classes that must not be specialized.

Override is the counterpart of virtual, you put this in front of the virtual method you are overriding in the derived class. Otherwise you’re hiding the virtual method = no polymorphism.

Abstract means the class can’t be instantiated.

Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d

Weee !

Explain the differences between public, protected, private and internal.

For a method or field : public means accessible outside of the class, protected means accessible only inside of this or derived classes, private means accessible only inside this class. For a type : public means everyone can see the type, internal is default and means only types inside the assembly can see the type, private is for nested types, it means only the “mother” type can see it. Phew.

What benefit do you get from using a Primary Interop Assembly (PIA)?

Primary what ?

By what mechanism does NUnit know what methods to test?

NUnit, that’s for unit testing right ?

What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}

catch(Exception e){throw e;} rethrows the same exception, the other one throws a standard Exception I think ?

What is the difference between typeof(foo) and myFoo.GetType()?

There is none ?

Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

Whoa, that compiles?

What is this? Can this be used within a static method?

this is what the object uses to refer to itself. And no, because this refers to an instance and static methods pertain to the class rather than instances of the class.

ASP.NET (UI) Developers

I can't answer any of these questions

...

Developers using XML

... haha forget it.

Link to comment
Share on other sites

22 answers to this question

Recommended Posts

  • 0

some that i'll add my answers to:

What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

Services tend to start up when the PC does and before a user logs in and will stay after the user logs out. A standard EXE won't. So for example if you have a VNC server as a service, you can log yourself in at home, but if its just as a standard EXE, you won't be able to.

What is the maximum amount of memory any single process on Windows can address?

It's definately not 128mb :p I think it's 2Gb but not entirely sure and could quite possibly have changed with 64bit windows.

How many processes can listen on a single TCP/IP port?

Last time i checked, only one, well only one per IP:Port combination :p

What does this useful command line do? tasklist /m "mscor*"

Command not found :D

What are PDBs? Where must they be located for debugging to work?

Although it'll be the debug folder, it'll be where the EXE you're debugging is, or it's working directory

What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

Pretty sure the answer is in the question (135), and it's used for RPC

What is the difference between a.Equals(b) and a == b?

Could be correct in what you say but the == way only does a simple comparison where as the .Equals will compare specific things. Without doing .NET code much, the == will either only check they reference the same object, or the .ToString() returns the same data.

What is boxing?

A sport? :whistle:

Is string a value type or a reference type?

string = value, String = reference?

Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

Calls the default constructor when you use the c(string a) constructor. Useful as it avoids code duplication and having the 2 constructors become out of sync

Link to comment
Share on other sites

  • 0
It's definately not 128mb :p I think it's 2Gb but not entirely sure and could quite possibly have changed with 64bit windows.

It's a bit of a trick question. The virtual address space that is assigned to a 32-bit process only has 2GB (8TB for 64-bit) available, but a process is free to allocate any amount of real or virtual memory that the system has available. It just means having to do a little more work to manage the block of memory you've allocated.

Link to comment
Share on other sites

  • 0
Name at least 3 component containers that ship now with the Windows Server Family.

I think (not positive) that this means things like mmc.exe.

Some of those questions (like the difference between interface, object and aspect oriented programming) are architecture astronomy, usually asked at interviews by design pattern wonks who either don't write a lot of real code, or who write the kind of unmaintainable, three-interfaces-for-every-class kind of code that most decent programmers hope they never have to maintain.

However, a lot of the questions there are valid, important questions that you really need to have an answer to to be a successful .NET programmer. For example, the Assembly.Load question can be important depending on your focus; if you're a web developer, it's rather crucial that you know which process hosts ASP.NET on each version of Windows (if for no other reason than you may need to kill the process at some point to stop a server hemmorhaging resources). Your answer to the Equals/== question would probably get you disqualified from any programming job if the interviewer was a programmer.

You're right, you won't learn most of this in university; this is stuff that you have to just "get" on your own at some point, after a lot of practice. Don't get discouraged, but it will take years to accumulate all of the knowledge that makes you a good programmer. I still remember my first .NET application (in 2002ish), which contained all manner of naive bugs and spaghetti code (this was even though I had been programming in C++ for years). I'm just getting to the point (in the last 2 years or so) that I'd consider myself a "good" .NET programmer (as opposed to merely a "capable" one).

Link to comment
Share on other sites

  • 0

wow. I never had a single one of these questions.

My interview was purely scenario based...explain how you would code a solution for this type scenario. And, I just spilled it out from the top of my head.

Interview questions like the ones above are 100% meaningless as it would take mere seconds to google it. No one can remember everything. Hire the person that knows where to find the information.

Link to comment
Share on other sites

  • 0
Interview questions like the ones above are 100% meaningless as it would take mere seconds to google it. No one can remember everything. Hire the person that knows where to find the information.

I completely agree. I went on a lot of interviews last year, and for the record I have 20+ years in IT, 15 as an application developer, and the amount of bs questions is rediculous. I even had one person asking me C++ questions. I asked him if this job involved C++, when he said no I asked why he was asking. The response; "I want to know your background." I didnt bother to respond. My resume clearly states how long I have done VB/application development and the position was only VB. <sigh>

Often development types don't know how to communicate to humans and/or process the business usage for technology. I agree that the questions/answers can be looked up quick enough. When I interview someone I want to know their comunication abilities as well as some of their tech abilities. We can figure out quick enough if someone does not have the tech knowledge.

Funny.scary story:

I was doing phone interviews for a local handbag company. I have 5 "duh" questions (questions that are SO easy that I expect the person to ridicule me for asking) One of the questions is; "Name a few SQL Server or VB data types." I asked this one person and I got silence on the other end of the phone. I asked him if heard me. (I thought; maybe he's on a cell phone) He said he did. ... silence... so I asked again. At that point I heard typing!!!! He was Googling data types! Damn! This guy had an EIGHT page resume! So he had been hired a number of times ...and yet didnt know a thing. So, I can understand why dev types ask the questions, but let's not be rediculous about how far they go. Communication is the number one component.

Link to comment
Share on other sites

  • 0
At that point I heard typing!!!! He was Googling data types!

I don't think I've heard of that before, but I've heard lots of horror stories about people not being able to answer simple (Fizz-Buzz) type questions during interviews.

Communication is the number one component.

I don't know if I'd rate that #1, but definitely in the top 3. I've worked with people who can communicate very effectively, and have some technical skills, but their code is so unsophisticated that there's no way hiring them would ever be a good idea, were I running my own company.

Link to comment
Share on other sites

  • 0
I don't know if I'd rate that #1, but definitely in the top 3. I've worked with people who can communicate very effectively, and have some technical skills, but their code is so unsophisticated that there's no way hiring them would ever be a good idea, were I running my own company.

I have plenty of those types of stories. That's why I believe that communication is the moswt important. If you have some technical abilities, then I can teach you. But if you're great technically and have bad communication than it's not possible to get you to create the technical solutions because you and I cannot communicate. See what I mean?

* There is the person who says he lead a team of three but didn't even know what Source Safe/source control was... that convesation was fun

* There was the guy who, after I spent 15 min telling him about the Co, the technology, etc, and I asked him to tell me about himself and he said it was; "all there on my resume." I don't know about you, but there is no way I could tell you about all my technical skills on 2 pages of paper.

* My favorite, non-interview, story is when I did a contract at a legal firm in Seattle and the programmer was developing against the production db. Mgmt couldnt understand why the app would work one minute and litterely die the next. He was gone on my 2nd day.

No matter how bad you think you've f'ed up on a gig, I have a story where someone did something worse.

I love LOVE this work, but sometimes it's difficult to find good co-workers.

Have a fab weekend

Link to comment
Share on other sites

  • 0
I have plenty of those types of stories. That's why I believe that communication is the moswt important. If you have some technical abilities, then I can teach you. But if you're great technically and have bad communication than it's not possible to get you to create the technical solutions because you and I cannot communicate. See what I mean?
How would you judge a candidate's communication skills in an interview ?
I think (not positive) that this means things like mmc.exe.

Some of those questions (like the difference between interface, object and aspect oriented programming) are architecture astronomy, usually asked at interviews by design pattern wonks who either don't write a lot of real code, or who write the kind of unmaintainable, three-interfaces-for-every-class kind of code that most decent programmers hope they never have to maintain.

However, a lot of the questions there are valid, important questions that you really need to have an answer to to be a successful .NET programmer. For example, the Assembly.Load question can be important depending on your focus; if you're a web developer, it's rather crucial that you know which process hosts ASP.NET on each version of Windows (if for no other reason than you may need to kill the process at some point to stop a server hemmorhaging resources). Your answer to the Equals/== question would probably get you disqualified from any programming job if the interviewer was a programmer.

You're right, you won't learn most of this in university; this is stuff that you have to just "get" on your own at some point, after a lot of practice. Don't get discouraged, but it will take years to accumulate all of the knowledge that makes you a good programmer. I still remember my first .NET application (in 2002ish), which contained all manner of naive bugs and spaghetti code (this was even though I had been programming in C++ for years). I'm just getting to the point (in the last 2 years or so) that I'd consider myself a "good" .NET programmer (as opposed to merely a "capable" one).

Thanks for the tips, especially the remark about my response to Equals vs ==. First I confused Equals with CompareTo, second and more importantly, even if I was correct, I should have given a much more meaningful response, such as "== returns whether the objects are the same, while Equals can be overriden".

I'm fairly self-confident when it comes to my abilities as a programmer, but that's because I'm good at searching Google and msdn, and interviews are a different thing :laugh: .

I don't really want a be a ".NET programmer", I mainly want to be able to excel at any programming task, be familiar with most common problems and proficient at a few technologies, such as .NET.

Link to comment
Share on other sites

  • 0
How would you judge a candidate's communication skills in an interview ?

By asking those ridiculous questions, and looking at how they try to answer them :p

Thanks for the tips, especially the remark about my response to Equals vs ==. First I confused Equals with CompareTo, second and more importantly, even if I was correct, I should have given a much more meaningful response, such as "== returns whether the objects are the same, while Equals can be overriden".

You could override == too. MSDN on Equals and ==

I'm fairly self-confident when it comes to my abilities as a programmer, but that's because I'm good at searching Google and msdn, and interviews are a different thing :laugh: .

I don't really want a be a ".NET programmer", I mainly want to be able to excel at any programming task, be familiar with most common problems and proficient at a few technologies, such as .NET.

:D I hate interviews. I pride myself in being able to get thrown to any project and pick it up quickly. It's a hard skill to demonstrate in interviews. That's where referees come in handy, i guess.

Link to comment
Share on other sites

  • 0
Describe the difference between a Thread and a Process?

Threads share global variables, they take less time to create and communication between them is easier.

I've been asked that question on almost every interview I've had. It's the one question I expect to be asked and I always give an answer using the "posterior extraction method".

Link to comment
Share on other sites

  • 0
Thanks for the tips, especially the remark about my response to Equals vs ==. First I confused Equals with CompareTo, second and more importantly, even if I was correct, I should have given a much more meaningful response, such as "== returns whether the objects are the same, while Equals can be overriden".

Actually, the real answer is that == returns a value indicating whether the references to two objects are the same, and Equals compares some nominally unique aspect of two objects (both can be overridden).

I don't really want a be a ".NET programmer", I mainly want to be able to excel at any programming task, be familiar with most common problems and proficient at a few technologies, such as .NET.

To be perfectly honest, if you're looking for a good job, "proficient" is no longer good enough (note I'm not talking about the brainless corporate programming jobs: those are easy to get... and very unrewarding). There are enough "good" programmers in the world that most companies no longer need to hire the proficient ones.

Link to comment
Share on other sites

  • 0

I laughed hysterically, no offense was meant of course. I couldn't even get 1% of them correctly. It's like .... Chinese for an Arabic person (myself :p)

Link to comment
Share on other sites

  • 0
Actually, the real answer is that == returns a value indicating whether the references to two objects are the same, and Equals compares some nominally unique aspect of two objects (both can be overridden).
The default implementation of Equals is reference equality for reference types and bitwise equality for value types, so it seems like Equals and == really are the same thing after all. :unsure:
To be perfectly honest, if you're looking for a good job, "proficient" is no longer good enough (note I'm not talking about the brainless corporate programming jobs: those are easy to get... and very unrewarding). There are enough "good" programmers in the world that most companies no longer need to hire the proficient ones.
Yeah I was talking about abilities I want to develop before landing my first job. I don't expect my first job to be the most exciting, rather an opportunity to become excellent at something I like and then get a more interesting job at doing that.

For now I'm happy with internships and if I can land one at EA or some other game developper I'd be forever grateful to live. :p

Link to comment
Share on other sites

  • 0
then why do we have string AND String? isn't that .... unnecessary?

lol, System.String is the actual type. string is an alias for that type. You can use either.

Link to comment
Share on other sites

  • 0

Some of these questions are silly or betray the ignorance of the person asking.

What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

A service is a standard EXE (or a DLL hosted in a surrogate). The main difference is that it isn't owned by any interactive user account and is instead run by (and with the privileges of) an account like SYSTEM, and access to it is shared by all users and sessions on the system. Its lifetime is managed by the Service Control Manager, it runs in a separate session, and it can be running regardless of whether any users are logged on.

What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?

That depends on the architecture and version of Windows along with several other factors. Also the question is unclear or incomplete. On a 32-bit x86 client version of Windows, each process has access to a 4GB virtual address space. Under normal conditions, that address space is divided into two 2GB chunks. One for system/kernel VM and one for "user" VM. However, on some systems PAE and AWE can change things, and on 64-bit architectures the address space layout is quite different.

What is the difference between an EXE and a DLL?

Very little, actually. They are both PE files with an identical format. The main difference is actually in how they are handled by the system, and in the specific entrypoints they expose in order to be useful. A native EXE has one entrypoint ("main") whereas DLLs tend to have several. A DLL can be mapped into the address space of a running process dynamically, although technically this is not unique to DLL files (particularly in .NET where EXEs can easily be loaded as assemblies at run-time).

A DLL on the other hand cannot be started as a process like an EXE, although many "surrogate" EXEs exist that don't really do anything except load a DLL and let it do the work (dllhost.exe, rundll32.exe, svchost.exe, prevhost.exe, etc).

Link to comment
Share on other sites

  • 0
Some of these questions are silly or betray the ignorance of the person asking.

They don't really sound like interview questions to me, more like homework help!

Link to comment
Share on other sites

  • 0
They don't really sound like interview questions to me, more like homework help!

They do sound like that. But it's surprising how many of them are actually asked in an interview (the silliest ones first, usually).

The default implementation of Equals is reference equality for reference types and bitwise equality for value types, so it seems like Equals and == really are the same thing after all. :unsure:

Ah, I stand corrected; you are right, that is the default implementation. Though in every overridden implementation, it's always some sort of value comparison (there would be little reason to override, simply to reimplement the == operator).

Link to comment
Share on other sites

  • 0

For what types of job are there interviews with questions like this? I very much doubt for the sort of graduate placements you'll probably be looking for once you leave uni, Dr_Asik. I got accepted into a graduate scheme, albeit a relatively low paying one, without being asked any questions as specific as this. In fact, I'd never actually used any of the programming languages they use - mainly C# and VB .NET. Uni should give you the logic skills, that's what they'll expect and look for. Language specific things follow. I've found the work environment an excellent place to learn.

I'd understand if these questions were being asked for a more senior position though.

I might be wrong, some graduate placements might be more demanding (and better paying :D).

Link to comment
Share on other sites

  • 0
I'm fairly self-confident when it comes to my abilities as a programmer, but that's because I'm good at searching Google and msdn, and interviews are a different thing :laugh: .

During my interview I was asked what I do when I'm completely stuck on something and couldn't think what else to do. Tried to think up a bull**** answer in my head but then had to admit the truth - Google. Fortunately, that was exactly the answer they were looking for.

Link to comment
Share on other sites

  • 0
During my interview I was asked what I do when I'm completely stuck on something and couldn't think what else to do. Tried to think up a bull**** answer in my head but then had to admit the truth - Google. Fortunately, that was exactly the answer they were looking for.

Another good answer is "MSDN" ... that is, if the job is to work with the MS development stack.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.