1st Round
Question 1 - Puzzle
I have 4 Socks Pair in different colours
1 Pair of Red
1 Pair of Green
1 Pair of Blue
1 Pair of Yellow
I want to arrange this pair with the Below Mentioned Conditions
Red Pair will have exact 1 Another sock in between them
Blue Pair will have Exact 2 Another Socks in betwen them
Green pair will have exact 3 Another Socks in between them
Yellow pair will have exact 4 Anothers Socks in Between Them
Answer -> YRGRBYGB
Question 2 -> Java
I want to reverse the word from the given string
Space position should be as it is
String str = "Hello Param How are You Welcome to oracle";
Answer String -> "olleh maraP woH era uoY emocleW ot elcaro";
Question 3 -> Java
Want to find non repeating longest continuous string from the given String.
String str = "abcdba";
Answer => abcd
Approach -> Sliding Window
Question 4 -> Mathematics
In a room, There are N people and they wanted to do handshake, How many total number of Handshake will happen?
Answer => n * (n - 1) / 2 -> Combinations
Question 5 -> SQL
We have 3 tables
Employee -> emp_id, dept_id, emp_name
Department -> dept_id, dept_name
Salary -> emp_id, amount
I want to find 2nd highest salaried Department details
Question 6 -> SQL
We have 1 Table
Salary -> emp_id, amount
I want to find 2nd highest salary amount from this given table
NOTE: I cannot use any window function or cannot use any limit and offset as well.
2nd Round
1st Question - Java
What is Method Overriding and Are you using OOP Concepts in Regular Routine?
Can you give some examples where all the concepts are used?
2nd Question - Java
Are you familier with Multi-Threading?
Do you have any idea about ExecutorService?
I want to Design ATM by help of ExecutorService where Multiple user simultaneously can withdraw money. But we have to taken care of money available in ATM that if no Money available then user won't be able to withdraw that and also for simultaneous users, it will synchronous
3rd Question - Java
We're given a String. I want to find the maximum distance between to repeatative words
String str = "Hello Param Welcome to Oracle Param is from Ahmedabad Param is Java Developer";
Among this, Distance Between "Param" keyword is having the highest distance between first repeated iteration and last repeated iteration.
There was one more question was asked in this Round but I forgot the definition of that Question.
3rd Round
Question 1 - Java
We're given a String in Date Format dd-mon-yyyy and integer n
We want to design one Date Adder function without using any date functions available in java.
Example...
String date = "09-May-2025", int n = 30;
It should return "08-Jun-2025"
Also it should taken care of Leap years as well.
Question 2 - Java
Find the Longest common Prefix from the given array of Strings
Example
String[] arr = new String[]{
"automatic", "auto", "autonomous"
}
Answer => "auto"
Question 3 -> Java
Traverse a matrix in stepping order with m * n dimentions
Rules
If you're reaching to last step then cannot override the step
If you're reached to last step and fulfilling the 1st condition then you have to come back to home by using last row and 1st column and need to Print the steps you've covered
Example: We've one matrix of 4*4
[1, 2, 3, 4]
[5, 6, 7, 8]
[9, 10, 11, 12]
[13, 14, 15, 16]
I'll start Traversing from 0,0
Result will be like this
1, 2, 6, 7, 11, 12, 16, 15, 14, 13, 9, 5
If It will be 4 * 3 or 3 * 4 then it won't be able to traverse the reversal(Last Row and First Col)
Question 4 -> Puzzle
Find the Winner of Table Tennis game based on Below Conditions
Details
3 Players are playing table tennis game
Player 1 Played 8 matches
Player 2 Played 12 Matches
Player 3 Played 14 Matches
Rule
If any player winning the matches, He'll continue playing and the opponent will be switched
Additional Info
Player 2 Won the last 7 matches continuesly
This was my all over exeperience to Oracle India at Gandhinagar Development Center.
Overall Experience was too good and too interactive.