i
TCS
Filter interviews by
Comparator is used to compare objects of a class, while Comparable is implemented by a class to define its natural ordering.
Comparator is an interface that can be used to define custom comparison logic for objects.
Comparable is an interface that is implemented by a class to define its natural ordering.
Comparator can be used to sort objects in different ways, even if they don't implement Comparable.
Comparable allow...
The life cycle of multi-threading involves the creation, execution, and termination of threads.
Threads are created using the Thread class or by implementing the Runnable interface
Threads can be in various states such as new, runnable, blocked, waiting, timed waiting, or terminated
Thread execution involves the start, run, and sleep methods
Threads can communicate and synchronize using methods like wait, notify, and ...
ConcurrentHashMap in Java provides thread-safe operations for high concurrency applications.
Uses separate chaining for handling collisions
Implements lock stripping to reduce contention
Supports full concurrency for read operations
Introduced in Java 5 to address performance issues with Hashtable
OOPs concepts are the foundation of object-oriented programming, including inheritance, encapsulation, polymorphism, and abstraction.
Inheritance: Allows a class to inherit properties and behavior from another class.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Polymorphism: Ability to present the same interface for different data types.
Abstraction: Hiding the complex implemen...
What people are saying about TCS
Java uses automatic memory management through garbage collection to allocate and deallocate memory for objects.
Java uses garbage collection to automatically manage memory by deallocating objects that are no longer in use.
Memory is divided into stack and heap. Stack stores primitive types and references to objects, while heap stores objects.
Java automatically allocates memory for objects on the heap and deallocates...
Exception handling in Spring is done using @ExceptionHandler annotation, @ControllerAdvice annotation, and custom exception classes.
Use @ExceptionHandler annotation in controller classes to handle specific exceptions.
Use @ControllerAdvice annotation to define global exception handling for all controllers.
Create custom exception classes by extending RuntimeException or Exception classes.
Use try-catch blocks to hand...
Multiple data sources in Spring can be configured using Spring Boot's @Configuration annotation and @Bean annotation.
Use @Configuration annotation to define a configuration class for each data source
Use @Bean annotation to create DataSource objects for each data source
Use @Primary annotation to specify the primary data source if needed
OOPs concepts are fundamental principles in object-oriented programming, including inheritance, encapsulation, polymorphism, and abstraction.
Inheritance: Allows a class to inherit properties and behavior from another class. Example: Animal class can be inherited by Dog class.
Encapsulation: Bundling data and methods that operate on the data into a single unit. Example: Using private variables and public methods in ...
Inheritance is a mechanism in which a new class inherits properties and behaviors from an existing class.
Inheritance allows for code reusability and promotes the concept of hierarchical classification.
There are different types of inheritance in Java: single inheritance, multi-level inheritance, hierarchical inheritance, and multiple inheritance.
Example: Class B extends Class A, where Class B inherits properties an...
Private members are accessible only within the same class, while public members can be accessed from any class.
Private members are used for encapsulation and data hiding.
Public members are used for providing access to the outside world.
Example: private int age; vs public String name;
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.
I am a passionate Java Developer with 5 years of experience in building scalable applications and a strong foundation in software engineering.
Experience in Java frameworks like Spring and Hibernate, having developed RESTful APIs for e-commerce platforms.
Proficient in database management with SQL and NoSQL databases, optimizing queries for performance.
Strong understanding of software development methodologies, including...
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 188 interview experiences
Difficulty level
Duration
based on 646 reviews
Rating in categories
System Engineer
1.1L
salaries
| ₹3.9 L/yr - ₹8.3 L/yr |
IT Analyst
65.4k
salaries
| ₹7.8 L/yr - ₹14.5 L/yr |
AST Consultant
53.7k
salaries
| ₹12 L/yr - ₹20.6 L/yr |
Assistant System Engineer
33.2k
salaries
| ₹2.4 L/yr - ₹6.3 L/yr |
Associate Consultant
33.1k
salaries
| ₹16.2 L/yr - ₹28.1 L/yr |
Amazon
Wipro
Infosys
Accenture