• 0

Programmers: Your favorite interview questions


Question

I haven't seen one these posts yet on this forum(if there is forgive me : )), but I figured to help out more people looking for programming work I would start a post for employers who are looking to hire new programmers what kind of questions you guys ask. I'm the technical director at a small game studio in LA, and were expanding so I also looking to see what everyone does so I can adjust accordingly.

Some of the basic questions I ask are:

What is global scope/local scope.

What is a template class

What is inheritance/polymorphism/etc.

Than some really basic logic stuff like whats a recursive function, etc etc.

Than I begin to ask a couple questions that are kind of off the wall because one thing I noticed is College graduates from big schools such as UCLA 9/10 can't figure stuff for themselves. Students are so used to stuff getting spoon fed to them, some of which is just nasty. One thing that really irritated me at one of the studios I worked at previously a couple of there senior programmers came to me and said "I don't know how to do xyz, can you help?" This normally is a pretty common thing, except when xyz happens over and over again and its something that easily be found by doing a quick google search.

I ask the interviewee if they can do something that 99% of the programmers out there can't do. They would obviously say I don't know, I would then ask them than to look it up for me on google and write out basic steps on how to get it done. Lets say I ask them how to register a custom Debug Engine in Visual Studio, first google search for "visual studio custom debug engine" which turns up http://msdn.microsof...4(v=vs.80).aspx , with a link to http://msdn.microsof...(v=vs.110).aspx. Even though the information on the latter article is actually wrong if they copied that I would be so happy. I've had guys sit there for 10 minutes struggling, and I feel that's kind of ridiculous. Every programmer in world should know how to use google :/.

Than depending on the level of the job, I would go into some more nitpicker things say in Unreal, Unity, D3D, whatever and if someone didn't know the answer I would ask them to google it and give me an explanation. I had actually had one guy who didn't graduate from a college, straight out of high school and he didn't know something I asked him, and than he immediately asked if he could go on google and look it up. I actually hired him on the spot and he ones of the best programmers I've ever had.

Anyway what kind of stuff do you guys ask?

Recommended Posts

  • 0

That's my fault. I didn't notice that when I initially posted. But like I said before, I'm not even sure how I ended up on the thread to post since I only go to threads though the spy or thread lists.

 

not sure about that, i've read this thread this year or the year before because someone did replied to it so it was in the mini-spy.

  • 0

Hello,

Thank you for your answers.

Im not a guy thats really cares if code is efficient or not. I simply care that the code is clear to me (and other programmers if need be) and it works. Writing code in one line straight is just ugly and serves no other purpose.

  • 0

Hello,

Thank you for your answers.

Im not a guy thats really cares if code is efficient or not. I simply care that the code is clear to me (and other programmers if need be) and it works. Writing code in one line straight is just ugly and serves no other purpose.

Inefficient Code is acceptable to you huh?

 

Must make mental note to never deal with you :)

  • 0

Im not a guy thats really cares if code is efficient or not. I simply care that the code is clear to me (and other programmers if need be) and it works. Writing code in one line straight is just ugly and serves no other purpose.

Efficiency of code has nothing to do with the number of lines of the source...

  • 0

Ya know, a few pages back I explained that we rely more on a conversational style interview that doesn't ask 'coding' questions because the developer you want to hire will reveal their abilities in how they converse. What we see above is a perfect example. raihc3 may likely have answered some random set of coding challenges but his simple statement above tells me so much more about how he will fit in my environment.  I'll take a less skilled developer if they have the right attitude, but pass on a more skilled candidate if they present themselves with in the way raihc3 did. 

  • 0

Hello,

Inefficient Code is acceptable to you huh?

 

Must make mental note to never deal with you :)

Understandable code > Inefficient Code any day of the week.

So Im guessing Brain#### is your choice of language, correct?

 

Efficiency of code has nothing to do with the number of lines of the source...

I used it as a common example; Using more lines than neccesary to do something simple is one way of inefficient code.

Another is declaring too much variables.

There are a lot of examples of inefficient code.

 

