Round1:
Java MCQ test and
sytem design online question related to flight management
SECTION: A
QUESTION.1
The Air-Z company wants to build a robust and faster flight booking management system
below are the use cases for a MVP.
and
1.User can search flight based on source, destination, date and one way/two way. The search
result should return the list of flights in the order of fare from low to high andduration
of flight from minimum to maximum. Make sure to build a performant search system.
2.The user can select any one flight, update the travellers'details and proceed with the
booking. In the booking page the latest price details will be displayed and there will be
different coupons displayed based on the user type (The user can be a privileged customer and
tagged with Gold, Silver or Platinum badge), which can be applied to the booking to avail
thediscounts.
3.Make sure multiple users can access the same flight at the same time and allocated the seats
based on the availability.
Design and develop maintainable, scalable, flexible, readable and efficient Rest APIs for the
use casesby using OOPs concept, java 8 (Concurrency, Collections etc..), Spring/Spring boot,
ipa/hibernate, any embedded database like H2 and suitable design patterns.
Round2:
1. Fail safe vs fail fast iterator
2. Different patterns I have used. Gang of Four. Name few within each
3. What is load factor in hashmap? What happens when it’s get hit
4. What is view and materialized view
5. Volatile vs transient
6. What is idempotency
7. Linkedlist vs ArrayList. Which one to prefer when. What are the time complexities.
8. How to increase heap space?
9. What is broker in kafka? How have you used it? Can we have more number of consumers than partitions? What is offset? What is idempotency in kafka?
10. What is atleastOnce(), atmostOnce(), exactlyOnce() in kafka?
11. What is lazyStream, lazyEvaluation?
12. What is versioning in API?
13. Write one API signature that returns all the posts for a given user.
14. What is work directory in docker
15. Which Junit version you are using?
16. Write a controller method which can return XML response/ Json response.
17. What is circuit breaker? Can you write code for it
18. Write producer/consumer config for kafka
19. There is a user table/entity and post entity. User can have multiple posts. Write entity classes for it with jpa implementation. @OneToMany and @ManyToOne implementation
20. Difference between reentrant lock and synchronized
21. String[] arr = ["one", "two", "three"]. Get all those elements that don’t have letter t and return UPPERCASE. Output: [“ONE”]
22. What is BiPredicate?
23. Supplier/Consumer implementation
24. Write Optional code. What are the different methods present in it. Let’s say you want to check if value is present in it and do some operation. What is the effective way of doing it.
25. What is O in SOLID principle.
26. How to handle exceptions in ExecutorService and CompletableFutures.
27. Write an immutable class code containing string, Integer and Date variables.
28. Write a sql query to fetch userNames having more than 10 posts.
User - userId, Username
Post - postId, post , userId
29. What is API Gateway. Have you written any configurations for it.
30. What is scope in bearer token?
31. What are blueGreen/Canarry deployments?
32. How to take heap dump? What are different unix commands you have used?
33. Write a code to fetch and aggregate the posts for given list of userIds and given platform using executorService and futures. Future.join should not block each other.
34. What is data at rest and data in motion?
35. Have you used telementary. Jaeger.
36. How to configure the threadPool sizes?
37. What are different http response codes? What is 201?
38. What would you do if your application has an out-of-memory exception?
39. Interviewer wrote some codes containing a try and multiple catch blocks. Each catch block handles either an error or exception. He threw an error in the try block and told me what will be the output of that program?
40. What is the role of UUID in serialization?( https://www.baeldung.com/java-serial-version-uid )