There was an online round consisting of 4 sections and needs to be done in a span of 70 minutes.
- Data structure question : Find minimum number of swaps between adjacent characters in a string to convert into palindrome. If palindrome is not possible, return -1 and if string is already a palindrome, return 0. https://stackoverflow.com/questions/51796237/minimum-number-of-swaps-to-convert-a-string-to-palindrome
- Data structure MCQs : 13 Questions based on Heap, queue, b+ tree, sorting algorithm. A few questions were
- When will B+ tree leaf nodes will point to sibling node?
- Which property is true about red black tree?
- Given that stack is implemented with two queues and a few push and pop operations given, how many enqueue and deque operations are done in total?
- Questions on MinHeap and MaxHeap.
- Java Based MCQs: 13 Questions related to Threads, classes, exceptions were mainly asked. A few questions were
- Which of the following is/are valid thread contructors.
- Two threads were created and run function containing a loop running 1000 times. Inside loop, there was synchronised to print two variables.Print expected output.
- One try/ catch question where arithmetic operation = 25/0 was mentioned in try block and this was followed by finally and then catch block with ArithmeticException handling and one statement after catch. Print expected output.
- Polymorphism question in which three functions with same name but different arguments such as string, Object and arraylist were made and a function call was made with NULL argument. We need to print expected output.
- Two question based on Yield and join function of threads.
- SQL Queries MCQs: 13 Queries based on insert operation, select queries with JOINs (natural join, left join, right join) and rollback datapoints.
This round was a mix of data structures and low level design questions.
- Data structures questions :
- Multiply two numbers without using ‘*’ and repetitive ‘+’ operators.(https://www.geeksforgeeks.org/russian-peasant-multiply-two-numbers-using-bitwise-operators/ )
- Design Questions:
- Design low level diagram of system consisting of DataService class which will have three caches(C1, C2, C3). This class will have a function getData(id) which will internally calls C1. If data is not found in C1, it calls C2 and in case missing, in turn calls C3. Expected me to use Chain of Responsibility in Design Patterns.
- Why do we define (Spring boot) Beans as returning interface rather than implementations.I gave answer due to multiple strategy implementions for that interface. Strategy pattern.
- What is facade pattern. Explain with an example.
- Questions such what is inheritance, abstraction, local artifactory, pom.xml, maven, sharding.
- Difference between peek() and poll() method of queue in java
This round was mainly structured around design. Interviewer asked me to code classes in Java.
- Design logger class. They were looking for application of singleton design pattern in this class.
- Design a class for solving reader-writer problem using mutex locks in which multiple read operations and single write operation were allowed.
- Asked me difference about wait() and sleep() methods of Thread class.
- If you have one service say A and it’s dependent on service B. Due to some reason, there is failure in B service, what would you do in service A to cope with such situation.
- What is hashCode function and why do we need it. Which class does this function belong to.
- What is serialization and deserialization in Java.
- Create a custom annotation using spring boot framework Java.
- One data structure was also asked. https://www.geeksforgeeks.org/anagram-substring-search-search-permutations/
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.