Luxoft Interview Questions:
Multithreading:
What is the difference between submit() and execute() in the ExecutorService?
Explain the lifecycle of threads.
What is volatile used for in Java?
How is a deadlock generated? (Hint: Synchronized methods, code, and block)
Exceptions and Errors:
What is the difference between Exceptions and Errors?
How do you customize unchecked exceptions?
HashMap and Collections:
Explain how HashMap works and discuss its time complexity.
What are some common problems with HashMap keys, especially when the key is an object that changes its value?
What is the difference between HashTable and ConcurrentMap?
Explain TreeSet vs HashSet.
How do you implement Comparable and Comparator?
User Class Coding Exercise:
Create a User class with three attributes.
Create six users (four females, two males).
Calculate the average age of all females.
Interface Modifications:
Create an interface with four methods: a(), b(), c(), and d().
Change the interface so that method b() is a default method, and method c() is a private static method.
Can you call a method from this interface using lambda expressions? If not, how would you modify the interface to make it possible?
Java Stack and Application Architecture:
Explain the Java memory model: heap vs. stack.
What is the string pool?
What is the difference between POST and PUT in REST?
What are the core differences between Service and Repository annotations in Spring?
Design Patterns and SOLID Principles:
Explain common design patterns like Adapter, Decorator, and Observer.
Discuss SOLID principles. Which principle is your favorite, and why?
How do you implement immutable objects in Java?
Spring and Microservices:
What annotations do you use for Spring transactions and database handling? What is the best way to inject dependencies (constructor, variable, or setter)?
Explain Spring Boot, microservices architecture, and real-time problem solving.
What is the difference between @ControllerAdvice, @Conditional, and @Profile annotations?
How do you handle exceptions in Spring controllers?
Concurrency and Performance:
Explain concurrency collections and garbage collection in Java.
How do you profile an application for performance issues?
Discuss scalability and multithreading best practices.
SQL and Databases:
What are ACID properties in databases?
How do you perform query optimization in SQL?
What are the differences between manual queries and repository methods in projects?
Explain the difference between an index full scan and an index fast full scan.
OOP and Java 8 Features:
Explain OOP concepts like inheritance, polymorphism, and encapsulation.
How do Java 8 features like lambdas and streams work?
What is the difference between map() and flatMap() in Java 8?
How do you manage memory leaks in Java?
Miscellaneous Java Topics:
What are the most common bottlenecks in data loading into a machine?
How do you handle multiple interfaces that have the same method? What happens when you call this method?
Explain the Throwable hierarchy in Java.
What are try-catch-finally blocks, and what happens if System.exit() is called inside a catch block?
What are statics used for in Java?
Coding Problems:
Move Zeroes (LeetCode problem 283).
Return the maximum occurring character in an input string.
Find pairs with a sum equal to k from an array.
Count the occurrences of a character using Java 8.
Merge two sorted arrays and explain the time complexity.
Write a program to find vowels in an array of strings using Java 8.
Find duplicate elements in an array.
Additional Questions:
What are the rules for creating a table with the @Entity annotation in Hibernate?
How do you handle unit testing vs. integration testing in Spring Boot?
Explain the Kafka messaging system and the difference between a topic and a queue.
How do you handle a large number of exceptions in Spring controllers?
What is your experience with Redis for caching?
How does the garbage collector work in Java?