Possible Duplicate:
How to prepare yourself for programming interview questions?

I am going for c#-sql server job and I was looking for some link where I could download some questions and answers to have look at.Googling I have found many but because there is no download you have to click and navigate for each question and answer which makes the process very intense.

Do you know a link where I can download some good c#/sql server questions?

Also I am told I will be given a programming task.

I have no idea what that might be. I hope is not some silly math algorithm that I know I will fail or some bubble sort stuff that I have never used in my c# programming life.

Any ideas or examples people have been asked? Or is there a place where managers go to get this stuff?

It's not a case of cheating but I find some questions not really pratical in the real world.

typical silly question for a c# in my view is

What's the difference between a stack vs heap? Now tell me whether as a c# programmer you are really bothered about the stack and heap.

If you do some unboxing the compiler will tell you have an error.etc..

Why they keep asking that question.Even the agency the other day asked me that question.

thanks a lot for any suggestions


All this make sense only if interviewer looks for the same questions. Otherwise they can always ask you something special. You simply know the stuff or you don't. That will show if you are junior / standard / senior or expert in the field. Once company prepares their own questions and tasks you will never prepare for them (unless you have somebody who already works for the company). Separate category is programming task - that can be anything and most often it is programming on the paper which I consider as somehow more stressful.

And yes difference between stack and heap is important. It is general knowledge. General knowledge is something you usually get during university study - that is the reason why developers with university degree are sometimes more successful. If you don't have general knowledge you are just the guy who knows the programming syntax. Here you have some other questions by Scott Hanselman and you will see that general knowledge is required:

  • I'm interested in why you think knowing the difference between stack and heap is important? I have never come across a practical situation in which this knowledge has been of any use to me. – fearofawhackplanet May 11 '11 at 12:59
  • Have you ever seen StackOverflowException? In .NET do you understand difference between storing struct and class in memory? And it is just a beginning. – Ladislav Mrnka May 11 '11 at 13:03
  • I don't see why either or those things require knowledge of how stack and heap work. They are merely implementation details of the framework. – fearofawhackplanet May 11 '11 at 13:11
  • 1
    @fearofwhackplanet, value types and object types are semantically different in .NET, so it is not "implementation details". Even the assignment behaviour is different. A programmer without this knowledge won't even be able to read a code - and will always write a sub-optimal code in a best-case scenario (and an awful code in average). – SK-logic Sep 1 '11 at 12:15

Stack vs. heap is not a "silly" question. A .NET developer who does not know the difference is suspicious, at least. A wise programmer will be able to use this knowledge quite efficiently: detecting that some small objects won't survive after the end of the current region, allocating them on stack may increase performance significantly. Any decent .NET developer have to know what the boxing is and what's the difference between value and object types.

  • The real question is "do you know the difference between value types and reference types". The answer they want is "value types are allocated on the stack, reference types on the heap", although that in itself is largely a fallacy... many values types exist in the heap, and what about registers? You'll often find reference which are allocated in neither the heap nor the stack. Anyway, the question has a lot of scope to go way beyond the "expected" answer and gives you the opportunity to really show off your depth of knowledge... – MattDavey Sep 1 '11 at 13:02
  • @MattDavey, the correct answer is that "values can be allocated on stack, whereas all the objects should be in the heap". And I'd also expect to hear that stack-allocated values are disposed strictly on leaving the method, either via a tail call or return. At least that's an important bit, not knowing it is not a good sign at all. – SK-logic Sep 1 '11 at 13:11
  • that's an implementation detail of the Microsoft .NET CLI that we're all used to, but it's not part of the ECMA specification so can it really be considered the "right" answer? A CLI implementation that allocated all value types on the heap would be equally compliant with the specification.. the question itself is very good to provoke this kind of debate/discussion :) btw I completely agree that a programmer who isn't aware of these details is not a good sign – MattDavey Sep 1 '11 at 14:09
  • @MattDavey, there is no ECMA specs for the recent .NET anyway, so by default, unless specified, any .NET-related questions are Microsoft-specific, obviously. But, yes, you're right - a stackless CLI implementation is possible (but would not make much sense). – SK-logic Sep 1 '11 at 14:27

typical silly question for a c# in my view is

What's the difference between a stack vs heap? Now tell me whether as a c# programmer you are really bothered about the stack and heap.

You must be thinking of the stack and the heap, the two memory structures directly supported by most modern computer architectures. As a programmer, you absolutely should know that stack and heap are two types of data structures, just as you should know what a binary tree, b-tree, linked list, array, and associative array, etc. are. You should also have at least some idea of how to implement all of these, the major benefits they provide, and which is appropriate for a given situation.

You don't need to download a list of interview problems. You need to read a good book on algorithms and data structures.


If you are looking to test yourself to see how your practical skill set is with each language...

C# Tests: http://www.devplusplus.com/Tests/CSharp

TSQL Tests: http://www.devplusplus.com/Tests/TSQL

Not the answer you're looking for? Browse other questions tagged or ask your own question.