Round 1: Online test
Consisted of MCQs based on Java – predict the output, multi-threading, etc.
Two programming questions –
- Implement functions of an interface – used HashMap where key (or value) was a custom class – had to implement hashCode() and equals() method too.
- Given a wooden log and a function which returns weight of log based on distance (say x) from the left side of the log. Weight of log is uneven (i.e. midpoint from left side doesn’t necessarily have weight = half of full log) so task is to find point from left side of log where the weight is exactly half. Approach was similar to binary search. Couldn’t solve due to less time, but it was mentioned in the rules that even if problem isn’t solved the algorithm can get you points.
Two SQL questions – one was using JOIN and another was using nested query.
Got a call for next round after a week.
Round 2: Telephonic interview
- Tell me about yourself.
- Compile time vs run-time polymorphism – compile time is overloading and run-time is overriding
- Immutable object – what is it, how to make object immutable (final class) and how to ensure that immutability is there if mutable object is used in the immutable class (return clone of original object).
- Hashmap (how it works), concurrent hashmap (how it works), treemap (complexity of search – I said O(logn) and explained that implemented as rb tree which gives guaranteed O(logn) performance in worst case).
- ArrayList vs LinkedList – if there is no mechanism for indexing, how will you search an element (iterate through list) and which one will lead to faster search (i said arraylist).
- Reverse a LinkedList – gave basic solution using two lists, he asked for more but I couldn’t give the ans.
- Wait vs sleep in threading – sleep doesn’t change the state of the thread, if thread is running it remains running. He asked for explanation, I explained using producer-consumer example. (I was wrong, sleep does change the state of the thread from RUNNING to THREAD_WAITING. Difference is that sleep doesn’t release lock on the resources).
- Given a list of strings, create a 2D array such that each row will store all anagrams of a string. I gave him brute force solution, but he wanted something optimized, I couldn’t do it.
Round 3: Telephonic interview
- Tell me about yourself.
- Abstract vs Interface. Do you know default method in interface? – I said no. It is basically some features introduced in Java 8.
- What is polymorphism? Give real life example of polymorphism – for overriding, withdraw from current and savings account, for overloading, deposit by cheque and cash.
- What is serialization? I told him concept but she started asked about internals – I tried to answer but couldn’t. She told me that if you know the concept only, tell her in advance so that she doesn’t ask about the internals.
- Given class A with a static printContent method, and class B which extends A and overrides printContent method. In main, A obj1 = new B(); obj.printContent(); A obj2 = null; obj2.printContent() – tell what the output will be. (Both printContent() calls will print “A”).
- Final, finally and finalize keywords – I couldn’t tell about finalize (finalize is (a method) used to perform clean up processing just before object is garbage collected.).
- What does it mean by immutable class (can’t inherit)? Given class Person with name and list of subjects. Make class immutable – in list getter function, return the clone of list.
- Exception vs error – I sucked in this one since I hadn’t studied about it for a long time. (See this).
- ArrayList vs LinkedList – searching vs insertion.
- TreeSet vs HashSet, ConcurrentHashMap vs Hashtable.
- HashMap vs TreeMap. Given a class Employee with a member name and this class is used as key in both HashMap and TreeMap. What method we will need to add to Employee class. I said hashCode() and equals() – but she asked whether hashCode and equals is required for TreeMap, I thought and said no, we need to implement Comparable and override compareTo method for TreeMap. Explain internal working of HashMap. I got confused when she asked whether hashcode is applied on both key-value or just key – I later said just key and continued with it. If hashcode is overrided such that it always return 1, how will it effect HashMap – I said only 1 bucket will be used and search time will be linear in worst case.
- SQL query – given tables student with (student id, name), course with (course id, name) and studentcourse with (primary id, student id, course id). Give the names of students who have enrolled for more than 3 courses. First I gave solution with nested query, then she asked for another method, so I tried using join but got stuck at the point where we have to count the courses.
- Problem solving question 1 – Given a linked list, delete a node from that given the reference of that node. It should be in O(1). I tried, but couldn’t do it. Solution: Copy the contents of next node in current node and delete the next node.
- Problem solving question 2 – What is stack? Implement a queue using stack.
Round 4: F2F interview
- Since I had worked with C++ and they knew C++ had OOPS, so they asked me to tell about various OOPS concepts: Polymorphism, Inheritance, Abstraction, Encapsulation, Data Hiding.
- Lots of (confusing) questions on abstract class vs interface.
- Explain polymorphism, compile time vs runtime polymorphism, overloading and overriding examples (and lots of confusing questions based on that like can static methods be overrided, etc).
- Exceptions and its types. They gave a piece of code in which base class function throwed IOException and derived class function throwed Exception and functions were overridden functions, so they asked what will be the output?
- Object class and its methods. Default implementation of hashcode and equals. Importance of hashcode – I gave example of HashMap, so they asked about its working.
- SQL queries – nested query (to find second max value in column) and inner join.
- Problem solving:
Given an array, you have to find the nearest value (on its left side) to an element. Let the nearest element to first element of array (arr) be -1.
E.g. 1 3 2 3 5 4
the output will be -1 1 1 2 3 3. Hint use stack.
- Design question: Implement pattern lock. They have hint to use some mathematical operation to compare two patterns. I initially thought of using Hash function, but later I thought XOR operation would be better. So, I used bit manipulation (BitSet in java) to index each dot and set ith bit if ith dot comes in pattern. (Later, I wasn’t sure if I was correct).
- ArrayList vs LinkedList – which is faster in terms of insertion, searching and deletion.
- Given numbers from 1-100, how will you sort them? Quicksort (nlogn). But since range is given (and is small), we can use Counting sort.
- Given an array find max 10 elements (order doesn’t matter). Use heaps. They asked to optimize further. I wasn’t able to think of any way, so they suggested to keep size of heap as 10. I initially thought of max heap, but later they again gave hint that why not try min heap. Using min heap insert first 10 elements, find min, remove min element, insert next element, find min, and so on. Repeat for len(arr) – 10 times, remaining will be max 10 elements.
- Wissen Interview Experience | Set 1 (On-Campus)
- Wissen Interview Experience | On-campus
- Interview Experience for Morgan Stanley By Wissen Infotech
- Microsoft Interview Experience (Full Time 2018 Washington DC - with 2.5 years of experience)
- TIAA Interview Experience -Java Back Backend Developer (3+ years Experience)
- Goldman Sachs Interview Experience | Set 23 (2+ years Experience for Java Developer Role)
- Samsung R&D Bangalore Interview Experience | Lateral hire (6 month experience)
- Arcesium Interview Experience - Senior Software Engineer (3 years experience)
- Nutanix Interview Experience for MTS - QA (4+ year experience) [ Language - Python ]
- Nagarro Interview Experience for Xamarin Developer | 3 Years Experience
- Oyo Rooms Interview Experience | Set 3 (For Backend Engineer, Experience <=1yrs)
- Arcesium Interview Experience Software Engineer (1+ year experience)
- Arcesium Interview Experience | Set 5 (3+ years experience - Developer profile)
- Brocade Interview Experience | Set 2 (For Software Engineer 0-2.5 Years Experience)
- Walmart Lab Interview Experience | Set 7 (Off-Campus 3 Years Experience)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.