EPAM Systems
10+ Luxoft Interview Questions and Answers
Q1. what is equals and hashcode and does Object class implement equals method ?
equals and hashcode are methods in Java used for comparing objects and generating hash codes respectively. Object class does implement equals method.
equals method is used to compare two objects for equality. It is overridden in most classes to provide custom comparison logic.
hashcode method is used to generate a unique integer value for an object. It is used in hash-based collections like HashMap.
Object class does implement equals method, but it uses reference equality (==) f...read more
Q2. What are other principles apart from SOLID for best coding practices.
Other principles for best coding practices include DRY, KISS, YAGNI, and design patterns.
DRY (Don't Repeat Yourself) - Avoid duplicating code by creating reusable functions or classes.
KISS (Keep It Simple, Stupid) - Write simple and easy-to-understand code rather than overcomplicating it.
YAGNI (You Aren't Gonna Need It) - Only implement functionality that is needed at the present moment, avoiding unnecessary features.
Design Patterns - Follow established design patterns like S...read more
Q3. What happens when the Liskov Substitution principle breaks?
Code becomes less maintainable and can lead to unexpected behavior.
Violates the principle of substitutability, leading to unexpected behavior in subclasses.
May result in code that is harder to understand and maintain.
Can lead to bugs and errors that are difficult to trace back to the violation of the principle.
Example: If a subclass overrides a method in a way that changes its behavior significantly, it can break the Liskov Substitution principle.
Q4. what are the time complexities of various data structures.
Time complexities of data structures vary based on operations like insertion, deletion, search, etc.
Arrays - O(1) for access, O(n) for insertion/deletion
Linked Lists - O(n) for access, O(1) for insertion/deletion at head/tail
Stacks - O(1) for push/pop operations
Queues - O(1) for enqueue/dequeue operations
Hash Tables - O(1) for average case search/insert/delete
Binary Trees - O(log n) for search/insert/delete in balanced trees
Heaps - O(log n) for insert/delete, O(1) for find-mi...read more
Q5. Find the kth Largest element of array using Stream API (java 8)
Use Stream API to find the kth largest element in an array of strings.
Convert array of strings to Stream
Sort the Stream in reverse order
Skip k-1 elements and get the kth element
Q6. SQL Query to find highest salary of employee in each department
Use SQL query to find highest salary of employee in each department
Use GROUP BY clause to group by department
Use MAX() function to find highest salary in each group
Join the employee table with department table to get department information
Q7. What features were introduced in Java 8?
Java 8 introduced features like lambda expressions, functional interfaces, streams, and default methods.
Lambda expressions allow you to pass functionality as an argument to a method.
Functional interfaces have a single abstract method and can be used with lambda expressions.
Streams provide a way to work with sequences of elements and perform aggregate operations.
Default methods allow interfaces to have method implementations.
Q8. Internal working of hashmap in Java 8?
HashMap in Java 8 uses an array of linked lists to store key-value pairs, with bucketing and resizing for efficient retrieval.
HashMap internally uses an array of linked lists to store key-value pairs
Each element in the array is a bucket, and each bucket can have multiple entries
Hashing is used to determine the index of the array where the key-value pair will be stored
In case of hash collisions, entries are stored in a linked list within the same bucket
HashMap dynamically resi...read more
Q9. What is D in SOLID principles.
D stands for Dependency Inversion Principle in SOLID principles.
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.
Example: Using interfaces to decouple classes and allow for easier testing and maintenance.
Q10. AWS services worked on? Features of AWS?
Worked on AWS services like EC2, S3, RDS, Lambda, and more. Familiar with features like scalability, security, and cost-effectiveness.
Worked on EC2 for scalable computing power
Utilized S3 for secure and durable storage
Managed RDS for relational database management
Implemented Lambda for serverless computing
Familiar with features like scalability, security, and cost-effectiveness
Q11. Encapsulation vs Abstraction?
Encapsulation focuses on hiding the internal state of an object, while abstraction focuses on showing only the necessary details of an object.
Encapsulation is the concept of bundling the data (attributes) and methods (behaviors) that operate on the data into a single unit (class).
Abstraction is the concept of hiding the implementation details and showing only the necessary features of an object.
Encapsulation helps in data hiding and protecting the internal state of an object ...read more
Q12. How tree set works
Tree set is a sorted set implementation based on a binary search tree.
Tree set stores elements in sorted order using a binary search tree
It does not allow duplicate elements
Operations like add, remove, and search have O(log n) time complexity
Example: TreeSet
treeSet = new TreeSet<>();
Q13. Internals of LinkedHashMap
LinkedHashMap is a subclass of HashMap with predictable iteration order based on insertion order.
Maintains a doubly-linked list of entries to preserve insertion order
Supports access-order and insertion-order modes
Access-order mode reorders entries based on access frequency
Interview Process at Luxoft
Top Senior Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month