Round 1: On-site Interview (Technical Round)
Questions:
-
Java and OOP Questions:
- Why does Java have wrapper classes for primitive data types?
- Analyze and explain the output of the following code:
public class Main(){ public static void main(String[] arg){ String name = "Name"; String name1 = new String("Name"); system.out.print(name == name1); return; } };
- Further questions on OOP covered inheritance, different types of inheritance, and whether Java supports multiple inheritance.
- Questions on abstract classes and several code analysis tasks were presented, including the following code samples:
public class Main(){ int a = 20; public static void main(String[] arg){ system.out.print(a); return; } };
class A{ public void fun(){ System.out.print("Hello from A"); } }; class B extends A{ public void fun(){ System.out.print("Hello from B"); } public void fun1(){ System.out.print("Hello from function1"); return; } }; public class Main(){ public static void main(String[] arg){ // In the discussion they have added each line of code and ask output. A obj = new A(); B obj1 = new B(); obj.fun(); obj1.fun(); obj1.fun1(); obj = new B(); obj.fun(); obj.fun1(); obj1 = new A(); obj1.fun(); obj1.fun1(); return; } }
abstract class A{ public abstract void fun(); public static void fun1(){ System.out.print("Hello world!"); } }; public class Main(){ public static void main(String[] arg){ A.fun1(); return; } };
-
DSA Questions:
- Maximum Sum Subarray: The interviewer noted my familiarity with the problem and asked me to explain the approach to confirm my understanding.
- Median of an Array of Integers: Initially, I proposed sorting the array, but when they added that the integers were received as a stream, I suggested an insertion sort and then refined it using two priority queues.
-
SQL Questions: Based on my project experience (YouTube clone), the interviewers presented a scenario involving user, video, and comment tables. They asked me to write a query to retrieve the name of the user whose video had the maximum number of comments.
-
Puzzles:
- 3 Bulbs and 3 Switches from gfg.
- 8 balls problem from gfg.
- 10 Coins Puzzle from gfg.
- The final puzzle involved a scenario with five houses and a thief who changes houses daily, moving to an adjacent house. I was asked to devise the optimal strategy for the police to catch the thief and calculate the minimum number of days required.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 2: On-site Interview (Technical Round)
Questions:
-
Quantitative Questions:
- A time and work-related problem.
- A permutation and combination (PNC) problem.
-
System Design (High-Level Design): I was asked to design an elevator system for a 10-floor building with four elevator cars.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Final Stages
Three days after the interviews, I received a call from a manager who conducted a deep-dive review of my CV. At the end of the call, the manager verbally confirmed the offer.
One week later, I received an email regarding the background verification process, and after approximately 2 months, I received the official offer letter.