ION Group
10+ TCS Interview Questions and Answers
Q1. Count Ways to Climb Stairs Problem
Given a staircase with a certain number of steps, you start at the 0th step, and your goal is to reach the Nth step. At every step, you have the option to move either one step...read more
Q2. Trapping Rain Water in 2-D Elevation Map
You're given an M * N matrix where each value represents the height of that cell on a 2-D elevation map. Your task is to determine the total volume of water that can be ...read more
Q3. You are the owner of a petrol pump. Formulate a profitable strategy
Offer competitive prices, provide excellent customer service, and diversify revenue streams.
Offer competitive prices to attract more customers
Provide excellent customer service to build customer loyalty
Diversify revenue streams by offering additional services like car wash or convenience store
Implement loyalty programs to incentivize repeat business
Invest in technology to streamline operations and reduce costs
Q4. Find the most occuring element in array
Find the most occuring element in array of strings
Iterate through the array and count the occurrences of each element
Keep track of the element with the highest count
Return the element with the highest count
Q5. Payment Management System using four pillars of object oriented programming
A Payment Management System can be designed using the four pillars of object-oriented programming: encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Hide the internal implementation details of payment processing and provide a public interface for interacting with the system.
Inheritance: Create a hierarchy of payment classes such as CreditCardPayment, PayPalPayment, etc. to reuse common functionality.
Polymorphism: Implement different payment methods usin...read more
Q6. Diff between sql / no sql primary key unique key
SQL uses primary keys to uniquely identify records in a table, while NoSQL databases use unique keys for the same purpose.
SQL databases use primary keys to uniquely identify each record in a table, typically using an auto-incrementing integer value.
NoSQL databases use unique keys to achieve the same purpose, but the key can be any unique value, not necessarily an integer.
In SQL, primary keys are used to enforce entity integrity and ensure data consistency, while in NoSQL, uni...read more
Q7. Implement design using hashmap
Implementing design using hashmap for efficient key-value storage and retrieval.
Create a hashmap object to store key-value pairs.
Use put() method to add key-value pairs to the hashmap.
Use get() method to retrieve values based on keys.
Handle collisions using chaining or open addressing techniques.
Consider resizing the hashmap if load factor exceeds a certain threshold.
Q8. What are the 4 pillars of OOPs
Encapsulation, Inheritance, Polymorphism, Abstraction
Encapsulation: Bundling data and methods that operate on the data into a single unit
Inheritance: Ability of a class to inherit properties and behavior from another class
Polymorphism: Ability to present the same interface for different data types
Abstraction: Hiding the complex implementation details and showing only the necessary features
Q9. common puzzles found on gfg
Common puzzles found on GeeksforGeeks
Tower of Hanoi
N-Queens Problem
Knights Tour Problem
Sudoku Solver
Water Jug Problem
Q10. Explain time complexity of binary tree
Time complexity of binary tree refers to the amount of time it takes to perform operations on the tree based on its size.
Time complexity for searching, inserting, and deleting in a binary tree is O(log n) on average.
In worst case scenarios, time complexity can be O(n) for operations like searching if the tree is unbalanced.
Balanced binary trees like AVL trees or Red-Black trees ensure O(log n) time complexity for all operations.
Q11. Implement stack using linked list.
Implement stack using linked list
Create a Node class with data and next pointer
Create a Stack class with top pointer
Implement push, pop, and peek methods by manipulating the linked list
Q12. reverse a linked list
Reverse a linked list by changing the direction of pointers
Start with three pointers: current, previous, and next
Iterate through the linked list, updating pointers to reverse the direction
Update the head of the linked list to be the previous node
Q13. Longest Common Prefix
Find the longest common prefix among an array of strings.
Iterate through the characters of the first string and compare with the corresponding characters of other strings.
Stop when a mismatch is found or when reaching the end of any string.
Return the prefix found so far.
Interview Process at TCS
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month