Most ridiculous thing I've heard all day.

Not really. Seems to me that you have no idea what you are talking about and have just posted to increase your post count

Efficient code is mostly only important in time critical programs. Other than that, its pretty much worthless in today's world and not a worrying factor.

In C/C++, however, it still does matter in certain cases for when example reserving memory space. You might end up with a very memory hogging calculator! :)

 

Ya know, a few pages back I explained that we rely more on a conversational style interview that doesn't ask 'coding' questions because the developer you want to hire will reveal their abilities in how they converse. What we see above is a perfect example. raihc3 may likely have answered some random set of coding challenges but his simple statement above tells me so much more about how he will fit in my environment.  I'll take a less skilled developer if they have the right attitude, but pass on a more skilled candidate if they present themselves with in the way raihc3 did.

Oh Im sorry, this was a job interview?

The_Internet__Serious_Business_by_HerpDe

There are some things I would never do in a interview; For example, the inefficient code. Employeers love to hear that "the best code is the one that takes less memory and uses the min resources" and all the crap when at the end of the day, they dont look at the code and second, they just want results.

Zag L., let me ask you this, do you perfer the efficient coder that gives you a 2MB program in 6 months that you can put to the market and sell or do you perfer the inefficient coder that gives you a 40MB program in 2 months that you can put to the market and sell? Companies want results from their employees so they can win profit.

If you go with a, you are a programmer.

If you go with b, you are a businessman.

Being loyal to "the unspoken laws of programming" doesnt get the bills paid.

Anyways thats my outlook.

  • 0

Hello,

Understandable code > Inefficient Code any day of the week.

So Im guessing Brain#### is your choice of language, correct?

 

I used it as a common example; Using more lines than neccesary to do something simple is one way of inefficient code.

Another is declaring too much variables.

There are a lot of examples of inefficient code.

 

Not really. Seems to me that you have no idea what you are talking about and have just posted to increase your post count

Efficient code is mostly only important in time critical programs. Other than that, its pretty much worthless in today's world and not a worrying factor.

In C/C++, however, it still does matter in certain cases for when example reserving memory space. You might end up with a very memory hogging calculator! :)

Hello,

Oh Im sorry, this was a job interview?

There are some things I would never do in a interview; For example, the efficient code. Employeers love to here that "the best code is the one that takes less memory and uses the min resources" and all the crap when at the end of the day, they dont look at the code and second, they just want results.

There is also a time though you have to be smart with code.

Using too many variables isn't necessarily a bad thing.. it's worse to reuse variables for purposes outside of what you want to.  Reusing a m_counter variable for anything counter related is okay.  However to reuse m_name for anything string related is not okay.

You also don't want to make code take forever for other people to go through. I am sure if you asked anyone which code was better out of these two:

 

string output = "";

for (int m_val = 0; m_val < 100; m_val++) {
 output = (m_val % 3 == 0 ? "fizz" : "");
 output += (m_val % 5 == 0 ? "buzz" : "");
 console.writline(output.length > 0 ? output : m_val.ToString());
}
string output = "";

for (int i = 0; i < 100; i++) {
   output = "";
  
   if (i % 3 == 0) {
     output += "fizz";
   }

   if (i % 5 == 0) {
     output += "buzz";
   }

   if (output.Length == 0) {
      output = i.ToString();
   }

   Console.WriteLine(output);
}

Most people will go with the top one, as it does exactly what the bottom one does, in less lines, and is just as easy to read.  In the end, the compiler will generate roughly the same code (as both functions do the same) but they are much different in terms of size, and readability.

  • 0

Hello,

There is also a time though you have to be smart with code.

No doubt. There is no need to call a variable "thisisabignamedvariablewithaintegerhodlignvariable" instead of "num".

 

You also don't want to make code take forever for other people to go through. I am sure if you asked anyone which code was better out of these two:

string output = "";

for (int m_val = 0; m_val < 100; m_val++) {
 output = (m_val % 3 == 0 ? "fizz" : "");
 output += (m_val % 5 == 0 ? "buzz" : "");
 console.writline(output.length > 0 ? output : m_val.ToString());
}
string output = "";

