Infosys Java Interview | 2–7 Years Experience | Java | Spring Boot | Microservices | Mock Interview

Infosys Java Interview | 2–7 Years Experience | Java | Spring Boot | Microservices | Mock Interview



📺 This post is based on a real mock interview video from YouTube.
🔗 Watch it here: Infosys Interview – CloudTech
📡 Channel: CloudTech


Q1: Can you tell me about yourself, your technical skill set, and the project on which you worked?

Answer:
I have 4 years of experience in the IT industry. I’ve worked on Java, Spring Boot, Microservices, MySQL, and a NoSQL database. I'm currently using Java 11 and have exposure to Java 8 features. I’ve worked in the banking and finance domain, mainly on reconciliation projects.


Q2: What are your day-to-day activities?

Answer:
We manage tasks using Jira and follow Agile Scrum methodology. We handle user stories, work on enhancements or bug fixes, estimate efforts, perform development, get QA validation, and then deploy to production.


Q3: Java Coding - Flatten a list of lists of strings into a single list

Answer:

List<String> allSkills = skills.stream()
    .flatMap(skillList -> skillList.stream())
    .collect(Collectors.toList());

Q4: Java Coding - Filter skills starting with the character 'S'

Answer:

List<String> sSkills = allSkills.stream()
    .filter(skill -> skill.startsWith("S"))
    .collect(Collectors.toList());

Q5: What are the different ways to create a thread in Java?

Answer:

  1. Extend Thread class and override run() method.

  2. Implement Runnable interface and pass it to a Thread object.


Q6: When should we use Runnable vs Thread?

Answer:
Use Runnable when you only want to execute code in a separate thread and don’t need to extend Thread. Use Thread only when you want to modify or extend thread behavior.


Q7: Which design patterns have you worked with?

Answer:
Adapter, Factory, and Abstract Factory design patterns.


Q8: What is the difference between Factory and Abstract Factory?

Answer:

  • Factory Pattern: Creates object based on input (e.g., UPI, Credit Card, Bitcoin payments).

  • Abstract Factory Pattern: Returns related group of objects based on context (e.g., Light theme → light components).


Q9: How do you perform CRUD operations in Spring Boot?

Answer:

  • Use @RestController for controller class.

  • Use annotations like @GetMapping, @PostMapping, @PutMapping, and @DeleteMapping.

  • Service layer annotated with @Service, repository layer with @Repository.

  • Status Codes:

    • 200: OK

    • 201: Created

    • 204: No Content (Delete)

    • 404: Not Found

    • 500: Internal Server Error

    • 429: Too Many Requests


Q10: Can we interchange @Service and @Repository?

Answer:
Technically yes, because both are stereotype annotations. But semantically, it’s not recommended as each has its own purpose.


Q11: Explain the microservices architecture of your project.

Answer:

  • 7–8 microservices developed and managed by separate teams.

  • Entry point is API Gateway which routes requests based on URI.

  • Each service registers itself with Service Discovery (Eureka).

  • Services communicate synchronously (via REST) or asynchronously (via Kafka).


Q12: How do microservices communicate with each other?

Answer:

  • Synchronous Communication: Both services must be up (e.g., REST).

  • Asynchronous Communication: Fire-and-forget using Kafka, no need to wait for response.


Q13: How do you implement client-side load balancing?

Answer:

  • Use multiple instances of microservices.

  • Use @LoadBalanced RestTemplate or Ribbon.

  • Client gets all service addresses and balances requests across them.


Q14: How do you handle microservice failures?

Answer:
Using Circuit Breaker Pattern:

  • After 3 failed calls, stop calling the failing service for a cooldown period (e.g., 10 mins).

  • Retry after cooldown.

  • Helps prevent overload on already failing services.


💡 Conclusion
This mock interview walk-through covers key backend concepts for developers with 2–7 years of experience. It focuses on Java, Spring Boot, Microservices, design patterns, threading, circuit breaker, and coding practices.

📺 Watch the full interview here: https://www.youtube.com/watch?v=HPvwYK4-IdY

Post a Comment

0 Comments