Video in progress
How do you behave in an interview when you don't know the answer to a technical question?
I say openly that I don't know, then show how I'd reason from what I do know. Making something up is the worst option, and an experienced interviewer spots it right away.
📖 Answer
Saying "I don't know" isn't shameful. The problem is stopping at those words.
A good answer sounds roughly like this:
"I don't know the internal structure of
ConcurrentHashMapexactly. But I know a plainHashMapisn't thread-safe, andCollections.synchronizedMapguards the whole map with a single lock. I think the concurrent version must make the locking finer-grained. Is that right?"
With that you were honest, showed that you know the nearby topic, and labeled a guess as a guess.
After that, many interviewers help or ask a leading question. For them, how you think is often worth as much as the right answer itself.
After the interview, be sure to read up on that question. It might come up again in the next one.
Sign up to mark studied questions and save your progress.