2

This a question from the 1st round of Senior Java Engineer interview.

The others questions are as usual, like explain HTTP GET/POST, RESTful API, HashMap vs ConcurrentHashMap, synchronized vs ReentrantLock.

Then the interviewer asked me this question: Explain how does the server know the file upload is finished.

I said: "The server can read from InputStream, after reading is finished, then the file upload is finished".

He said: "please show me more details".

I said: "I don't know too much about it, what do you really want to know?".

He said: "Let's move to the next question".

Then I lost this offer because HR said I was not answering well enough for this question.

What should I have answered?

halfer
  • 19,824
  • 17
  • 99
  • 186
Neal.Shan
  • 128
  • 1
  • 11
  • 1
    You need to provide a lot more context if you want someone to provide a meaningful answer. (What kind of server? How is the file being uploaded? Is the server that is doing the uploading the same as the server that is asking? And so on ...) – Stephen C Aug 06 '20 at 01:23
  • 1
    *"Then I lost this offer because HR said I was not answering well enough for this question."* - I doubt that the decision making was as simple as that. But if it was, you may be better off not working for that company. – Stephen C Aug 06 '20 at 01:25
  • Check this response it could be helpful https://stackoverflow.com/a/29249203/7594682 – Sidali Smaili Aug 06 '20 at 01:25
  • @StephenC I updated the context, but I didn't get more info from the interviewer, maybe I should ask him those questions first instead of "What do you really want to know". – Neal.Shan Aug 06 '20 at 02:01
  • @SidaliSmaili It's helpful, thanks. – Neal.Shan Aug 06 '20 at 02:04
  • 1
    Yes ... maybe that was your mistake. It is hard to give a correct answer to an interview question that is ambiguous / unclear / lacking context / too broad. Just like the one you are asking us now :-) – Stephen C Aug 06 '20 at 04:18
  • There wasn't enough information in the question for you to answer. It all depends on whether HTTP 1.0 was used, or `Connection: close`, or a `Content-length` header, or `Transfer-encoding: chunked`, or a multipart, or ... You dodged a bullet. Interviewer showing off as usual. – user207421 Aug 06 '20 at 04:27

0 Answers0