All of Goldman Sachs Misc (Java, Spring, Kafka, NoSQL) Questions
Anonymous User
959

Asked about internal working of HashMap (Could not elaborate)
Map with a feature of list like getting Nth element (Could not tell the best way to achieve)
What does your organization does?
What SDLC practices you use at work?
What is Apache Kafka?
Where you can use Kafka?
Penalist explained me about IRCTC and asked me where I can use Kafka in this system?
I was confused at this point, where one can use Kafka. I answered, we can use Kafka at Booking stage, we can add queue for booking tickets.
Followup: How will you handle callback?
Later, he moved on to HLD part, he asked me to design IRCTC
I started by listing API. One of the API I mentioned is searchTrains(startLocation, endLocation, Date)
Penalist grilled me on this, he asked to make a DB design for this API and write a search query.
My approach:
Train Table -> trainId, startLocation, endLocation, timeSheetID

IntermediateCities Table -> trainId, citiName, positionID

Select t.* from Trains t (NOLOCK)
INNER Join IntermediateCities ic (NOLOCK) on t.TrainID = ic.TrainID
INNER Join IntermediateCities ic2 (NOLOCK) on t.TrainID = ic2.TrainID
INNER JOIN TimeSheet ts (NOLOCK) ts.TrainID = t.TrainID
WHERE ic.cityName = t.sourceCity
AND ic2.cityName = t.destinationCity
AND ts.StartDay = GETDAY(t.date);

Internal implementation of HashMap - hashcode, equals, collision, and all. How after getting the hash we map to the correct bucket. All these stuff.
Questions around Hashmap and Arraylist vs LinkedList
Questions around Enum and what purpose does it serve apart from being as a substitute for Const .
Then asked to implement serialisation for a sample class - I surrendered here
java hashcode vs equal
inner join vs outer join
mysql index strucutre
mongodb vs mysql
tcp vs udp
rpc framework
green threads blue threads
golang compositon
compile language/ implement language
map reduce
Use of autowiring in Spring.
Why multiple inheritance not possible in java.
Type of Polymorphism.How to use polymorphism.

You are given a very large file, you cannot load entire file in memory at once (RAM is limited). Now sort the entire file and write back to another file. - Interviewer provided hints for this one. He suggested leveraging the disk memory where the entire file was stored. A merge sort type of approach was finally accepted.

Lots of JAVA questions. I remember the following:
Internal working of a HashMap
Why is HashMap load factor 0.75?
Exceptions in JAVA
Output question on Exceptions
Strings in JAVA - Ways to create a string. How are string stored in JAVA etc
Ways to implement a HashMap like data structure using an array
How will you create a Singletion class in JAVA which is thread safe and protected from Clonnable etc?
Use cases of Singleton class
Method overloading and method overriding
Access modifiers in context of method overrding
Internal working of HashMap and some follow up questions.
Spring-based questions like What happens when we write our component classes in another package which is different from the package which contains @SpringBootApplication.
Suppose one Class A has a dependency with class B and Class C and Class A uses class B to fetch data initially, in runtime what do you do such that class A will use Class C instead of class B using annotations.
Questions related to java streams and lambda expressions. Mostly on map, filter, for-each, etc.
Questions related to the garbage collector, why is it used, what is the way to invoke, what happens if we invoke the garbage collector from our program.

Comments (3)