Add office photos
Engaged Employer

MiQ Digital

3.4
based on 85 Reviews
Filter interviews by

10+ TCS Interview Questions and Answers

Updated 13 Dec 2024

Q1. Right view of tree (recursive and using level order)

Ans.

Printing the right view of a tree using recursion and level order traversal.

  • Recursively traverse the right subtree first and then the left subtree.

  • For level order traversal, use a queue to store nodes at each level.

  • Print the rightmost node at each level.

  • Example: For tree 1-2-3-4-5, the right view is 1-2-4-5.

Add your answer
Asked in
SDE Interview

Q2. Find the number of leaf nodes to a binary tree with 4 internal nodes?

Ans.

A binary tree with 4 internal nodes has 5 leaf nodes.

  • A binary tree with n internal nodes has n+1 leaf nodes.

  • A leaf node is a node with no children.

  • Count the number of leaf nodes to find the answer.

Add your answer
Asked in
SDE Interview

Q3. Given the preorder traversal of the tree is DEBFGCA and the postorder traversal of the tree is ABDECFG. Find the inorder traversal?

Ans.

Given preorder and postorder traversal, find inorder traversal of a binary tree.

  • The last element of postorder traversal is the root of the tree

  • Find the root in preorder traversal and divide the tree into left and right subtrees

  • Recursively find the inorder traversal of left and right subtrees

  • Combine the inorder traversal of left subtree, root, and inorder traversal of right subtree

Add your answer
Asked in
SDE Interview

Q4. The number of swapping operations required to sort the array [8,22,7,9,31,19,5,13] in bubblesort?

Ans.

The number of swaps required to sort an array using bubblesort

  • Bubble sort compares adjacent elements and swaps them if they are in the wrong order

  • Count the number of swaps required to sort the given array

  • The given array requires 19 swaps to be sorted using bubblesort

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

Q5. SQL: 1. find the duplicates in a given dataset 2. order of execution 3. output of rank and dense rank 4. running total Tableau: 1. live vs extract 2. scatter plot and box plot 3. formula for IDR and outliers Gu...

read more
Ans.

Interview questions for Analyst II position on SQL, Tableau, and Guesstimate

  • SQL: finding duplicates, order of execution, rank and dense rank, running total

  • Tableau: live vs extract, scatter plot and box plot, IDR and outliers formula

  • Guesstimate: estimating number of flights taking off from an airport in a day

Add your answer

Q6. EDA in python, how to find outliers?

Ans.

Outliers can be found using statistical methods such as z-score, IQR, or using machine learning algorithms like isolation forest.

  • Calculate z-score for each data point and consider points with z-score greater than 3 or less than -3 as outliers.

  • Use interquartile range (IQR) to identify outliers. Points outside the range of Q1 - 1.5*IQR and Q3 + 1.5*IQR are considered outliers.

  • Isolation Forest is a machine learning algorithm that can be used to identify outliers in a dataset.

  • Vis...read more

Add your answer
Are these interview questions helpful?

Q7. What is naive in Naive Bayes?

Ans.

Naive Bayes assumes independence between features, hence 'naive'.

  • Naive Bayes assumes all features are independent of each other, which is often not true in real-world data.

  • Despite its simplifying assumption, Naive Bayes is still widely used in text classification and spam filtering.

  • The 'naive' assumption allows for fast and efficient classification, especially with large datasets.

Add your answer

Q8. Guesstimate to evaluate my approach

Ans.

To evaluate your approach, I would estimate the number of cars passing through a busy intersection in a day.

  • Identify the average number of cars passing through the intersection per minute

  • Calculate the total number of minutes in a day

  • Multiply the average cars per minute by total minutes in a day to get an estimate

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Execution of SQL

Ans.

Execution of SQL involves writing and running queries to retrieve, manipulate, and manage data in a database.

  • Write SQL queries to retrieve specific data from database tables

  • Use SQL functions and operators to manipulate data

  • Execute SQL statements to update or delete records in database

  • Manage database schema by creating, altering, or dropping tables

  • Optimize SQL queries for better performance

Add your answer

Q10. Recursive problem

Ans.

Recursive problem involving finding the factorial of a number.

  • Implement a recursive function to calculate the factorial of a number.

  • Base case: if n is 0 or 1, return 1.

  • Recursive case: return n * factorial(n-1).

Add your answer

Q11. Parking lot design

Ans.

Parking lot design involves layout, capacity, accessibility, and efficiency.

  • Consider the layout of the parking lot to maximize space and ease of navigation.

  • Include designated spots for different types of vehicles (e.g. compact, electric, handicap).

  • Implement efficient traffic flow patterns to reduce congestion and improve safety.

  • Incorporate technology such as sensors or apps for real-time parking availability updates.

Add your answer

Q12. Explain Gradient Decent Algo

Ans.

Gradient Descent is an optimization algorithm used to minimize the error of a model by adjusting its parameters iteratively.

  • Gradient Descent is used in machine learning to find the optimal parameters for a model by minimizing a cost function.

  • It works by calculating the gradient of the cost function at a given point and moving in the opposite direction to reach the minimum.

  • There are different variations of Gradient Descent such as Batch Gradient Descent, Stochastic Gradient De...read more

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

Interview Process at TCS

based on 19 interviews in the last 1 year
Interview experience
3.9
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

3.7
 • 337 Interview Questions
3.4
 • 249 Interview Questions
4.2
 • 199 Interview Questions
4.0
 • 170 Interview Questions
3.9
 • 169 Interview Questions
View all
Top MiQ Digital Interview Questions And Answers
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
Get AmbitionBox app

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