Add office photos
Engaged Employer

Ansys Software Private Limited

3.9
based on 114 Reviews
Filter interviews by

Tata Communications Interview Questions and Answers

Updated 28 Jun 2024

Q1. 0/1 Knapsack Problem Statement

A thief is planning to rob a store and can carry a maximum weight of 'W' in his knapsack. The store contains 'N' items where the ith item has a weight of 'wi' and a value of 'vi'....read more

Ans.

Yes, the 0/1 Knapsack problem can be solved using dynamic programming with a space complexity of not more than O(W).

  • Use a 1D array to store the maximum value that can be stolen for each weight from 0 to W.

  • Iterate through each item and update the array based on whether including the item would increase the total value.

  • The final value in the array at index W will be the maximum value that can be stolen.

Add your answer

Q2. Binary Tree Right View Problem Statement

Given a binary tree of integers, your task is to print the right view of it. The right view represents a set of nodes visible when the tree is viewed from the right side...read more

Ans.

The task is to print the right view of a binary tree, representing nodes visible from the right side in top-to-bottom order.

  • Traverse the tree level by level and keep track of the rightmost node at each level

  • Print the rightmost node of each level to get the right view of the tree

  • Use a queue for level order traversal and a map to store the rightmost nodes

Add your answer
Q3. ...read more

Maximum Path Sum Problem Statement

You are given an n-ary tree consisting of 'N' nodes. Your task is to determine the maximum sum of the path from the root to any leaf node.

Example:

Input:
For the given tree:
Ans.

Find the maximum sum of the path from the root to any leaf node in an n-ary tree.

  • Traverse the tree from root to leaf nodes while keeping track of the sum of each path.

  • At each node, calculate the sum of the path from the root to that node and update the maximum sum found so far.

  • Consider using depth-first search (DFS) or breadth-first search (BFS) for tree traversal.

  • Handle cases where nodes have negative values or where the tree is unbalanced.

Add your answer
Q4. How can you find the size of an array in C or C++ without using sizeof or any standard function?
Ans.

You can find the size of an array in C or C++ by dividing the total size of the array by the size of one element.

  • Calculate the total size of the array by multiplying the number of elements by the size of each element.

  • Divide the total size by the size of one element to get the size of the array.

  • For example, if you have an array of strings arr[] = {'hello', 'world', 'example'}, you can find the size by dividing the total size of the array by the size of one string.

Add your answer
Discover Tata Communications interview dos and don'ts from real experiences
Q5. Explain how indexing in a database works using B+ trees.
Ans.

B+ trees are used for indexing in databases to efficiently search and retrieve data.

  • B+ trees are balanced trees where each node can have multiple keys and child pointers.

  • Data is stored in leaf nodes, while non-leaf nodes are used for navigation.

  • B+ trees are commonly used in databases because of their ability to efficiently search and retrieve data.

  • Example: In a database table with an index on a specific column, B+ trees can be used to quickly locate the rows that match a cert...read more

Add your answer

Q6. Write down the recursion tree for this code:

Ans.

Recursion tree for a given code

  • Identify the base case of the recursion

  • Draw a tree structure with each recursive call as a node

  • Label each node with the input parameters and return values

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

Interview Process at Tata Communications

based on 1 interviews
Interview experience
5.0
Excellent
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

4.2
 • 122 Interview Questions
3.9
 • 67 Interview Questions
3.9
 • 35 Interview Questions
4.2
 • 26 Interview Questions
3.0
 • 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