Top 50 TCS Coding Questions

tcs previous year coding questions , nqt previous year questions

If you’re preparing for the TCS NQT Exam 2024-2025,  you’ve probably heard about the importance of the coding section. It’s one of the most challenging yet scoring parts of the exam. In this blog, I’m going to share insights about TCS coding questions and introduce the top 50 coding questions that have been asked in previous NQT exams.

Why Focus on the Coding Section?
The coding section tests your problem-solving skills, logical thinking, and knowledge of programming languages like C, C++, Java, or Python. Solving these questions not only boosts your confidence but also improves your chances of clearing the exam with a good score.

Exam Pattern For TCS NQT :

 

SectionDuration (in Minutes)
PART-A (Foundation Section) 
Numerical Ability25
Verbal Ability25
Reasoning Ability25
PART-B (Advanced Section) 
Advanced Quantitative & Reasoning Ability25
Advanced Coding90
Total Duration190

Here the TCS package/CTC details typically associated with various roles:

Role CTC (in LPA) Description
TCS Ninja 3.5 – 3.6 LPA Entry-level package for freshers as Assistant Systems Engineer.
TCS Digital 7 – 7.5 LPA Advanced package for exceptional candidates with superior skills.
TCS Innovator ~9 LPA or higher Specialized R&D roles, often offered to top-tier talent.

Practice Sheet :

Here’s a curated list of 50 important TCS NQT coding questions that frequently appear in placement exams. These cover a range of difficulty levels, including basic, intermediate, and advanced concepts:

Basic Level:

  1. Reverse a number.
  2. Check if a number is prime.
  3. Calculate the factorial of a number.
  4. Check for palindrome in a string.
  5. Print the Fibonacci series up to n terms.
  6. Find the greatest common divisor (GCD) of two numbers.
  7. Check if a number is an Armstrong number.
  8. Determine if a string is an anagram of another.
  9. Swap two numbers without using a third variable.
  10. Print patterns such as stars or numbers.

Intermediate Level:

  1. Implement bubble sort.
  2. Merge two sorted arrays.
  3. Find the second largest number in an array.
  4. Detect a loop in a linked list.
  5. Calculate the sum of digits of a number.
  6. Validate balanced parentheses in an expression.
  7. Convert infix expressions to postfix.
  8. Find the first non-repeating character in a string.
  9. Find the missing number in an array of 1 to n.
  10. Perform matrix multiplication.

Advanced Level:

  1. Implement a binary search algorithm.
  2. Solve the knapsack problem using dynamic programming.
  3. Find the longest increasing subsequence.
  4. Implement a minimum spanning tree algorithm (e.g., Kruskal’s or Prim’s).
  5. Perform a depth-first search (DFS) and breadth-first search (BFS) in a graph.
  6. Find the shortest path using Dijkstra’s algorithm.
  7. Solve the N-Queens problem.
  8. Check for a subset with a given sum.
  9. Perform string matching using KMP algorithm.
  10. Solve the Tower of Hanoi problem.

Miscellaneous:

  1. Count the frequency of characters in a string.
  2. Rotate an array by k elements.
  3. Implement a queue using two stacks.
  4. Reverse words in a given string.
  5. Solve the coin change problem.
  6. Find duplicates in an array.
  7. Count the number of islands in a grid.
  8. Convert a binary tree to a doubly linked list.
  9. Merge two binary trees.
  10. Detect a cycle in a directed graph.

Real-World Problems:

  1. Write code for an LRU cache.
  2. Implement a booking system using a queue.
  3. Build a simple calculator using stacks.
  4. Find the median of a data stream.
  5. Optimize a solution for maximum profit in stock buying and selling.
  6. Simulate a parking lot management system.
  7. Create a solution for page ranking using graphs.
  8. Write a file system checker tool.
  9. Implement predictive text functionality.
  10. Build a small chat application logic.

Leave a Reply

Your email address will not be published. Required fields are marked *