Re:Harder programming questions do a worse job of predicting...
by Afforess on Monday February 18, 2019 @02:12PM
(#19193341)
>"what does malloc return?"
This is particularly pernicious, because it's a trick question, too. On linux, malloc always returns, it will never return NULL. Even if you ask for 4 petabytes of memory on a 128mb system, malloc will hand you back a valid pointer for the memory.
Re:Harder programming questions do a worse job of predicting...
by coryrc on Monday February 18, 2019 @02:28PM
(#19193507)
I'm pretty sure it will fail NULL if overcommit is disabled.
(And apparently other conditions: https://stackoverflow.com/questions/2248995/is-there-a-need-... )
Re:Harder programming questions do a worse job of predicting...
by Retra on Monday February 18, 2019 @03:17PM
(#19194004)
If I were asked that, I would say something like "malloc attempts to allocate some memory on the heap and return a pointer to it." If pressed for more details, I would say it depends on the allocator and that we should look at the documentation for it to find out.
If that was an unacceptable answer, then I'd consider the interview a waste of time.
There were a lot of Googlable boilerplate questions (e.g. "what does malloc return?", "what's a bloom filter?") that, as a product engineer, never come up.
Then there were the classic Big-O notation queries that for most use cases don't come up until much later stage. It felt like the founders were classically trained in CS and over-optimizing for things that aren't practically relevant for the large majority of early/mid-stage startups.
Am I familiar with these concepts—e.g. can I go back and refresh myself when they come up?—absolutely. But often times the skills you'd want in an engineer are:
1. Knowing when to optimize
2. Knowing how to profile and identify bottlenecks
3. Familiarity with the available solutions
4. Ability to dig in and evaluate which is the right tool for the jon