What are some good whiteboard programming questions (C#)

Breath_of_the_Dying

[H]ard|Gawd
Joined
Jan 8, 2007
Messages
1,454
I'm trying to practice interview skills and the weakest section I thinks for me right now is my white board coding. Give me Visual Studio and Google and I'm a force to be reckoned with, but I'm not sure if I can write something like a simple file reader/writer or do some string manipulation from memory or without intellisense.

Most of the whiteboard questions I've seen are pretty easy to solve in my mind(in terms or coming up with an efficient solution), but I just need more practice on bringing that to code.

I'm having a hard time coming up with problems that fit the scope of a whiteboard question (~30-40 min, code can generally fit on a whiteboard). Can anyone help with some questions I can practice on?
 
Without naming names or copying/pasting the exact verbiage, can you describe the position you are applying for and its (pre-) req's? What can you share about your own background?
 
The position I'm targeting is for corporate internal apps (like In house customer support or accounting systems) all in the .Net world. From what I've seen it can be various front ends (traditional web forms, MVC, traditional win forms, WPF). Mostly WCF service tiers and connecting to ms SQL servers with ado.net

My background is working on N-tier web systems for a few years, so I'm a little weak on win apps. I've made a few with some file selectors and such, but I relied heavily on googling and copy/pasting for my solution. I couldn't write a file io from memory, but I could easily adapt example code I've seen to make it work.

It's not a really necessary skill to have in my mind, getting the right solution in my mind is always more important than memorizing the ins and outs of a language and framework library. Nonetheless, its still a tool to gauge a candidates skill in an interview timeframe.
 
All the .NET shops I've worked at/interviewed with were quite big on design patterns, and this was reflected in the interview questions, so it'd probably be good to make sure you have your head on straight about those.

Other than that, usually they're looking for your ability to think about a problem and come up with a reasonably intelligent solution. They're usually mostly interested in your thought process, it seems. Most places are not going to ask you to leave if you run into a syntax error, especially if this isn't a particularly 'senior' position.

The actual questions themselves can be nearly anything, I've found. There's a very large, diverse set of questions and topics available for any interviewer that knows how to do their homework, so I personally can't really be any more specific on what you should look at.
 
I'm feeling pretty confident in that area, though there's always more to know. I recently finished dependency injection in .net and even without heavy usage it's already changed my perspective on design considerations. Another book I'm trying to finish up is Head first design patterns which is a modern rehash of the design patterns book by the Gang of Four (which I haven't read but will probably hit up after I go through some other books on my list).

That's actually why I feel like I need to up my coding skills to match my increase in design patterns knowledge. While I can come up with problems for each design pattern to practice with, that's almost like coming up with questions to answers I already know. I think coding up some of the design patterns fall out of scope of solving and coding a problem in an interview timeframe.

Some examples I'm looking for would be...
How to test if a string is a palindrome
How to output a sorted collection of objects when only a 10th of the collection can fit in memory at a time (external sort)

I'm just trying to find more to practice with, but it's not the only way I'm working to become a better software engineer.
 
Some general C# topics I can think of are:
- threading concepts and use of ThreadPool and Task(Factory)
- inter-process communication (e.g. implementing with WCF)
- logging options: name some implementations and/or 3rd party products, capabilities, when you would use some products or logging options and not (necessarily) others for the situation, etc.
- product deployments and version management: MSI or some wrapper like WiX or InstallShield, ClickOnce, etc.
- Entity Framework: how it works, what it wraps up, what it can communicate with, Code First versus Model First (at least knowing the concepts and trade-offs)

Be prepared to speak about how you attack a problem. Who would you speak with? What kinds of high-level questions would you ask, and what areas would/could you drill into? At what point do you feel comfortable enough to prototype? What kinds of prototypes would you produce - fake UI (ie: Balsamiq or Visio), a real UI but with limited/faked functionality, CLI, etc.? What would you do when an escalated support/break-fix situation arises?

When considering maintenance or optimizations to an existing product, what steps would you do to determine where the biggest ROI exists for your time spent? How would you evaluate the decision?

/my_ramblings


Hope this helps.


Edit:
Just thought of some more...
- XAML... obviously. Bindings, bubbling/drilling of events through application tree structure. MVVM is big, though I suspect you've already gone through this point.
- You've already touched on dependency injection, but be ready to speak about the individual pieces under that umbrella (shell, modules, etc.)... plus, at least being aware of the possible libs that establish IoC and dependency injection (e.g. Prism + MEF or Unity). (Side note: I've enjoyed reading Developer's Guide to Prism 4.)
- MVC is another deep dive area, but the high-level points are not too dissimilar to MVVM.
- What communication/features can be deployed or enabled on a Windows web server based upon the server's OS and/or version of IIS.

Some beginning questions could include: namespaces (name some, describe what is contained therein, describe some object usages), knowing progressions of features/enhancements through the various .NET releases (IEnumerable<T>, WCF, Task, etc.)...
 
Last edited:
As an Amazon Associate, HardForum may earn from qualifying purchases.
Thanks, I apprieceate the feedback. I can answer most of them, maybe get a passing grade?

So my question is this. If you were interviewing someone, and they could talk about the above topics beyond whats written in wiki (really understanding DI, DDD, TDD, all those alphabet acronyms) but then when you asked them to whiteboard some code that required string manipulation, hash tables, and fileIO and they totally bomb the coding, how would your impression of them go? And to be more specific on what they bomb, the high level solution is sound and correct, but they couldnt remember the correct method names or parameters.


Thats my worry, much of my work doesn't require heavy coding of that stuff. A lot of it is maintenance, so I'm usually doing a lot of copy/pasting than writing from scratch.
 
Understanding the concepts are one thing, but you've got to know when's, why's, and how's. Whiteboarding would be part of a bigger picture evaluation. I wouldn't ding someone too much for getting a particular method name slightly off, or something that is trivial and would be caught by a compiler error. Seeing this problem multiple times would draw some red flags, as would trying to BS through a verbal screening; not knowing how to properly work with several different, related objects would also draw some red flags.

Keep in mind that the company you are interviewing with are looking for indians, not chiefs. If you can't express your competence concisely through a cursory exam, then you will not be viewed as particularly productive.

Also, some of your earlier comments remind me of the term "coding by coincidence". I suggest you work on some coding cookbooks to gain some familiarity and confidence in the syntax, or else you may give interviewers that kind of impression about yourself.
 
Last edited:
I think that Cracking the Coding Interview is a really good tour of interview questions at different levels. Few savvy interviewers are going to ask questions that now appear in that book, of course, but it's a really swell way to study and refresh before going on a job hunt. And it might be a good way to think of problems to challenge yourself.
 
As an Amazon Associate, HardForum may earn from qualifying purchases.
That's an interesting way to put it. I'd be lying to say I'm not guilty of it, but I wouldn't consider that a bad thing as long as its not the end goal. Perhaps it's bad if the programmer is just happy it works, but not used as a learning tool. I tend to go for the landmines first to see how it breaks, and understand it as best I can in the time I have to work on a project.

I would think that programming by coincidence is more of a spectrum and not a binary practice of on or off. As you get better, you understand more to avoid just making it work, and shift towards doing it right. Having said that I'm doing what I can to learn. I'm starting to collect a library of books I want to go through, I'm following video tutorial and looking for good blogs to follow( some of the MS Scott's come to mind).

Another book in my arsenal is c# 5.0 in a nutshell (nutshell being 1000pages). It's a fairly dry read, mostly good for reference, but it explains what's new in c# from 3 to 5. I wouldn't think I need to have a full understanding of things before 3.5 framework, I'm focusing more on newer technologies.

Whiteboard coding is just a skill I want to improve as a developer. It is definitely not the only way I'm improving
 
I think that Cracking the Coding Interview is a really good tour of interview questions at different levels. Few savvy interviewers are going to ask questions that now appear in that book, of course, but it's a really swell way to study and refresh before going on a job hunt. And it might be a good way to think of problems to challenge yourself.

Thanks, I'll look into it. I don't expect to have the answers to all interview questions memorized, but it really is a skill on its own that needs to be refined.
 
As an Amazon Associate, HardForum may earn from qualifying purchases.
That's a good plan; trying to memorize the answers won't teach you much and can be pretty easy to detect in the interview process, anyway.
 
Back
Top