for (int i = 0; i < 100; i++) {
   output = "";
  
   if (i % 3 == 0) {
     output += "fizz";
   }

   if (i % 5 == 0) {
     output += "buzz";
   }

   if (output.Length == 0) {
      output = i.ToString();
   }

   Console.WriteLine(output);
}
Most people will go with the top one, as it does exactly what the bottom one does, in less lines, and is just as easy to read.  In the end, the compiler will generate roughly the same code (as both functions do the same) but they are much different in terms of size, and readability.
I think its very very subjective to what is easier or harder to read. But I dont think you cant say yes or no because everyone has their own proper style of programming/coding.

The reason I would instantly choose the second is because its clear its a "if".....the other, programmers that have been programming a while (no pun intended :p ), catch it almost instantly. Others it might take a sec.

Readability is something very subjective and at the end of the day a opinion.

  • 0

Zag L., let me ask you this, do you perfer the efficient coder that gives you a 2MB program in 6 months that you can put to the market and sell or do you perfer the inefficient coder that gives you a 40MB program in 2 months that you can put to the market and sell? Companies want results from their employees so they can win profit.

If you go with a, you are a programmer.

If you go with b, you are a businessman.

Being loyal to "the unspoken laws of programming" doesnt get the bills paid.

Anyways thats my outlook.

 

We have an existing family of applications that are required to run on a very wide variety of hardware, some old, some new. We also have SLA's on how long a particular work unit can take to process as well as SLA's on overall daily productivity so efficiency is VERY important to us - not because we are 'programmers' but because we run a business that relies on the work getting done in certain time frames.

 

Additionally our release cycle allocates 25 coding days before we send the code to QA so I need both, efficient and expedient. I don't know what I would do with a 6 month development cycle.  

 

I'll be honest, guys like you stand out like a sore thumb in interviews. Maybe not where you are located, but certainly in my shop. There is difference between telling someone what you think they want to hear and having a thoughtful discussion about writing code and solving problems. We don't look for programmers, we look for solution providers, individuals that are passionate about the code they write, the way they work with other developers as well as our end users. They are valued contributors to the success of the company, not just a room full of 'coders'. Do I care if they can split a TIF image and do page manipulation in an interview. Nope... even though that might be their first problem. I care about how they think about problems and how they go about learning the things they don't know.

 

And please note, I work for a VERY large company here in the U.S. (something around Fortune 20 last I looked) so this isn't some mom and pop boutique software company making flapping birds apps. 

  • Like 2
  • 0

This discussion about efficiency in these examples is really neither or nor there in terms of actual efficiency at the machine code level. Variables at the subroutine level are just a convenient notion for high level programmers. Programmers should be treating them as such and not trying to reduce the count of them through reassignment, etc. They don't exist outside of high level semantics anyway so it's a waste of time. Similarly, reducing redundant computations in simple branching code like in the case of FuzzBizz is another waste since the code will be hoisted and eliminated anyway. Most critically though, it's red herrings like these things that distract the programmer from focusing on optimizing things that are critical for performance: algorithmic design/complexity and critical paths.

 

This isn't to say that you should just outright try to make code that's potentially inefficient when transformed, but arbitrary reductions on variables and removing simple redundant computations in simple codes doesn't help. 

 

In terms of readibility, I prefer Firey's shorter code above. I feel it's clear and concise and I think interviewers would rather see that from a readability standpoint. From an optimization standpoint though, it is going to result in the use of more costly string concatenation operations that are avoided in the earlier examples. That's the type of thing I mean when I'm talking about algorithmic design: those are the types of things that matter versus removing variables and redundant computations. 

  • 0

Zag L., let me ask you this, do you perfer the efficient coder that gives you a 2MB program in 6 months that you can put to the market and sell or do you perfer the inefficient coder that gives you a 40MB program in 2 months that you can put to the market and sell? Companies want results from their employees so they can win profit.

