Skip to main content

Infosys Java Interview | 4 to 7 Years | Java | Microservices | Database | Spring Boot

 Infosys Java Interview | 4 to 7 Years | Java | Microservices | Database | Spring Boot





📺 This post is based on a real mock interview discussion. All answers are paraphrased and structured for learning purposes.
🔗 Video credit: CloudTech Watch here


Q1: Can you tell me about your project architecture?

Answer:
The project transitioned from monolithic to microservices architecture. It uses Zuul as the API Gateway, and Consul (previously Eureka) for service discovery. Each microservice registers itself with the discovery server. The architecture supports client-side load balancing and uses both relational (e.g., MySQL) and NoSQL (MongoDB) databases.


Q2: How do microservices communicate with each other?

Answer:

  • Synchronous communication: Uses FeignClient (earlier RestTemplate).

  • Asynchronous communication: Uses Kafka. Events are published and consumed across services without waiting for a reply.


Q3: What features are implemented in the API Gateway?

Answer:

  • Authentication and Authorization

  • Rate Limiting (returns HTTP 429 on too many requests)

  • Response Aggregation from multiple services


Q4: What design patterns and SOLID principles do you follow?

Answer:

  • Design Patterns: Singleton, Strategy, Builder

  • SOLID Principles:

    • S: Single Responsibility

    • O: Open/Closed Principle

    • L: Liskov Substitution

    • I: Interface Segregation

    • D: Dependency Inversion (handled via Spring's Dependency Injection)


Q5: How do you structure a Spring Boot CRUD application?

Answer:

  • Layers: Controller → Service → Repository

  • Annotations: @RestController, @Service, @Repository

  • HTTP Methods: GET, POST, PUT, DELETE

  • Status Codes: 200 (OK), 201 (Created), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found)


Q6: What is your packaging structure?

Answer:
Uses base package like com.cloudtech.projectname with sub-packages for controller, service, repository, and separate folders for resources and test cases.


Q7: How do you connect your Spring Boot app with a database?

Answer:
Using application.properties to define database url, username, and password. Spring Boot auto-configures the datasource.


Q8: How do you optimize a slow-performing API?

Answer:

  • Check network latency

  • Analyze SQL query logic

  • Ensure proper indexing on filter/join columns


Q9: What is the purpose of indexing in databases?

Answer:
Indexes speed up queries by avoiding full table scans. Instead of scanning each row, the database uses the index to directly fetch relevant rows.


Q10: What types of joins exist in SQL?

Answer:

  • Inner Join: Returns matching rows from both tables.

  • Left Outer Join: Returns all rows from the left table, and matched rows from the right.

  • Right Outer Join: Returns all rows from the right table, and matched rows from the left.

  • Full Outer Join: Returns all rows from both tables, matched or not.


Q11: Which Java version do you use and what are Java 8 features?

Answer:
Using Java 11 with Java 8 features like:

  • Functional Interfaces

  • Lambda Expressions

  • Streams API

  • Date/Time API

  • StringJoiner


Q12: How to filter employees aged over 60 using Streams?

Answer:

List<Employee> seniorEmployees = employees.stream()
    .filter(e -> e.getAge() > 60)
    .collect(Collectors.toList());

Q13: How do you handle exceptions in Java?

Answer:
Use try-catch blocks or throws keyword. For cleanup, use finally block.


Q14: Types of Exceptions?

Answer:

  • Checked Exceptions: Must be handled at compile time (e.g., IOException).

  • Unchecked Exceptions: Runtime issues like NullPointerException, IndexOutOfBoundsException.


Q15: When is finally block not executed?

Answer:

  • When JVM shuts down via System.exit()

  • When fatal errors like OutOfMemoryError occur


Q16: What is a deadlock and how to avoid it?

Answer:

  • Deadlock: Two threads wait indefinitely for resources held by each other.

  • Prevention: Avoid nested locking or use timeout mechanisms.


Q17: What are wait() and notify() in Java?

