i
TCS
Filter interviews by
@Qualifier is an annotation in Spring Framework used to resolve ambiguity when multiple beans of the same type exist.
@Qualifier is used in dependency injection to specify which bean to inject when multiple candidates are available.
It can be applied to fields, methods, and constructor parameters.
Example: @Autowired @Qualifier("beanName") private MyBean myBean;
It helps in improving code readability and maintainabili...
Java 8 introduced several features like Lambda expressions, Streams, and Optional, enhancing code efficiency and readability.
Lambda Expressions: Allow for concise representation of functional interfaces. Example: (a, b) -> a + b.
Streams API: Enables functional-style operations on collections. Example: list.stream().filter(x -> x > 10).collect(Collectors.toList()).
Optional Class: Helps in avoiding NullPoin...
Exceptions are issues that can be handled, while Errors are serious problems that usually cannot be recovered from.
Exceptions are checked at compile-time, while Errors are unchecked.
Examples of Exceptions: IOException, SQLException.
Examples of Errors: OutOfMemoryError, StackOverflowError.
Exceptions can be caught and handled using try-catch blocks.
Errors indicate serious problems that a reasonable application shoul...
Java is a high-level, object-oriented programming language designed for portability and ease of use across platforms.
Platform-independent: Write once, run anywhere (WORA) - Java code can run on any device with a Java Virtual Machine (JVM).
Object-oriented: Supports concepts like inheritance, encapsulation, and polymorphism, making code reusable and modular.
Rich API: Provides a comprehensive set of libraries for tas...
What people are saying about TCS
Java is not considered fully object-oriented due to its use of primitive data types, which are not objects.
Primitive Data Types: Java includes primitive types like int, char, and boolean, which are not objects, contrasting with pure OOP languages.
Wrapper Classes: To treat primitives as objects, Java provides wrapper classes (e.g., Integer, Character) that encapsulate these types.
Static Methods: Java allows static ...
Hibernate is an ORM framework that simplifies database interactions in Spring Boot applications.
Hibernate provides an abstraction layer over JDBC, reducing boilerplate code.
It maps Java objects to database tables using annotations, e.g., @Entity.
Hibernate supports lazy loading, which improves performance by loading data on demand.
It manages database transactions and provides a powerful query language (HQL).
Spring ...
Yes, static methods can be included in an interface starting from Java 8, allowing default behavior for interface methods.
Static Methods: Interfaces can have static methods that are called on the interface itself, not on instances of classes implementing the interface.
Example: In an interface 'MyInterface', you can define a static method like 'static void myStaticMethod() { ... }'.
Access: Static methods in interfa...
The standalone design pattern encapsulates functionality in a self-contained module, promoting reusability and separation of concerns.
Encapsulates functionality in a single module or class.
Promotes reusability by allowing independent use of the module.
Facilitates easier testing and maintenance due to separation of concerns.
Example: A utility class that provides static methods for string manipulation.
Can be used in...
Object-oriented programming (OOP) is based on concepts like encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Bundling data and methods that operate on the data within one unit (class). Example: A 'Car' class with attributes like 'speed' and methods like 'accelerate()'.
Inheritance: Mechanism to create a new class from an existing class, inheriting its properties and behaviors. Example: 'Elec...
A REST API workflow involves client requests, server processing, and responses through defined endpoints.
1. Client initiates a request to the API endpoint (e.g., GET /users).
2. The server receives the request and processes it.
3. The server interacts with the database or other services as needed.
4. The server prepares a response, typically in JSON or XML format.
5. The server sends the response back to the client wi...
I appeared for an interview in Dec 2024.
API Gateway implementation is a centralized service that routes, manages, and secures API calls.
API Gateway acts as a single entry point for all API calls
It can handle authentication, rate limiting, caching, and request/response transformations
Examples include AWS API Gateway, Apigee, Kong
Circuit breaker is a design pattern used to prevent system overload by temporarily stopping requests to a failing service.
Circuit breaker monitors requests to a service and opens when the service fails repeatedly.
It helps prevent cascading failures and allows the system to gracefully degrade.
Once the circuit breaker is open, it can periodically check if the service has recovered before allowing requests again.
Deadlock is a situation in which two or more processes are unable to proceed because each is waiting for the other to release a resource.
Avoid circular wait by ensuring processes request resources in the same order.
Prevent hold and wait by requiring processes to request all needed resources at once.
Implement a timeout mechanism to break potential deadlocks.
Use resource allocation graphs to detect and prevent deadlocks.
...
Runnable is a functional interface with a single run() method, while Callable is a functional interface with a single call() method.
Runnable is used for tasks that do not return a result, while Callable is used for tasks that return a result.
Callable can throw checked exceptions, while Runnable cannot.
Callable returns a Future object, which can be used to retrieve the result of the computation.
Example: Runnable - execu...
Profiles in Java are configurations that define the capabilities of a Java platform.
Profiles allow developers to target specific types of devices or applications.
They help in reducing the size of the Java runtime environment by including only the necessary APIs.
Examples include Java SE Embedded Profile for embedded devices and Java SE Compact Profile for resource-constrained environments.
OpenFeign is a declarative web service client used to simplify the process of making HTTP requests in microservices architecture.
OpenFeign allows developers to define RESTful web services as interfaces and automatically generate the necessary implementation code.
It integrates seamlessly with Spring Cloud and other microservices frameworks to facilitate communication between services.
OpenFeign supports features like loa...
Service registry and discovery involves registering services and allowing clients to discover and connect to them.
Implement a service registry where services can register themselves with metadata
Use a service discovery mechanism for clients to find and connect to services
Implement health checks to ensure services are available and healthy
Use a load balancer to distribute traffic among multiple instances of a service
Spring Boot Actuators are built-in tools that provide insight into the running application.
Actuators expose various endpoints to monitor and manage the application.
They can be used to check health, metrics, environment details, and more.
Examples include /actuator/health, /actuator/metrics, and /actuator/env.
Synchronous communication is blocking, while asynchronous communication is non-blocking.
Synchronous communication waits for a response before continuing, while asynchronous communication does not wait.
Examples of synchronous communication include traditional function calls, while examples of asynchronous communication include callbacks and promises.
Synchronous communication can lead to performance issues if there are d...
Excessive use of synchronized blocks and methods in Java can lead to performance issues and potential deadlocks.
Decreased performance due to increased contention for locks
Potential deadlocks if multiple threads are waiting for each other to release locks
Increased complexity and difficulty in debugging and maintaining code
Use synchronized sparingly and consider alternatives like ConcurrentHashMap or Lock interface
The number of threads needed for an application can be determined based on factors like the type of tasks, hardware resources, and performance requirements.
Consider the type of tasks your application needs to perform - CPU-bound tasks may benefit from more threads, while I/O-bound tasks may not.
Take into account the hardware resources available - more threads may be beneficial on a multi-core processor compared to a si...
I appeared for an interview in Jan 2025.
I applied via Recruitment Consulltant and was interviewed in Dec 2024. There was 1 interview round.
Unit testing in Java ensures code reliability and helps catch bugs early in the development process.
Use JUnit framework for writing unit tests. Example: @Test annotation for test methods.
Mock dependencies using Mockito to isolate the unit being tested. Example: Mockito.when(...).thenReturn(...).
Follow the Arrange-Act-Assert pattern for structuring tests. Example: Arrange inputs, Act by calling the method, Assert the ex...
I applied via Job Portal
I appeared for an interview in Dec 2024.
I applied via Referral and was interviewed in Jul 2024. There were 2 interview rounds.
HashMap is a data structure that stores key-value pairs and uses hashing to efficiently retrieve values based on keys.
HashMap internally uses an array of linked lists to store key-value pairs.
When a key-value pair is added, the key is hashed to determine the index in the array where it will be stored.
If multiple keys hash to the same index, a linked list is used to handle collisions.
HashMap allows one null key and mult...
Java 8 introduced new features like lambda expressions, streams, default methods, and functional interfaces.
Lambda expressions allow you to write code in a more concise way.
Streams provide a way to work with sequences of elements.
Default methods allow interfaces to have method implementations.
Functional interfaces have a single abstract method and can be used with lambda expressions.
The synchronized keyword in Java is used to control access to shared resources by allowing only one thread to execute a synchronized block of code at a time.
Synchronized keyword can be used with methods or blocks of code to ensure thread safety.
It can be used to prevent race conditions and ensure data consistency in multi-threaded applications.
Example: synchronized void myMethod() { // synchronized method implementatio...
Fail fast stops the program immediately upon encountering an error, while failsafe allows the program to continue running despite errors.
Fail fast: Stops program immediately upon error to prevent further damage. Example: NullPointerException in Java.
Failsafe: Allows program to continue running despite errors. Example: using try-catch blocks to handle exceptions.
Sort an array and use streams to find names of employees with salary > 50000
Sort the array using Arrays.sort() method
Use streams to filter employee objects with salary > 50000
Map the filtered employee objects to their names
String pool is a memory area in Java heap where unique string literals are stored.
String pool is a part of Java heap memory where unique string literals are stored.
String literals are created using double quotes, e.g. "hello".
Strings created using the same literal will reference the same object in the string pool.
String pool helps in saving memory by reusing common string literals.
REST is an architectural style for distributed hypermedia systems, while SOAP is a protocol for exchanging structured information in web services.
REST is lightweight and uses standard HTTP methods like GET, POST, PUT, DELETE, while SOAP uses XML for message format and relies on protocols like HTTP, SMTP, etc.
REST is stateless, meaning each request from a client to server must contain all the information needed to under...
REST state refers to the state of a resource in Representational State Transfer architecture.
REST state is the current status of a resource in a RESTful system.
It includes data such as resource attributes, relationships, and links.
REST state is represented in the form of URIs, HTTP methods, and representations.
It allows clients to interact with resources by manipulating their state.
Example: In a RESTful API, the state ...
Serialization is the process of converting an object into a stream of bytes to store or transmit it. To stop serialization, mark a field as transient.
Serialization is used to save the state of an object and recreate it when needed.
To stop serialization of a field, mark it as transient in the class.
Example: private transient int sensitiveData;
Failsafe is a mechanism to handle failures without affecting the system's overall functionality, while failfast immediately stops the system upon encountering an error.
Failsafe is used to ensure that a system remains operational even in the face of failures, by providing alternative paths or fallback options.
Failfast is a strategy where the system stops as soon as an error is detected, to prevent further damage or inco...
I applied via Referral and was interviewed in Nov 2024. There was 1 interview round.
A structured approach to connect a controller to a JPA entity in a Java application.
1. Create a REST Controller: Define endpoints using @RestController annotation.
2. Service Layer: Implement business logic in a service class annotated with @Service.
3. Repository Layer: Use Spring Data JPA repository interface for database operations.
4. JPA Entity: Define a class annotated with @Entity representing the database table.
5....
Our project is using JDK 11. We set JDK version in pom.xml. We are using Springboot version 2.5.4. Settings are specified in application.properties. We use Maven as build tool and JUnit for testing.
JDK 11 is specified in pom.xml file of the project
Springboot version 2.5.4 is used in the project
Settings for the project are specified in application.properties file
Maven is used as the build tool for the project
JUnit is us...
HashMap is non-synchronized and allows null values, while hash table is synchronized and does not allow null values.
HashMap is non-synchronized and not thread-safe, while hash table is synchronized and thread-safe.
HashMap allows null values and one null key, while hash table does not allow null keys or values.
HashMap is generally preferred for non-thread-safe applications, while hash table is used in thread-safe applic...
OOP is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
OOP focuses on creating objects that interact with each other to solve problems.
Encapsulation: Objects can hide their internal state and require interaction through defined interfaces.
Inheritance: Objects can inherit attributes and methods from other objects.
Polymorphism: Object...
An interface in programming is a blueprint of a class that defines a set of methods that a class must implement.
Interfaces in Java are used to achieve abstraction and multiple inheritance.
Interfaces contain only method signatures, not method bodies.
Classes can implement multiple interfaces but can only extend one class.
Example: interface Shape { void draw(); }
Example: class Circle implements Shape { public void draw() ...
Some of the top questions asked at the TCS Java Developer interview -
The duration of TCS Java Developer interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 186 interview experiences
Difficulty level
Duration
based on 636 reviews
Rating in categories
System Engineer
1.1L
salaries
| ₹1 L/yr - ₹9 L/yr |
IT Analyst
65.7k
salaries
| ₹5.1 L/yr - ₹17 L/yr |
AST Consultant
53.3k
salaries
| ₹8 L/yr - ₹25.2 L/yr |
Assistant System Engineer
33.2k
salaries
| ₹2.6 L/yr - ₹6.4 L/yr |
Associate Consultant
32.5k
salaries
| ₹9 L/yr - ₹33 L/yr |
Amazon
Wipro
Infosys
Accenture