If you go with a, you are a programmer.

If you go with b, you are a businessman.

Being loyal to "the unspoken laws of programming" doesnt get the bills paid.

Anyways thats my outlook.

 

What makes you think it takes longer to write efficient code? O_o

 

There's a difference between the absolute optimal solution and writing good versus bad code (or just as important, coming up with a good or bad design). I'd say an "efficient coder" is someone who can efficiently (i.e. in a timely fashion) write reasonably optimized, clear, maintainable code.

  • 0

There is also a time though you have to be smart with code.

Using too many variables isn't necessarily a bad thing.. it's worse to reuse variables for purposes outside of what you want to.  Reusing a m_counter variable for anything counter related is okay.  However to reuse m_name for anything string related is not okay.

You also don't want to make code take forever for other people to go through. I am sure if you asked anyone which code was better out of these two:

 

string output = "";

for (int m_val = 0; m_val < 100; m_val++) {
 output = (m_val % 3 == 0 ? "fizz" : "");
 output += (m_val % 5 == 0 ? "buzz" : "");
 console.writline(output.length > 0 ? output : m_val.ToString());
}
string output = "";

for (int i = 0; i < 100; i++) {
   output = "";
  
   if (i % 3 == 0) {
     output += "fizz";
   }

   if (i % 5 == 0) {
     output += "buzz";
   }

   if (output.Length == 0) {
      output = i.ToString();
   }

   Console.WriteLine(output);
}

Most people will go with the top one, as it does exactly what the bottom one does, in less lines, and is just as easy to read.  In the end, the compiler will generate roughly the same code (as both functions do the same) but they are much different in terms of size, and readability.

 

I wouldn't use either. At the very least, both are defining "output" at the wrong scope (which is why at first I thought you were trying to build up one long string versus a different one for each iteration of the loop). Or if you wanted to optimize it, you'd stop creating several strings on every iteration and use a single StringBuilder (assuming this is meant to be C#) or sufficiently sized buffer for your largest string.

  • 0

I wouldn't use either. At the very least, both are defining "output" at the wrong scope (which is why at first I thought you were trying to build up one long string versus a different one for each iteration of the loop). Or if you wanted to optimize it, you'd stop creating several strings on every iteration and use a single StringBuilder (assuming this is meant to be C#) or sufficiently sized buffer for your largest string.

Fair enough, in the end though you got what I was going for.  Yes I could have declared output as a string builder (and use the append function) as well as put it inside the for loop and have it all self contained.  It would of been a couple tweaks that yes would be more efficient, but in general it was the point of compressed but still easy to read.

  • 0

What makes you think it takes longer to write efficient code? O_o

 

There's a difference between the absolute optimal solution and writing good versus bad code (or just as important, coming up with a good or bad design). I'd say an "efficient coder" is someone who can efficiently (i.e. in a timely fashion) write reasonably optimized, clear, maintainable code.

In terms of efficiency, focusing on trying to be clever when unneeded will take longer than not. A nice example of this is people trying to re-do well known recursive algorithms iteratively for efficiency. Most of the time, you are just dropping an explicit stack in such cases so the solutions are less efficient than using the implicit call stack via the iterative version.

 

 

 

F#, no variables:

let fizzBuzz = function
| x when x % 15 = 0 -> "fizzbuzz"
| x when x % 3 = 0 -> "fizz"
| x when x % 5 = 0 -> "buzz"
| x -> string x

[1 .. 100] |> List.iter (fizzBuzz >> (printfn "%s"))

:)

 

:D Fancy! Though to be fair everything would be in registers in either case

  • 0

individuals that are passionate about the code they write

Well, there is our main difference: Im not passionate about code, I just want to write code to get me paid :)

Also, my examples were obviously examples; Not real world numbers/figures :)

  • 0

In terms of efficiency, focusing on trying to be clever when unneeded will take longer than not. A nice example of this is people trying to re-do well known recursive algorithms iteratively for efficiency. Most of the time, you are just dropping an explicit stack in such cases so the solutions are less efficient than using the implicit call stack via the iterative version.

 

