# Deloitte Interview Experience for Senior Consultant — Microservices JAVA (5+ years)

I have recently given interview for Senior Developer Role at Deloitte USI and below are the questions I was asked.

1. What is the **Facade Design Pattern** and where would you use it in a real-world application?
    
2. What is the **Singleton Design Pattern?**
    
3. What are **eager and lazy initializations** in Singleton?
    
4. How to make **Singleton** thread-safe?
    
5. What is **Double-Checked Locking** in Singleton?
    
6. How would you **secure your APIs** in a Spring Boot application?
    
7. What is the difference between `@Primary` **and** `@Qualifier` annotations in Spring?
    
8. What is the difference between `@Mock` **and** `@MockBean`?
    
9. What are the **important annotations associated with JUnit**?
    
10. What is the difference between **ClassNotFoundException** and **NoClassDefFoundError**?
    
11. How do you **check the health of your application and individual instances** in Spring Boot?
    
12. How do you maintain **data consistency in a distributed transaction** across microservices?
    
13. What is **Resilience4j**, and why is it needed in microservices?
    
14. What is a **Circuit Breaker**, and what are its states?
    
15. How do you **configure a Circuit Breaker using Resilience4j**?
    
16. What is **Eureka Server**, and how does it work internally?
    
17. How does **service discovery** work in a microservices architecture?
    
18. Features of **Java 17.**
    
19. What are **Generics** in Java?
    
20. What is **Type Erasure** in Java?
    
21. What are Java Streams?
    
22. Intermediate vs Terminal operations in Streams.
    
23. Parallel vs Sequential streams
    
24. What is a **Functional Interface**, and why is it important?
    
25. Internal working of **HashMap**
    
26. If you want to use an **Employee object as a key in HashMap**, what changes are required?
    
27. What is **CompletableFuture**? How is it different from **Future**?
    
28. What is **Kubernetes**, and why is it used?
    
29. How do you **monitor logs of individual instances** in a distributed system?
    
30. What is the difference between **Synchronous and Asynchronous communication**?
    
31. Which is faster: **method overloading or method overriding**? Why?
    
32. Given an integer array of length at least 3, determine whether it is a **valid mountain array**. An array is a mountain array if:
    

* It strictly increases up to a single peak.
    
* Then strictly decreases after the peak.
    
* The peak is not the first or last element.

**Code Solution:**

```java

public class DeloitteInterview {
    public static void main(String[] args) {

        System.out.println(isMountainArray(new int[]{1, 3, 8, 5, 2})); // true

        System.out.println(isMountainArray(new int[]{1, 2, 3}));       // false

        System.out.println(isMountainArray(new int[]{3, 2, 1}));       // false

        System.out.println(isMountainArray(new int[]{1, 2, 2, 1}));    // false

        System.out.println(isMountainArray(new int[]{1, 3, 2, 4, 1})); // false

    }

    public static boolean isMountainArray(int[] arr) {
        int n = arr.length;

        if (n < 3) return false;

        int i = 0;

        while (i + 1 < n && arr[i] < arr[i + 1]) {
            i++;
        }

        if (i == 0 || i == n - 1) return false;

        while (i + 1 < n && arr[i] > arr[i + 1]) {
            i++;
        }

        return i == n - 1;

    }

}

```