Answer:
Used for inter-thread communication, like in producer-consumer problems. wait() releases lock and pauses thread, notify() wakes a waiting thread.


Q18: Difference between HashMap and ConcurrentHashMap?

Answer:

  • HashMap: Not thread-safe, suitable for single-threaded apps.

  • ConcurrentHashMap: Thread-safe using segmented locks, ideal for concurrent apps.


Q19: Difference between ArrayList and LinkedList?

Answer:

  • ArrayList: Fast for random access, backed by array.

  • LinkedList: Fast for insert/delete, backed by nodes with references.


Q20: Difference between SQL and NoSQL databases?

Answer:

  • SQL: Structured schema, uses SQL for queries (e.g., MySQL).

  • NoSQL: Schema-less, good for flexible data formats (e.g., MongoDB)


💡 Conclusion
This mock interview covers real-world Java backend development scenarios including Spring Boot, microservices, exception handling, and Java 8 features. Ideal for preparing INFOSYS and other enterprise-level backend developer roles.

📺 Inspired by CloudTech’s interview video. Watch here: https://www.youtube.com/watch?v=TNEfRtkla_0

👍 Drop a comment if you’d like more breakdowns like this or want to practice your own interview answers!

Comments

Popular posts from this blog

Top 15 React Interview Questions for 1–2 Years Experience

🟦 Top 15 React Interview Questions for 1–2 Years Experience Preparing for a React interview with 1–2 years of experience? Here's a carefully curated list of 15 important React questions with clear, real-world answers. These are frequently asked in interviews at companies like TCS, Infosys, Cognizant, Capgemini, and product-based firms. Q1. What is the Virtual DOM in React, and how does it improve performance? Answer: The Virtual DOM is a lightweight, in-memory copy of the real DOM. When state/props change, React creates a new Virtual DOM tree, compares it with the old one (diffing), and only updates the parts of the real DOM that changed. This makes rendering much faster and improves performance in large applications. Q2. What is JSX in React? Answer: JSX stands for JavaScript XML. It allows us to write HTML elements in JavaScript and place them in the DOM without using createElement() . JSX improves code readability and is transpiled to React.createElement() calls. ...

Top 15 Spring Boot Interview Questions and Answers – Real Examples (2025)

Top 15 Spring Boot Interview Questions – 2025 Spring Boot is one of the most demanded frameworks for Java backend development. Whether you're interviewing for TCS, Infosys, or a product-based company, these Spring Boot questions will help you prepare like a pro. Here are 15 questions with detailed explanations for developers with 1–2 years of experience. Q1. What is Spring Boot? Answer: Spring Boot is a Java-based open-source framework built on top of the Spring Framework. It helps developers create stand-alone, production-ready Spring applications with minimal configuration. Its key features include: Auto-configuration Embedded servers (Tomcat, Jetty) Starter dependencies Production-ready tools (Actuator, Metrics, etc.) Example: You can create a REST API within minutes by using @RestController and spring-boot-starter-web — no need for external web server deployment. Q2. What is the role of @SpringBootApplication annotation? Answer: This annotation i...

Wipro Java Developer Interview Questions with Answers (Mid-Level Role)

  Wipro Java Developer Interview Questions with Answers (Mid-Level Role) (Glassdoor Based – May 2024) Interview Location: Bengaluru Interview Mode: Online Candidate Role: Mid-Level Java Developer Source: Based on real experience shared on Glassdoor Review Summary: Easy and conversational. Interviewer was friendly. Focus was mainly on Java basics, internals, and real-world understanding. Q1: What is static in public static void main(String[] args) ? A: The static keyword lets the JVM call the method without creating an object. It indicates that the method belongs to the class, not instances. Q2: Why does a Java program start from the main method? A: main() is the predefined entry point of a Java application. The JVM starts execution from there. Q3: What are Checked and Unchecked Exceptions? With examples. A: Checked Exceptions : Detected at compile time. E.g., IOException , SQLException . Unchecked Exceptions : Detected at runtime. E.g., NullPointerExce...