Well my point was that it's confusing and inefficient. It looked like he was trying to be clever by "reusing" the output variable, not realizing that reusing variables doesn't mean reusing objects or memory. So it was confusing to read because it was logically scoped incorrectly, while being no more efficient than having it scoped correctly.

 

For weighing a recursive implementation versus iterative, there are several factors to consider. But in the end, if it's a perf critical path, the real answer is "measure, measure, measure."

  • 0

Fair enough, in the end though you got what I was going for.  Yes I could have declared output as a string builder (and use the append function) as well as put it inside the for loop and have it all self contained.  It would of been a couple tweaks that yes would be more efficient, but in general it was the point of compressed but still easy to read.

 

By the way, if I saw that code in an interview, I'd ask you to explain why a StringBuilder would be better (since you seem familiar with it), or how many strings you're allocating in that original version.

 

As far as readability, I'd be fine with either. The first one should have parens around (m_val % 3 == ) and (m_val % 5 == ) though.

  • 0

By the way, if I saw that code in an interview, I'd ask you to explain why a StringBuilder would be better (since you seem familiar with it), or how many strings you're allocating in that original version.

 

As far as readability, I'd be fine with either. The first one should have parens around (m_val % 3 == 0) and (m_val % 5 == 0) though.

Honestly, I am not necessarily the best when it comes to syntax formatting.  However, the thing to keep in mind is those things can be learned and vary from place to place. 

The string builder is nice in that you aren't allocating a new string for each concatenation you do plus strings being concatenated. The string builders append function is adding them directly to the existing string and not allocating a new one (if I am not mistaken).  However I have not used the stringbuilder extensively nor worked on projects where memory is an issue.  I do try to keep my code clean and fluid, and remove unnecessary calls or functions, or use built in .NET solutions when possible.

 

From things I have seen though, if memory is not an issue the difference in speed between the raw concat and string builder is quite small.  It would take several thousand iterations of concatenation to really show the difference.  So from a raw preformance/speed test where memory isn't an issue.. the results are pretty close.  This is based off research I had done a while back.

 

This thread alone though goes to show the numerous ways to solve one problem and that people look for different things.

  • 0

Honestly, I am not necessarily the best when it comes to syntax formatting.  However, the thing to keep in mind is those things can be learned and vary from place to place. 

The string builder is nice in that you aren't allocating a new string for each concatenation you do plus strings being concatenated. The string builders append function is adding them directly to the existing string and not allocating a new one (if I am not mistaken).  However I have not used the stringbuilder extensively nor worked on projects where memory is an issue.  I do try to keep my code clean and fluid, and remove unnecessary calls or functions, or use built in .NET solutions when possible.

 

From things I have seen though, if memory is not an issue the difference in speed between the raw concat and string builder is quite small.  It would take several thousand iterations of concatenation to really show the difference.  So from a raw preformance/speed test where memory isn't an issue.. the results are pretty close.  This is based off research I had done a while back.

 

This thread alone though goes to show the numerous ways to solve one problem and that people look for different things.

 

