I had an interview with a NY based financial company.
I was aksed to solve a problem to print the numbers from 1 to 100 by two threads. Thread 1 printing odd numbers and thread 2 printing even numbers and at the end the numbers must appear sequential.
Fair enough.
Now when I started coding, the interviewer started interrupting and distracting me throught the process.
Me: "I will use ReentrantLock to lock the field variable"
Interviewer:"Why would you use a lock and no synchronzied block"
Me: "Because ReentrantLock supports fairness"
Interviewer: "Why would you say that? "
Me: "Synchronized can block the resource whereas in case of locks I can unlock it.. probably"
Interviewer: "What are the other options? What else a ReentrantLock can do?"
Me: Thinking deep...
Interviewer: "Ok. Start coding.."
After explaing him the logic I started coding..
Me: Writes one line of code... Thread thread = new Thread(()->printNumber());
Interviewer: "Can you explain what does your code mean? Why did you use this syntax?"
At this point, I was like.. Come on man.. Do you want me to write the code and explain or are you going to stop my thinking process for every line of code?
This continued and until the end of the interview he was questioning and stopping me even when I was doing the right approach.
He was consistently pestering me with theoritical questions and also pointing out every time I made a typo.
At last I finished the easy problem with great difficulty and then he removed the lock and told me that the code won't work without the lock.
Wait, what? Why do you have to say that when I have added the lock?
To top it all, when he asked me if I have any questions, I asked him what kind of project is he working on in company XXX. He then rudely asked me "what do you know about XXX?"
At this point I realized that this guy does not know how to conduct an interview or he definitely does not want me to succeed in the interview.
I told him what I knew and he gave some vague details about project and said a blunt bye and hung up the call.
Of course this is no FAANG. But companies must really train or give some creiteria to their employees on how to conduct interviews.