Oracle
OPPO Interview Questions and Answers
Q1. Why strungs are not mutavle in java ?
Strings are immutable in Java to ensure thread safety and prevent unintended changes.
Immutable objects are safer to use in multi-threaded environments
String pool optimization is possible because of immutability
StringBuffer and StringBuilder classes are available for mutable string operations
Q2. Common Elements in two Sorted Linked List
Finding common elements in two sorted linked lists.
Traverse both lists simultaneously using two pointers.
Compare the values of the nodes pointed by the two pointers.
If they are equal, add the value to the result list and move both pointers.
If not, move the pointer pointing to the smaller value.
Repeat until one of the lists is fully traversed.
Q3. Kth element after merging two sorted arrays
Finding the Kth element after merging two sorted arrays.
Merge the two sorted arrays into a single array.
Sort the merged array.
Return the Kth element from the merged and sorted array.
Q4. What is string pool ?
String pool is a cache of string literals stored in memory for efficient reuse.
String pool is a part of Java's memory management system.
It stores a collection of unique string literals to save memory.
When a new string is created, it is first checked in the pool and reused if already present.
String pool can be accessed using the intern() method.
Example: String s1 = "Hello"; String s2 = "Hello"; s1 and s2 will point to the same object in the pool.
Q5. Graph basic level implementation
Graph implementation involves creating nodes and edges to represent data and relationships.
Nodes represent data points and edges represent relationships between them
Graphs can be directed or undirected
Common graph algorithms include BFS, DFS, and Dijkstra's algorithm
Q6. I was asked to find diameter of a binary Tree
To find the diameter of a binary tree, we need to find the longest path between any two nodes in the tree.
Traverse the tree recursively and calculate the height of the left and right subtrees.
Calculate the diameter of the left and right subtrees recursively.
The diameter of the tree is the maximum of the following three values: 1. Diameter of the left subtree 2. Diameter of the right subtree 3. Height of the left subtree + height of the right subtree + 1
Example: 1 / \ 2 3 / \ ...read more
Q7. all oops concepts in detail
Object-oriented programming concepts like inheritance, encapsulation, polymorphism, and abstraction.
Inheritance: Allows a class to inherit properties and behavior from another class.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Polymorphism: Ability to present the same interface for different data types.
Abstraction: Hiding the complex implementation details and showing only the necessary features.
More about working at Oracle
Interview Process at OPPO
Top Associate Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month