Memory usage is one factor, though mainly it's about CPU usage (and memory / cache bandwidth). The posted implementation is doing a large number of small allocations and copies. Heap allocations have CPU cost, and in GC'd environments like this, can provoke a collection. Copies are relatively expensive. You're right that the difference is only noticeable if this is executed many times. But when you see loops, these are the sort of things you should be looking for.

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

    • No registered users viewing this page.
  • Posts

    • Im in Ohio, and my VPN endpoint is in Boston. If that helps, it does happen both on and off the VPN. and again only in Edge.
    • It is such a shame. I used to really respect Neowin's articles.
    • So.... slower fixes and slower security updates are preferred? I mean, there is no goldilocks zone here until it can literally update without ever needing a restart, and even then I'm sure someone would complain.
    • [New Deal] Save 73% on a lifetime EbookMagic Starter Plan by Steven Parker Today's highlighted Neowin Deal comes via our Apps + Software section, where you can get a lifetime subscription and save 73% on a lifetime EbookMagic Starter Plan. EbookMagic helps turn your ideas into complete, professionally formatted ebooks without spending weeks writing, editing or designing. Simply enter your title, genre and key details, and EbookMagic creates structured content, polished layouts and a custom cover in just minutes. Instead of juggling separate writing tools, formatting software and cover generators, EbookMagic handles the entire ebook creation process in one place. Generate content, customize your book and export ready-to-use files designed for publishing, sharing or personal projects. EbookMagic Lifetime gives aspiring authors, creators and entrepreneurs the flexibility to build, publish and scale projects over time without ongoing subscription fees. Whether you're building lead magnets, creating educational resources or starting your self-publishing journey, EbookMagic simplifies the process and helps bring ideas to life faster. AI-Powered Ebook Creation AI Writing Assistant: Transform prompts & ideas into complete ebook content. 12 Professional Writing Styles: Write using multiple styles and tones. Author Style Mimicking: Adapt content to preferred writing styles. Personalized Cover Generator: Produce custom ebook covers automatically. AI Audiobook Creator: Convert your books into professional-sounding audiobooks using a variety of realistic AI voices (1 audio book included). Built to Help You Create Faster Lightning Fast Creation: Build complete ebooks in minutes. Target Audience Optimization: Tailor content to specific demographics and reader preferences. Intelligent Chapter Structure: Automatically organize chapters and generate a table of contents. 15+ Genres Supported: Create fiction, non-fiction, business, romance, self-help and more. Quality Assurance: Improve readability and engagement with built-in content optimization. Convert to Interactive Books: Transform standard content into interactive experiences. 57 Major Languages Support: Produce ebooks across supported languages. Ready for Download & Publishing Ready for Sale: Create professional books that can be published and sold on Amazon KDP and other major publishing platforms Kindle & Print-Ready Formats: Export files prepared for publishing. No Watermarks: Create cleaner deliverables for publishing. Commercial Usage Rights: Sell or publish your ebooks. Built-In Editing Tools: Make edits before export. What You'll Get 5 Ebooks per month Each generated ebook can support up to 500,000 words per book. Up to 50 cover generations 12 professional writing styles Author style mimicking Personalized Cover Generator Convert to Interactive Books Multiple languages support Kindle & Print-ready formats Commercial usage rights No watermarks Good to know Length of access: Lifetime Redemption deadline: Redeem your code within 30 days of purchase Access options: Desktop and mobile Max number of devices: Up to 3 devices can be used per license. Available for both new and existing users that are not on lifetime plan. Updates included A lifetime subscription to EbookMagic Starter Plan normally costs $149, but this deal can be yours for just $39.99, that's a saving of $109. For full terms, specifications, and license info please click the link below. Get this EbookMagic Starter Plan lifetime deal for just $39.99 (was $149) Although priced in U.S. dollars, this deal is available for digital purchase worldwide. Support queries If you have queries or need support for any of the Neowin Deals, please use the contact form here. Neowin Deals are managed and sold by StackCommerce who represent Neowin on an affiliate basis. Why we post these deals We post these because we earn commission on each sale so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. So for those that keep moaning and complaining, be thankful we're still online for you to even do that. Other ways to support Neowin Whitelist Neowin by not blocking our ads Create a free member account to see fewer ads Make a donation to support our day to day running costs Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: Neowin benefits from revenue of each sale made through our branded deals site powered by StackCommerce.
  • Recent Achievements

    • One Month Later
      Clizby earned a badge
      One Month Later
    • One Month Later
      Timaximus earned a badge
      One Month Later
    • Week One Done
      Timaximus earned a badge
      Week One Done
    • Rookie
      FBSPL went up a rank
      Rookie
    • First Post
      davidbazooked earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      492
    2. 2
      PsYcHoKiLLa
      169
    3. 3
      +Edouard
      164
    4. 4
      Steven P.
      85
    5. 5
      ATLien_0
      76
  • Tell a friend

    Love Neowin? Tell a friend!