i
TCS
Filter interviews by
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...
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 t...
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: O...
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 dr...
What people are saying about TCS
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 tab...
HashMap works internally using an array of buckets to store key-value pairs, with each bucket containing a linked list of entries.
HashMap uses hashing to determine the index of the bucket where the key-value pair should be stored.
If multiple key-value pairs hash to the same index, they are stored in a linked list within that bucket.
When retrieving a value, the key's hash code is used to find the correct bucket, th...
application.properties is used to store configuration settings for Java applications.
Centralized storage for configuration settings
Easy to update without changing code
Allows for different configurations for different environments (development, testing, production)
Can be used to store database connection details, API keys, logging settings, etc.
Microservices communicate through lightweight protocols like HTTP, messaging queues, and RPC.
HTTP: RESTful APIs are commonly used for communication between microservices.
Messaging queues: Services can communicate asynchronously through message brokers like RabbitMQ or Kafka.
RPC (Remote Procedure Call): Services can directly call each other's functions over the network.
Java APIs provide a set of routines, protocols, and tools for building software applications in Java.
APIs (Application Programming Interfaces) allow different software components to communicate.
Java APIs are built on Java libraries, providing pre-defined methods and classes.
Example: The Java Collections Framework API provides data structures like List, Set, and Map.
APIs can be local (within the same application) o...
HashMap is non-synchronized and allows null values, while Hashtable is synchronized and does not allow null keys or values.
HashMap is non-synchronized, meaning it is not thread-safe, while Hashtable is synchronized and thread-safe.
HashMap allows null values and one null key, while Hashtable does not allow null keys or values.
HashMap is generally preferred for non-thread-safe applications, while Hashtable is used i...
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.
...
The equals() method is used to compare the contents of two objects for equality.
The equals() method is a method of the Object class in Java.
It is used to compare the contents of two objects for equality.
The default implementation of equals() in the Object class compares memory addresses, so it is often overridden in custom classes to compare content.
Example: String class overrides equals() method to compare the content...
MongoDB was integrated in the application by using the official Java driver and configuring connection settings.
Used the official MongoDB Java driver to interact with the database
Configured connection settings such as host, port, database name, and authentication credentials
Implemented CRUD operations using MongoDB Java driver methods
Utilized MongoDB aggregation framework for complex queries
Hibernate is an object-relational mapping (ORM) framework for Java that simplifies database interactions.
Hibernate maps Java classes to database tables, allowing developers to work with Java objects instead of SQL queries.
It provides a powerful query language called HQL (Hibernate Query Language) that is similar to SQL but operates on objects.
Hibernate supports various database systems, making it versatile for differen...
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...
The Callable interface in Java returns a Future object.
Callable interface returns a Future object which represents the result of a computation that may not be available yet.
The Future object can be used to retrieve the result of the computation, check if it is done, or cancel the computation.
Example: Callable<Integer> task = () -> { return 42; }
ConcurrentHashMap allows concurrent access and updates, ensuring thread safety without locking the entire map.
Uses a segmented locking mechanism to allow multiple threads to read and write concurrently.
Divides the map into segments, each with its own lock, reducing contention.
Supports operations like put, get, and remove without blocking the entire map.
Example: Inserting elements in a multi-threaded environment allows ...
Monitor application health using metrics, logs, alerts, and performance monitoring tools.
Use monitoring tools like Prometheus, Grafana, or New Relic to track key metrics such as CPU usage, memory usage, response times, and error rates.
Implement logging to record important events and errors in your application. Use tools like ELK stack (Elasticsearch, Logstash, Kibana) for log analysis.
Set up alerts to notify you of any...
To call an API in a Microservice architecture, use HTTP requests or messaging protocols like gRPC.
Use HTTP requests to communicate between microservices
Implement RESTful APIs for easy integration
Leverage messaging protocols like gRPC for efficient communication
Consider using service discovery mechanisms for dynamic API calls
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...
Synchronized keyword is used in Java to control access to shared resources by multiple threads.
Synchronized keyword can be applied to methods or code blocks to ensure only one thread can access the synchronized code at a time.
It prevents race conditions and ensures thread safety by creating a lock on the object or class.
Example: synchronized void myMethod() { // synchronized code block }
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...
Executor framework is a framework in Java that provides a way to manage and execute tasks asynchronously.
Allows for managing thread execution in a more efficient way
Provides a way to decouple task submission from task execution
Supports various types of executors like ThreadPoolExecutor and ScheduledExecutorService
Helps in handling tasks concurrently and asynchronously
BlockingQueue is an interface in Java that represents a queue which supports operations that wait for the queue to become non-empty when retrieving an element and wait for space to become available in the queue when adding an element.
BlockingQueue is part of the java.util.concurrent package.
It is used for implementing producer-consumer scenarios where multiple threads are involved.
Methods like put() and take() are used...
Seeking new challenges and opportunities for growth.
Desire for career advancement
Looking for new challenges
Seeking better work-life balance
Company restructuring or downsizing
Relocation to a new area
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;
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 192 interview experiences
Difficulty level
Duration
based on 659 reviews
Rating in categories
System Engineer
1.1L
salaries
| ₹3.9 L/yr - ₹8.3 L/yr |
IT Analyst
65.1k
salaries
| ₹8 L/yr - ₹14.6 L/yr |
AST Consultant
54.2k
salaries
| ₹12.4 L/yr - ₹23.2 L/yr |
Associate Consultant
33.7k
salaries
| ₹15.3 L/yr - ₹28.5 L/yr |
Assistant System Engineer
33.2k
salaries
| ₹2.4 L/yr - ₹6.2 L/yr |
Amazon
Wipro
Infosys
Accenture