Friday, March 08, 2013

Quotes

I was interviewing an intern candidate today and had her write a very simple method to print a passed in string 100 times.  Fortunately, unlike the last candidate I interviewed, she didn't print the string 101 times.  However, because we interview across a variety of internship spaces, including testing, I asked her how she'd test her method and what sort of values she had to watch for being passed that might be a problem.  She talked about regex for a while and making sure that if the value was a name, it was limited to upper and lower case letters, and that if it was an address, she'd allow numbers.  Then I asked, "What if I pass in a null?" hoping she'd discuss catching it and talk about value types and reference types on parameters.  She wrote down null next to her string parameter on the method, stared at her writing for a while and then replied, "Well...it would print null one-hundred times."  She looked up at me, and a dawning realization crossed her face that she'd given perhaps the stupidest answer she'd ever given to a programming question.  Rather than panic, she took her pen and added two sets of quotes to make it "null" and then provided a much better answer.

No comments: