Add office photos
Employer?
Claim Account for FREE

Jio Platforms

3.5
based on 1.4k Reviews
Filter interviews by

10+ TCS Interview Questions and Answers

Updated 27 Oct 2024
Popular Designations

Q1. Rotting Oranges Problem Statement

You are given a grid containing oranges where each cell of the grid can contain one of the three integer values:

  • 0 - representing an empty cell
  • 1 - representing a fresh orange...read more
Ans.

Find the minimum time required to rot all fresh oranges in a grid.

  • Use Breadth First Search (BFS) to simulate the rotting process.

  • Track the time taken to rot all oranges and return the result.

  • Handle edge cases like no fresh oranges or unreachable fresh oranges.

  • Consider using a queue to efficiently process adjacent oranges.

Add your answer

Q2. Circular Tour Problem Statement

Consider a circular path with N petrol pumps. Each pump is numbered from 0 to N-1. Every petrol pump provides:

  1. The amount of petrol available at the pump.
  2. The distance to the ne...read more
Ans.

The task is to find the first petrol pump from which a truck can complete a full circle or determine if it's impossible.

  • Iterate through each petrol pump and calculate the remaining petrol after reaching the next pump.

  • If the remaining petrol is negative at any point, reset the starting pump to the next pump and continue.

  • If the total remaining petrol is non-negative after completing the circle, return the index of the starting pump.

  • If the total remaining petrol is negative afte...read more

Add your answer

Q3. Min Stack Problem Statement

Design a special stack that supports the following operations in constant time:

  1. Push(num): Insert the given number into the stack.
  2. Pop: Remove and return the top element from the st...read more
Ans.

Design a special stack that supports constant time operations like push, pop, top, and getMin.

  • Use two stacks - one to store the elements and another to store the minimum values encountered so far

  • When pushing, check if the element is smaller than the current minimum and update the minimum stack accordingly

  • For pop, top, and getMin operations, simply access the top elements of the respective stacks

  • Ensure to handle cases where the stack is empty

Add your answer

Q4. Unique Paths Problem Statement

Given the dimensions of an M x N matrix, determine the total number of unique paths from the top-left corner to the bottom-right corner of the matrix.

Allowed moves are only to th...read more

Ans.

The problem involves finding the total number of unique paths from the top-left corner to the bottom-right corner of an M x N matrix with allowed moves only to the right or down.

  • Use dynamic programming to solve the problem efficiently.

  • Create a 2D array to store the number of unique paths for each cell in the matrix.

  • Initialize the first row and first column with 1 as there is only one way to reach each cell in the first row and column.

  • For each cell (i, j), the number of unique...read more

Add your answer
Discover TCS interview dos and don'ts from real experiences

Q5. Rotate Linked List Problem Statement

Given a linked list consisting of 'N' nodes and an integer 'K', your task is to rotate the linked list by 'K' positions in a clockwise direction.

Example:

Input:
Linked List...read more
Ans.

Rotate a linked list by K positions in a clockwise direction.

  • Traverse the linked list to find the length and the last node.

  • Connect the last node to the head to form a circular linked list.

  • Find the new head by moving (length - K) steps from the original head.

  • Break the circular list at the new head to get the rotated linked list.

Add your answer

Q6. Binary Palindrome Check

Given an integer N, determine whether its binary representation is a palindrome.

Input:

The first line contains an integer 'T' representing the number of test cases. 
The next 'T' lines e...read more
Ans.

Check if the binary representation of a given integer is a palindrome.

  • Convert the integer to binary representation.

  • Check if the binary representation is a palindrome by comparing it with its reverse.

  • Return true if it is a palindrome, false otherwise.

Add your answer

Q7. Print Fibonacci series

Ans.

Print Fibonacci series

  • Start with 0 and 1 as the first two numbers

  • Add the previous two numbers to get the next number in the series

  • Repeat until desired number of terms is reached

Add your answer

Q8. rolling hash dsa problem

Ans.

Rolling hash is a hashing technique used in data structures and algorithms to efficiently compare substrings of text.

  • Rolling hash is used in algorithms like Rabin-Karp string matching algorithm.

  • It involves updating the hash value of a substring by removing the contribution of the first character and adding the contribution of the next character.

  • It is useful for comparing substrings in constant time complexity.

Add your answer

Q9. Multi Threading in Java

Ans.

Multi threading in Java allows multiple threads to execute concurrently, improving performance and responsiveness.

  • Multi threading is achieved in Java by extending the Thread class or implementing the Runnable interface.

  • Threads share the same memory space, allowing them to communicate and synchronize using methods like wait(), notify(), and notifyAll().

  • Concurrency issues like race conditions and deadlocks can occur in multi-threaded applications and must be carefully managed.

  • E...read more

Add your answer

Q10. Synchronization in Java

Ans.

Synchronization in Java ensures that only one thread can access a shared resource at a time.

  • Synchronization is achieved using the synchronized keyword in Java.

  • It can be applied to methods or blocks of code.

  • Example: synchronized void myMethod() { // code }

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at TCS

based on 14 interviews
3 Interview rounds
Resume Shortlist Round
Technical Round - 1
Technical Round - 2
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

3.2
 • 35 Interview Questions
3.8
 • 35 Interview Questions
3.3
 • 24 Interview Questions
4.0
 • 19 Interview Questions
3.5
 • 14 Interview Questions
3.9
 • 14 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter