Hacker News new | comments | show | ask | jobs | submit login
[flagged] Python Interview Questions – Senior (luminousmen.com)
36 points by luminousmen 13 days ago | hide | past | web | favorite | 21 comments





This appears to be a fairly arbitrary list of questions, and the categorizations (including the Junior and Middle lists linked at the bottom) are similarly arbitrary.

For example, some of the Middle questions seem to me more things a Junior should be asked, and vice versa. Specifically, it asks about modulus operator in Middle but expects a Junior to identify the key features of Python. I would seriously expect most beginners to have some idea about modulus, but next to no idea about key features.

At any rate, I very much prefer a short list of very open ended or very focused questions with lots of room to grow. Like 3 to 5 questions should be able to fill an hour if they are good questions by my metrics.

For general questions, I like things like "What are the key features of the language?" but I phrase them as "What are your favorite parts of the language? Least favorite parts?"

Those answers are often very telling -- often Juniors will have very shallow answers or none at all for "least favorite".

For specific questions I like things like "reverse a string". Not so difficult that it's a brain teaser, but plenty of room for diving into different approaches and discussing idioms of the language.

Again, these answers are very telling -- often Juniors will only be able to write one very simple version, but a Senior can write several and talk about the trade-offs.


Of course it is, I think developer's paths are different and these questions are for MY expectations from the candidate. I know that they are not easy, and of course, I do not expect from candidate to answer all of them. But I'm sure if you don't know your tools(Python just a tool, favorite tool, but tool anyway) then you can't call yourself a senior

>I would seriously expect most beginners to have some idea about modulus, but next to no idea about key features.

As someone who began learning with Python, I knew many key features before learning modulus, and I don’t think I have even used modulus in a project yet.

>For general questions, I like things like "What are the key features of the language?" but I phrase them as "What are your favorite parts of the language? Least favorite parts?"

And, picking up where I just left off, this change in phrasing would have made a world of difference at the time haha.


Modulus is middle school math; surely, you would expect a developer to be familiar with at least high school math as theory base?

The question from the article is tricky because the Python modulus implementation differs from, for example, Java. See discussion https://stackoverflow.com/questions/2215318/difference-betwe...

I think it's more the framing. Most devs would understand a remainder conceptually but it's conceivable that they might not know the mod operator in practice.

As a CTO of a python shop I would fail in answering a lot of these off the top of my head.

That is why I do not ask any language specific questions in my interview process. Good engineers can answer all of these questions with an internet connection and a few mins of googling.


Depends on the size of the shop. At a certain level, a CTO's job is not to be a programming expert but be the outward facing representative of IT for an organisation. Understanding tech is paramount but knowing programming minutiae like this is not necessary.

Asking questions like this is a pretty bad approach to interviewing IMHO. It selects more for people who have googled "advanced python interview questions" than it does for people who actually have advanced skills.

I've found tests designed to depict everyday work to be the most reliable indicator's of a candidate's skill.


It's an ok test, probably some of those are more "googlable" than just having it in memory.

(I find funny the "love for metaclasses" that people consider as "advanced Python" - it has its use cases, but it is a bit restricted. Also DO NOT USE ABC - it's one of those "let's take this Java thing and try to fit it" but it manages to be an even weirder transplant than logging)

> Q: Place the following functions below in order of their efficiency.

This is the test where a good amount of candidates will do well on the coding part but will completely miss the math considerations. Performance will vary a lot depending on the size and distribution of numbers (and none of them consider a trivial optimization that's possible)


IME "knows what metaclasses are" is intermediate knowledge while "knowing in which very rare situations use them and when to avoid them at all costs" is more advanced knowledge.

I've seen it enough that I almost consider it a rite of passage for intermediate developers to "discover" an advanced feature like metaclasses and then use them inappropriately to prove their chops, creating an almighty mess in the process.


>DO NOT USE ABC

I get ABC, and can theoretically imagine it being useful for somebody somewhere, but cannot honestly imagine where that is and that it would not also be overkill. And you can usually just do the same thing some other way.

My question is: Why is it good in Java?


> Q: Is Python call-by-value or call-by-reference?

The most dangerous interview question. First you have to establish that the interviewer uses those terms correctly or at least that both of you agree... There's lots of people who know the answer in practice, but never accepted that passing values which are references is not "pass-by-reference".

I've talked to someone who said "this must be just a typo/mistake"... when I pointed out Java is pass by value - in Java spec :-(


>>> Q: Whenever Python exists, why isn’t all the memory de-allocated?

Is it me or this sentence makes no sense?


I think it's a typo: "Whenever Python EXITS, why isn't..."

I think so too, but that still leaves the problem that the statement is false. I was really puzzled by this one.

I think that OP is making a distinction between "deallocated by python's GC" and "dropped on the floor for the OS to collect".

Maybe a practical phrasing would be: "why does running Valgrind on a Python app show that some memory was never freed".


Is it because there might be another Python process running, that was started after this one started, that has mapped the same executable or shared libraries?

Yes, it's a typo, will change

As someone who interviewed ~60 people for senior JS and LAMP positions, good luck with these questions. When I was assigned to do interviews, I assembled a somewhat similar list of questions, but we quickly learned that we will never hire anybody like that. I'm sure there are unicorns out there capable of acing these questions without the internet, but they all work for googles of the world.

I am actually surprised that I managed to answer most of these questions. And I am not an IT professional. I am just a programming hobbyist who also needs automation/scripting at my job. And Python is usually the best choice.

Now, these questions are meant for senior Python developers. How do you define a senior Python developer? I would say: Experience and a deep understanding of the language is what defines a senior Python developer.

But honestly, I think labels like "Python developer" or "Java developer" are not helpful. Good programmers can work with any sane language and they know about principles that work across many languages. Like you (and others in this discussion) I agree that the interviewer should rather look for thinking and engineering skills instead of some language details that are irrelevant in nearly all software projects.

The best code is simple code. Don't try fancy stuff unless it is really needed.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: