i
TCS
Filter interviews by
A program to find the largest of three numbers.
Take three numbers as input from the user.
Compare the first two numbers and store the larger one in a variable.
Compare the variable with the third number and store the largest one in the same variable.
Print the variable as the largest number.
Security in DBMS is provided through access control, authentication, encryption, and auditing.
Access control restricts unauthorized access to data.
Authentication ensures that only authorized users can access the database.
Encryption protects data from unauthorized access by encrypting it.
Auditing tracks and logs all activities in the database for accountability.
Examples of security measures include password protection,
I am a recent graduate with a degree in engineering, passionate about learning and applying new technologies.
Recent graduate with a degree in engineering
Passionate about learning and applying new technologies
Strong problem-solving skills
Experience with project management
Excellent communication skills
TCS is a global IT services company known for its innovative solutions and diverse opportunities for career growth.
TCS has a strong reputation in the IT industry for delivering high-quality services
TCS offers a wide range of projects and technologies to work on, providing valuable learning opportunities
TCS has a global presence, allowing for exposure to different cultures and markets
TCS invests in employee training and...
Yes, I am willing to work in the night as required for the job.
I understand that working night shifts may be necessary in certain situations.
I am flexible with my schedule and can adapt to working at night.
I have previous experience working night shifts and can handle the challenges that come with it.
Yes, I am comfortable to relocate.
I am open to new opportunities and experiences in different locations.
I am willing to adapt to new environments and cultures.
I understand that relocation may be necessary for career growth and development.
I have previously relocated for educational or professional purposes.
I am excited about the prospect of exploring new places and meeting new people.
I was interviewed in Jan 2025.
Case and decode are conditional expressions in PL/SQL used for data manipulation.
CASE is used for conditional logic in SQL statements, while DECODE is used for conditional logic in SELECT statements.
CASE is more flexible and can handle multiple conditions, while DECODE is limited to one condition.
CASE can be used in both SQL and PL/SQL, while DECODE is specific to SQL.
Example of CASE: SELECT CASE WHEN condition1 THEN r...
Primary key uniquely identifies each record in a table, while foreign key establishes a link between two tables.
Primary key ensures uniqueness and cannot have null values
Foreign key establishes a relationship between tables based on the primary key of another table
Example of primary key: EmployeeID in an Employee table
Example of foreign key: DepartmentID in an Employee table linking to DepartmentID in a Department tabl
Rank assigns unique ranks to each distinct row, while Dense Rank assigns consecutive ranks without gaps.
Rank may have gaps in the ranking sequence, while Dense Rank does not.
Rank assigns the same rank to rows with the same values, while Dense Rank assigns different ranks.
Rank function is non-consecutive, while Dense Rank function is consecutive.
Procedures are used to perform an action, while functions return a value.
Procedures do not return a value, while functions do.
Functions can be called from SQL queries, while procedures cannot.
Functions must return a value, while procedures do not necessarily have to.
No, a package body cannot be used without a package specification.
A package body must always be associated with a package specification.
The package specification defines the public interface of the package, while the package body contains the implementation details.
Attempting to use a package body without a corresponding package specification will result in compilation errors.
Use a SQL query with GROUP BY and HAVING clause to find duplicate values in a database.
Use GROUP BY clause to group the values that are duplicated.
Use HAVING clause to filter out the groups that have more than one occurrence.
Example: SELECT column_name, COUNT(*) FROM table_name GROUP BY column_name HAVING COUNT(*) > 1;
Group by and having clause are used together to filter groups based on specified conditions.
Group by clause is used to group rows that have the same values into summary rows.
Having clause is used to filter groups based on specified conditions.
Example: SELECT department, AVG(salary) FROM employees GROUP BY department HAVING AVG(salary) > 5000;
Substr function extracts a substring from a string, while Instr function returns the position of a substring within a string.
Substr function syntax: SUBSTR(string, start_position, length)
Example: SUBSTR('Hello World', 7, 5) will return 'World'
Instr function syntax: INSTR(string, substring)
Example: INSTR('Hello World', 'World') will return 7
Writing a SQL query with a subquery involves nesting one query inside another to retrieve specific data.
Start by writing the main query that will retrieve the primary data
Identify the criteria for the subquery to filter the results
Enclose the subquery within parentheses and use it in the WHERE or FROM clause of the main query
Ensure that the subquery returns a single value or a single column result
Char is fixed length, varchar is variable length with max 4000 bytes, varchar2 is variable length with max 32767 bytes.
Char is fixed length and always right-padded with spaces, while varchar and varchar2 are variable length.
Varchar can store up to 4000 bytes of data, while varchar2 can store up to 32767 bytes.
Char is less efficient in terms of storage compared to varchar and varchar2.
No, it is not possible to combine two tables with differing data and columns without utilizing joins.
Joins are necessary to combine tables based on a common column or key.
Different data and columns require a join to match and merge the data properly.
Examples of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.
Yes, it is possible to update data in a view using INSTEAD OF triggers.
Views are virtual tables that display data from one or more tables.
By using INSTEAD OF triggers, you can update data in a view by specifying the logic to handle the update operation.
The trigger intercepts the update operation on the view and executes the specified logic to update the underlying tables.
For example, you can create an INSTEAD OF trigge...
TCS is a global IT services company known for its innovative solutions and commitment to employee growth.
TCS has a strong reputation in the IT industry for delivering high-quality services.
TCS offers opportunities for professional growth and development through training programs and career advancement.
TCS has a diverse and inclusive work culture that values teamwork and collaboration.
A dynamic cursor in database management allows for the execution of different SQL queries at runtime.
Dynamic cursors are used when the SQL query to be executed is not known until runtime.
They allow for flexibility in querying the database based on user input or other conditions.
Dynamic cursors can be used to handle varying result sets or conditions in a more efficient manner.
Example: Using a dynamic cursor to search fo...
Yes, I have performed performance tuning by identifying bottlenecks and optimizing queries.
Identified slow queries using tools like SQL Trace, Explain Plan, and AWR reports.
Optimized queries by adding indexes, rewriting SQL statements, and reducing unnecessary data retrieval.
Tuned PL/SQL code by using bulk processing, minimizing context switches, and optimizing loops.
Utilized database features like partitioning and mat
A package in PL/SQL is a collection of related procedures, functions, variables, and other constructs.
A package consists of two parts: package specification and package body.
The package specification defines the public interface of the package, including declarations of variables, constants, cursors, procedures, and functions.
The package body contains the actual implementation of the procedures and functions declared i...
I am excited about the opportunity to work with a global leader like TCS and contribute to innovative projects.
TCS is a renowned global company with a strong reputation in the IT industry
I am impressed by TCS's commitment to innovation and cutting-edge technology
I believe TCS offers great opportunities for professional growth and development
I am excited about the chance to work on diverse and challenging projects at TC
I prefer to discuss my salary expectations based on the responsibilities and requirements of the position.
Focus on discussing salary expectations based on the job responsibilities and requirements.
Avoid disclosing specific current salary package.
Emphasize the importance of fair compensation based on market rates and skills.
Provide examples of successful projects or achievements that demonstrate your value.
Discuss oppor...
I am looking for a competitive salary package based on my experience and skills.
I am open to discussing salary based on the responsibilities and requirements of the role.
I have researched the average salary range for Plsql Developers in this location.
I am looking for a package that includes benefits such as healthcare, retirement plans, and professional development opportunities.
Yes, I am comfortable with shift work and have experience working various shifts.
I have previous experience working different shifts in my current/previous roles.
I am flexible with my schedule and can easily adapt to changing shift patterns.
I understand the importance of shift work in ensuring 24/7 coverage for critical systems.
Yes, I am open to any location for the Plsql Developer position.
I am willing to relocate for the right opportunity
I am open to working in different cities or countries
I am flexible with travel requirements for the job
posted on 6 Mar 2025
I was interviewed in Feb 2025.
What people are saying about TCS
I was interviewed 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 open-source Java framework that simplifies the development of database interactions in Java applications.
Hibernate is an Object-Relational Mapping (ORM) tool that maps Java objects to database tables.
It provides a way to perform database operations using Java objects instead of writing SQL queries.
Hibernate handles the mapping of Java classes to database tables and vice versa, as well as the generation ...
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; }
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
TCS interview questions for popular designations
I could relate to my knowledge.
OOP concepts in Java include classes, objects, inheritance, polymorphism, encapsulation, and abstraction.
Classes: Blueprint for creating objects.
Objects: Instances of classes that encapsulate data and behavior.
Inheritance: Allows a class to inherit properties and methods from another class.
Polymorphism: Ability to present the same interface for different data types.
Encapsulation: Bundling data and methods that operate ...
I have learned Java programming language extensively, including object-oriented programming concepts, data structures, and algorithms.
Extensive knowledge of Java syntax and features
Understanding of object-oriented programming concepts like inheritance, polymorphism, and encapsulation
Experience with data structures such as arrays, linked lists, stacks, and queues
Knowledge of algorithms like sorting, searching, and graph...
I have extensive knowledge in Java programming language, including core concepts, data structures, multithreading, and design patterns.
Strong understanding of core Java concepts such as OOP, inheritance, polymorphism, and encapsulation
Experience with data structures and algorithms in Java, including arrays, linked lists, trees, and graphs
Proficient in multithreading and concurrency in Java, including synchronization an...
Yes, I am open to relocating for the right opportunity.
I am open to relocating for the right job opportunity
I am willing to move to a new location if required for the role
I am flexible and adaptable to new environments
I would address the issue by communicating with my team, seeking feedback, and finding alternative solutions.
Initiate a meeting with the team to discuss the lack of support and understand their perspectives
Seek feedback on how to improve collaboration and address any concerns
Explore alternative solutions or resources to move the project forward
Maintain open communication and transparency throughout the process
Get interview-ready with Top TCS Interview Questions
I have utilized useState, useEffect, useContext, and useRef hooks in my projects.
useState - for managing state in functional components
useEffect - for handling side effects in functional components
useContext - for accessing context in functional components
useRef - for accessing DOM elements or storing mutable values
Redux is a predictable state container for JavaScript apps. It helps manage the state of an application in a centralized way.
Redux is a state management library commonly used with React to manage the state of an application.
It follows a unidirectional data flow pattern, where the state is stored in a single store and changes are made through actions and reducers.
Redux allows for a more structured way of managing state ...
visibility: hidden hides an element but still takes up space, while display: none hides an element and removes it from the flow of the document.
visibility: hidden hides the element but it still occupies space on the page
display: none hides the element and removes it from the document flow
visibility: hidden elements are still rendered, just not visible
display: none elements are not rendered at all
JavaScript closures, TDZ, hoisting, and the JavaScript engine are key concepts in understanding how JavaScript works.
JavaScript closures are functions that have access to variables from their outer scope even after the outer function has finished executing.
Temporal Dead Zone (TDZ) is the period between entering a scope and the variable being declared where accessing the variable results in a ReferenceError.
Hoisting is ...
Identify the duplicate character in the string.
I applied via Company Website and was interviewed in Dec 2024. There were 2 interview rounds.
There are two main sections: foundation and advanced. The foundation section consists of three subsections: quantitative, reasoning, and verbal. If you pass the foundation section but do not clear the advanced section, you will be considered for either the ninja role or the digital role during the interview process. The advanced section includes advanced aptitude questions and two coding questions.
Experienced System Engineer with a strong background in network infrastructure and cloud computing.
Over 5 years of experience in designing, implementing, and maintaining complex IT systems
Proficient in network security protocols and troubleshooting techniques
Skilled in virtualization technologies such as VMware and Hyper-V
Certified in Cisco CCNA and CompTIA Network+
Strong problem-solving and communication skills
I was interviewed in Jan 2025.
Directives in Angular are markers on a DOM element that tell Angular to attach a specified behavior to that DOM element or transform it.
Directives are used to create reusable components or add behavior to existing elements.
There are three types of directives in Angular: Component, Structural, and Attribute directives.
Examples of built-in directives in Angular include ngIf, ngFor, and ngStyle.
Pipes are a form of inter-process communication used in Unix-like operating systems to send data between processes.
Pipes allow communication between processes by connecting the standard output of one process to the standard input of another process
There are two types of pipes: unnamed pipes and named pipes (also known as FIFOs)
Unnamed pipes are created using the pipe system call and exist only as long as the processes ...
DI system in Angular is a design pattern where dependencies are injected into a class rather than the class creating them.
DI helps in creating loosely coupled components in Angular applications.
It allows for easier testing and maintenance of code.
Dependencies are provided to a component through its constructor.
Angular's DI system is hierarchical, meaning dependencies can be injected at different levels of the applicati...
An HTTP Interceptor is a middleware component that intercepts incoming and outgoing HTTP requests in an application.
HTTP Interceptors are commonly used in Angular applications to modify or log HTTP requests/responses.
They can be used to add headers, handle errors, or perform authentication.
An example of using an HTTP Interceptor is adding an authorization token to every outgoing request for secure API calls.
localStorage and sessionStorage are both web storage options in JavaScript, but they have different scopes and lifetimes.
localStorage stores data with no expiration date, while sessionStorage stores data for one session only
localStorage data persists even after the browser is closed and reopened, while sessionStorage data is lost when the browser is closed
Both can only store strings, but can be converted to other data
Common design patterns in Angular include Singleton, Observer, Factory, and Dependency Injection.
Singleton pattern ensures a class has only one instance and provides a global point of access to it.
Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Factory pattern is used to create objects without specifying t...
Route guards in Angular are used to control access to certain routes in an application.
Route guards are used to protect routes in Angular applications by controlling whether a route can be activated or not.
There are three types of route guards in Angular: CanActivate, CanActivateChild, and CanDeactivate.
CanActivate guard is used to determine if a route can be activated.
CanActivateChild guard is used to determine if a c...
Methods for communication between components include synchronous and asynchronous communication, message queues, APIs, and web services.
Synchronous communication: Components communicate in real-time, waiting for a response before proceeding.
Asynchronous communication: Components communicate without waiting for a response, allowing for parallel processing.
Message queues: Components send messages to a queue for other com...
I was interviewed in Jan 2025.
ArrayList is preferred for frequent retrieval operations due to fast random access, while LinkedList is suitable for frequent insertions/deletions.
Use ArrayList when frequent retrieval operations are required, such as searching for elements in a large collection.
Choose LinkedList when frequent insertions/deletions are needed, like maintaining a queue or stack.
Consider memory overhead and performance trade-offs when dec...
ReentrantLock should be used instead of synchronized when more flexibility and control over locking mechanisms is needed.
Use ReentrantLock when you need to implement custom locking strategies or require advanced features like tryLock() and lockInterruptibly().
ReentrantLock supports fair locking mechanisms, ensuring that threads acquire the lock in the order they requested it.
Explicit unlocking in ReentrantLock reduces ...
In Java, == checks for reference equality while equals() checks for value equality. Misuse of == can lead to logical errors.
Override equals() when you want to compare the values of objects instead of their references
Override hashCode() alongside equals() to ensure proper functioning in collections like HashMap
Consider implementing Comparable interface for natural ordering in collections
Garbage collection in Java automatically reclaims memory occupied by unused objects using different algorithms and memory regions.
Java garbage collector automatically reclaims memory from unused objects
Different types of GC algorithms in JVM: Serial, Parallel, CMS, G1 GC
Objects managed in Young Generation, Old Generation, and PermGen/Metaspace
Minor GC cleans up short-lived objects in Young Generation
Major GC (Full GC) ...
Lambda expressions in Java 8 improve readability and maintainability by enabling concise and functional-style programming.
Lambda expressions allow writing more compact code by reducing boilerplate code.
They enable passing behavior as arguments to methods, making code more modular and flexible.
Example: (a, b) -> a + b is a lambda expression that adds two numbers.
Checked exceptions must be handled explicitly, while unchecked exceptions do not require explicit handling.
Use custom exceptions when you want to create your own exception types to handle specific scenarios.
Custom exceptions can be either checked or unchecked, depending on whether you want to enforce handling or not.
For example, a custom InvalidInputException could be a checked exception if you want to ensure it is cau...
The Java Memory Model defines how threads interact with shared memory, ensuring visibility and ordering of variable updates in a concurrent environment.
Volatile keyword ensures changes to a variable are always visible to all threads.
Synchronized keyword provides mutual exclusion and visibility guarantees.
Reordering optimizations by the compiler or CPU can lead to unexpected behavior.
Happens-before relationship determin...
Method overloading allows multiple methods with the same name but different parameters, while method overriding allows a subclass to provide a different implementation of a parent method.
Use method overloading when you want to provide multiple ways to call a method with different parameters.
Use method overriding when you want to provide a specific implementation of a method in a subclass.
Example of method overloading: ...
Functional interfaces in Java have exactly one abstract method and work with lambda expressions for concise implementation.
Functional interfaces have exactly one abstract method, such as Runnable, Callable, Predicate, and Function.
Lambda expressions provide a concise way to implement functional interfaces.
Default methods in interfaces help in evolving APIs without breaking backward compatibility.
Method references (::) ...
Java Streams enable functional-style operations on collections with lazy evaluation, unlike Iterators.
Parallel streams can improve performance by utilizing multiple threads, but may introduce overhead due to thread management.
Care must be taken to ensure thread safety when using parallel streams in a multi-threaded environment.
Parallel streams are suitable for operations that can be easily parallelized, such as map and...
Immutability in Java prevents objects from being changed after creation, promoting thread safety and preventing unintended side effects.
Immutable objects cannot be modified after creation, promoting thread safety
String class in Java is immutable, modifications create new objects
Use final fields and avoid setters to create immutable classes
Collections can be made immutable using Collections.unmodifiableList()
Immutabilit...
final, finally, and finalize have different meanings in Java. final is for constants, finally for cleanup, and finalize for garbage collection.
final is used for constants, preventing method overriding, and inheritance
finally is used for cleanup actions after a try-catch block
finalize() is called by the garbage collector before object deletion
Alternatives to finalize() for resource management include using try-with-reso...
Singleton design pattern ensures only one instance of a class exists in the JVM, useful for managing shared resources like database connections.
Avoid using Singleton when multiple instances of a class are required.
Avoid Singleton for classes that are not thread-safe.
Avoid Singleton for classes that need to be easily mockable for testing purposes.
Java annotations provide metadata to classes, methods, and fields, improving code readability and maintainability.
Annotations like @Component, @Service, and @Autowired in Spring help with dependency injection
Annotations reduce boilerplate code compared to XML configurations
Custom annotations can be created using @interface
Reflection APIs allow reading annotation metadata dynamically
Annotations like @Transactional simpl
Java Streams handle parallel processing by dividing data into multiple threads using the ForkJoin framework. Pitfalls include race conditions, performance issues with small datasets, and debugging challenges.
Parallel streams divide data into multiple threads for faster processing
ForkJoin framework handles parallel execution internally
Useful for CPU-intensive tasks but may not improve performance for small datasets
Share...
I was interviewed in Jan 2025.
ArrayList is preferred for frequent retrieval operations due to fast random access, while LinkedList is suitable for frequent insertions/deletions.
Use ArrayList when frequent retrieval operations are required, such as searching for elements in a large collection.
Choose LinkedList when frequent insertions/deletions are needed, like maintaining a queue or stack.
Consider memory overhead and performance trade-offs when dec...
ReentrantLock should be used instead of synchronized when more flexibility and control over locking mechanisms is needed.
Use ReentrantLock when you need to implement advanced locking mechanisms such as tryLock() or lockInterruptibly().
ReentrantLock is preferred when fair locking is required, as it supports fair locking mechanisms.
Consider using ReentrantLock when you want to avoid potential deadlocks or starvation situ...
In Java, == checks for reference equality while equals() checks for value equality. Misuse of == can lead to logical errors.
Override equals() when you want to compare the actual content of objects in user-defined classes.
Override hashCode() method alongside equals() to ensure proper functioning in collections like HashMap.
Implement Comparable interface and override compareTo() method for natural ordering of objects.
Garbage collection in Java automatically reclaims memory occupied by unused objects using different GC algorithms.
Force garbage collection in Java using System.gc() or Runtime.gc() methods.
Not recommended to force garbage collection as it can cause performance issues and disrupt the JVM's natural memory management.
Forcing garbage collection can lead to unnecessary CPU usage and potential application slowdowns.
Lambda expressions in Java 8 improve readability and maintainability by enabling concise and functional-style programming.
Lambda expressions allow writing more compact code by reducing boilerplate code.
They enable passing behavior as arguments to methods, making code more modular and flexible.
Example: (a, b) -> a + b can be used to define a simple addition operation.
They promote functional programming paradigms, lea...
Checked exceptions must be handled explicitly, while unchecked exceptions do not require explicit handling.
Custom exceptions should be used to represent specific error conditions in your application.
Custom exceptions can be either checked or unchecked, depending on whether you want to enforce handling or not.
Examples of custom checked exceptions could include InvalidInputException or DuplicateRecordException.
Examples o...
The Java Memory Model defines how threads interact with shared memory, ensuring visibility and ordering of variable updates in a concurrent environment.
Volatile keyword ensures changes to a variable are always visible to all threads.
Synchronized keyword provides mutual exclusion and visibility guarantees.
Reordering optimizations by compiler or CPU can lead to unexpected behavior.
Happens-before relationship determines o...
Method overloading allows multiple methods with the same name but different parameters, while method overriding allows a subclass to provide a different implementation of a parent method.
Use method overloading when you want to provide multiple ways to call a method with different parameters.
Use method overriding when you want to provide a specific implementation of a method in a subclass.
Example of method overloading: ...
Functional interfaces in Java have exactly one abstract method and work with lambda expressions for concise implementation.
Functional interfaces have exactly one abstract method, making them suitable for lambda expressions.
Examples of functional interfaces in Java include Runnable, Callable, Predicate, and Function.
Default methods in interfaces allow for evolving APIs without breaking backward compatibility.
Method refe...
Java Streams enable functional-style operations on collections with lazy evaluation, unlike Iterators.
Parallel streams can improve performance by utilizing multiple threads, but may introduce overhead due to thread synchronization.
Care must be taken to ensure thread safety when using parallel streams in a multi-threaded environment.
Parallel streams are suitable for operations that can be easily parallelized, such as ma...
Immutability in Java prevents objects from being changed after creation, promoting thread safety and preventing unintended side effects.
Immutable objects cannot be modified after creation, promoting thread safety
String class in Java is immutable, modifications create new objects
Use final fields and avoid setters to create immutable classes
Collections can be made immutable using Collections.unmodifiableList()
Immutabilit...
final, finally, and finalize have different meanings in Java. final is for constants, finally is for cleanup actions, and finalize is for garbage collection.
final is used to declare constants, prevent method overriding, or inheritance
finally block executes after try-catch for cleanup actions
finalize() method is called by garbage collector before object deletion
Alternatives to finalize() for resource management include ...
Singleton design pattern ensures only one instance of a class exists in the JVM, useful for managing shared resources like database connections.
Avoid using Singleton when multiple instances of a class are required.
Avoid Singleton for classes that are not thread-safe.
Avoid Singleton for classes that need to be easily mockable in unit tests.
Java annotations provide metadata to classes, methods, and fields, improving readability and maintainability of code.
Annotations like @Override, @Deprecated, and @SuppressWarnings provide information about the code to developers and tools.
Frameworks like Spring use annotations such as @Component, @Service, and @Autowired for dependency injection, reducing the need for XML configurations.
Custom annotations can be create...
Java Streams handle parallel processing by dividing data into multiple threads using the ForkJoin framework. Pitfalls include race conditions, performance issues with small datasets, and debugging challenges.
Parallel streams use ForkJoin framework for internal parallel execution
Useful for CPU-intensive tasks but may not improve performance for small datasets
Shared mutable state can cause race conditions
Order-sensitive ...
I was interviewed in Jan 2025.
ArrayList is preferred for frequent retrieval operations due to fast random access, while LinkedList is suitable for frequent insertions/deletions.
Use ArrayList when frequent retrieval operations are required, such as searching for specific elements in a list.
Choose LinkedList when frequent insertions/deletions are needed, like maintaining a queue or stack.
Consider memory overhead and performance trade-offs when decidi...
ReentrantLock should be used instead of synchronized when more flexibility and control over locking mechanisms is needed.
Use ReentrantLock when you need to implement advanced locking mechanisms such as tryLock() or lockInterruptibly().
ReentrantLock is preferred when you require a fair locking policy to prevent thread starvation.
Consider using ReentrantLock when you need to handle situations where explicit unlocking is
In Java, == checks for reference equality while equals() checks for value equality. Misuse of == can lead to logical errors.
Override equals() when you want to compare objects based on their values rather than memory addresses
Override hashCode() method alongside equals() to ensure consistent behavior in collections like HashMap
Consider implementing Comparable interface for natural ordering of objects
Garbage collection in Java automatically reclaims memory occupied by unused objects using different algorithms and memory regions.
Java garbage collector automatically reclaims memory from unused objects
Different types of GC algorithms in JVM: Serial, Parallel, CMS, G1 GC
Objects managed in Young Generation, Old Generation, PermGen/Metaspace
Minor GC cleans up short-lived objects in Young Generation
Major GC (Full GC) recl...
Lambda expressions in Java 8 improve readability and maintainability by allowing concise and functional-style programming.
Lambda expressions reduce boilerplate code by providing a more concise syntax for implementing functional interfaces.
They make code more readable by allowing developers to express actions in a more declarative way.
Lambda expressions enable the use of functional programming concepts like map, filter,...
Checked exceptions must be handled explicitly, while unchecked exceptions do not require explicit handling.
Use custom exceptions when you want to create your own exception types to handle specific scenarios.
Custom exceptions can be either checked or unchecked, depending on whether you want to enforce handling or not.
For example, a custom InvalidInputException can be a checked exception if you want to ensure it is caugh...
The Java Memory Model defines how threads interact with shared memory, ensuring visibility and ordering of variable updates in a concurrent environment.
Volatile ensures changes to a variable are always visible to all threads.
Synchronized provides mutual exclusion and visibility guarantees.
Reordering optimizations by the compiler or CPU can lead to unexpected behavior.
Using thread-safe classes like ConcurrentHashMap avo...
Method overloading allows multiple methods with the same name but different parameters, while method overriding allows a subclass to provide a different implementation of a parent method.
Overloading is used to provide multiple methods with the same name but different parameters within the same class.
Overriding is used to provide a different implementation of a parent method in a subclass.
Overloaded methods are resolved...
Functional interfaces in Java have exactly one abstract method and work with lambda expressions for concise implementation.
Functional interfaces have exactly one abstract method, making them suitable for lambda expressions.
Examples of functional interfaces in Java include Runnable, Callable, Predicate, and Function.
Default methods in interfaces allow for evolving APIs without breaking backward compatibility.
Method refe...
Java Streams enable functional-style operations on collections with lazy evaluation, unlike Iterators.
Parallel streams can improve performance by utilizing multiple threads, but may introduce overhead due to thread synchronization.
Care must be taken to ensure thread safety when using parallel streams in a multi-threaded environment.
Parallel streams are suitable for operations that can be easily parallelized, such as ma...
Immutability in Java refers to objects that cannot be changed after creation, leading to thread safety and prevention of unintended side effects.
Immutable objects cannot be modified after creation, promoting thread safety and preventing unintended side effects.
String class in Java is immutable, creating new objects for modifications.
To create an immutable class, use final fields and avoid setters.
Collections can be mad...
final is for constants, finally for cleanup after try-catch, finalize() for garbage collection. Use try-with-resources for resource management.
final - declare constants, prevent method overriding, or inheritance
finally - block after try-catch for cleanup actions
finalize() - method called by garbage collector before object deletion
Use try-with-resources for resource management instead of finalize()
Singleton design pattern ensures only one instance of a class exists in the JVM, useful for managing shared resources like database connections.
Avoid using Singleton when multiple instances of a class are required.
Avoid Singleton for classes that are not thread-safe.
Avoid Singleton for classes that need to be easily mockable in unit tests.
Java annotations provide metadata to classes, methods, and fields, improving code readability and maintainability.
Annotations like @Override, @Deprecated, and @SuppressWarnings provide information about the code to developers and tools.
Spring framework uses annotations like @Component, @Service, and @Autowired for dependency injection, reducing the need for XML configurations.
Custom annotations can be created using @in...
Java Streams handle parallel processing by dividing data into multiple threads using the ForkJoin framework. Pitfalls include race conditions, order-sensitive operations, and debugging challenges.
Parallel streams divide data into multiple threads for faster processing
ForkJoin framework handles parallel execution internally
Useful for CPU-intensive tasks but may not improve performance for small datasets
Shared mutable st...
The duration of TCS interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 8.5k interviews
Interview experience
Hyderabad / Secunderabad,
Chennai
+14-7 Yrs
Not Disclosed
System Engineer
1.1L
salaries
| ₹0 L/yr - ₹0 L/yr |
IT Analyst
66.6k
salaries
| ₹0 L/yr - ₹0 L/yr |
AST Consultant
51.5k
salaries
| ₹0 L/yr - ₹0 L/yr |
Assistant System Engineer
29.8k
salaries
| ₹0 L/yr - ₹0 L/yr |
Associate Consultant
29.5k
salaries
| ₹0 L/yr - ₹0 L/yr |
Amazon
Wipro
Infosys
Accenture