Python Forum
Drop Dead Simple Interview Questions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drop Dead Simple Interview Questions
#11
I had to take a formal test when I went to work at my first telecommunications job,
even though I had already been there for over a year as an independent consultant.
I seem to recall that I thought the test could be passed by someone who had just taken
a high school programming class. It was implemented by non IT people (who thought quite
highly of it's value).
Reply
#12
Ok, so let's use that as an example.  Here's how I'd write it (without spending a ton of time thinking about it) ... (and honestly, my first thought was just is_number = lambda x: x.isdigit() lol)

>>> def is_number(s):
...     try:
...         ignore = float(s)
...         return True
...     except ValueError:
...         pass
...     return False
...
>>> is_number(5)
True
>>> is_number("7")
True
>>> is_number("-7.432")
True
>>> is_number("your mom")
False
You guys must be more impressive than me.  I've always been on the receiving end of interviews, never the giving end :p
Reply
#13
Yeah, isdigit() is a lot of people's first thought, and it's not very inclusive. What you have that works, for such a simple question we disallow using a tool that basically does the task directly.

I prefer to give questions that don't prohibit using anything, that (hopefully) can't be Google'd too easily, but this is the closest I get to "dead simple". sqrt() (using binary search) is another simple-ish one.
Reply
#14
Does sqrt = lambda n: n ** 0.5 count as cheating?  :p
Reply
#15
(Feb-13-2017, 08:44 PM)micseydel Wrote: I wouldn't ever give Fizzbuzz, I'd be afraid of insulting the candidate. Are you interviewing them for a specific role or position? Are they expected to be familiar with computer science?

A warmup question I often give is "write a function which takes in a string and returns true if the string represents a number." The candidate is meant to clarify the requirements, and be able to code it up after. If they write something that just handles non-negative integers, I start providing additional sample cases for negative and floating point numbers. They also often don't accommodate for "-", "." and sometimes even after that, "-.".

Well, you didn't think about the thousands separators either. And this question is more complicated than you think. Whistle
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#16
Hah! I had this job "interview" for maintaining the National TV servers. The questions... :) Am I able to sit for hours watching few screens with data flowing from some monitoring programs? Do I have experience with BSD? When I said that I have Linux experience... Do I know Python? I said that I don't. The next one was am I able to read fifty pages per day in English is I want to study... That was all. Between the common chat. Nice people! I am happy I didn't get the job. It was well paid and I'd learn a lot. But I am much better now. And free from this 8-17 rhythm of life
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#17
(Feb-13-2017, 08:56 PM)nilamo Wrote: Does sqrt = lambda n: n ** 0.5 count as cheating? :p
Yes =p

(Feb-13-2017, 08:56 PM)Ofnuts Wrote: Well, you didn't think about the thousands separators either. And this question is more complicated than you think.
I tend to want a solution that accepts what most programming languages do for floats (without concern for underflow/overflow), in ASCII and the locale I share with the candidate. So, no "thousands separator" and the decimal separator is a dot rather than a comma. I also don't expect scientific notation, but I appreciate it when candidates suggest it.
Reply
#18
(Feb-13-2017, 08:49 PM)nilamo Wrote: You guys must be more impressive than me.  I've always been on the receiving end of interviews, never the giving end :p

I don't ask code questions, because all I get to see is a first shot, and this first shot is very often plain crap. What makes a good programmer is the ability to think it over and rewrite it, but you have no time for this in an interview.

Good programmers like coding so they are not one-language ponies (especially if you hire them for a boring language like Java...), and likely also code at home. So I ask candidates about the compilers they have on their own PC and their pet projects. Some are embarrassed,  others lighten up. It also make them consider that even if the job can be a bit boring, it will at least be done with like-minded people, so there is some hope that they will be able to use some not too decaying technologies. Because, remember that the interview works both ways, programmers are not that desperate, and you also have to attract the good ones.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#19
Yeah, interviews are definitely very artificial. Unfortunately, in Silicon Valley at least, there aren't enough at-home programmers to go around :)

I agree 100% of the interview going both ways though. I think that's the part my current company is really struggling with. Closing the people that we want is tough!
Reply
#20
At my current job's interview (which was 5 years ago), I was handed a napkin and asked to write an sql query to get a count of how many "billable leads a certain customer had". I looked at him, and asked "so... what's the table structures like?" He replied "it doesn't matter, I just want to see how you think." Afterwards, he said the position was for a c# developer, and he asked if I wanted the job. I told him I had never even looked at c# before, and he replied "it doesn't matter, you'll figure it out."

My last job's interview... nearly 9 years ago... I walk into the room, we shake hands, then one of the guys gets a text, he makes a comment to the other guy, and they both excuse themselves. I was left alone in the room for nearly an hour, and when they came back, they said simply "some days emergencies happen. Thanks for not leaving." (I think that particular issue was the old computer which did all the shipping through ups and fedex had finally died, and a replacement had to be quickly setup).

Anyway, interviews are weird places.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pipenv & Requests Author Kenneth Reitz Interview Evrone 1 2,078 Jan-28-2021, 02:16 PM
Last Post: elizabethlvova
Star Flask Creator Armin Ronacher Interview elizabethlvova 1 1,924 Dec-16-2020, 09:10 AM
Last Post: Evrone
  Becoming a Self-Taught Programmer: Cory Althoff Interview Evrone 0 1,886 Dec-16-2020, 08:49 AM
Last Post: Evrone
  PEP 594 -- Removing dead batteries from the standard library ichabod801 3 2,764 May-31-2019, 01:23 PM
Last Post: heiner55
  Best resource to learn and pass interview oryucouk 5 3,058 May-18-2019, 05:19 AM
Last Post: heiner55
  MIT Interview with Guido Larz60+ 3 3,335 Nov-27-2018, 10:45 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020