Skip to content

TCS Data Analytics Interview Questions & Answers

Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.

Solved for TCSStart practicing
3 QUESTIONS FREESign up or log in to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

How do you merge two DataFrames on different column names?

Save to ▾
Show answer
pd.merge(df1, df2, left_on='cust_id', right_on='id', how='left') joins on differently named keys.
02

How do you define and choose KPIs?

TCSMedium
Save to ▾
Show answer
Pick metrics tied to a business goal that are measurable, actionable and owned by someone, and pair a lagging metric with a leading one.
03

What is the difference between mean and median for reporting salaries?

TCSMedium
Save to ▾
Show answer
Salaries are right-skewed, so the median better represents the typical employee while the mean is pulled up by a few high earners.
04

Explain funnel analysis.

TCSHard
Save to ▾
Show answer
Track users through steps (visit → product view → cart → payment), compute conversion between each step, find the biggest drop, segment by device and source, and suggest fixes to test.
05

What is the difference between COUNT, COUNTA and COUNTIF?

TCSEasy
Save to ▾
Show answer
COUNT counts numbers, COUNTA counts non-empty cells and COUNTIF counts cells meeting one condition; COUNTIFS handles several conditions.
06

What is hypothesis testing in simple words?

TCSMedium
Save to ▾
Show answer
You assume no effect (null), collect evidence and decide whether the data is surprising enough to reject that assumption at a chosen significance level.
07

What is the difference between melt and pivot?

TCSMedium
Save to ▾
Show answer
melt converts wide data to long format; pivot converts long data to wide, and they are used to reshape data for analysis or charts.
08

What does the CALCULATE function do?

TCSMedium
Save to ▾
Show answer
It evaluates an expression after modifying the filter context, for example CALCULATE(SUM(Sales[Amount]), Region[Name] = "North").
09

What is Power BI and its main components?

TCSEasy
Save to ▾
Show answer
A Microsoft BI tool made of Power BI Desktop for building reports, the Service for sharing, and Mobile; it connects, models and visualises data.
10

What does CASE WHEN do?

TCSMedium
Save to ▾
Show answer
It adds conditional logic inside queries, for example bucketing ages or flagging values, returning different results per condition.
11

How do you create a new column from conditions?

TCSMedium
Save to ▾
Show answer
Use np.where for one condition, np.select for several, or df.apply with a function for custom logic.
12

How would you calculate retention using SQL?

TCSHard
Save to ▾
Show answer
Find each user's first activity date as a cohort, join to later activity, and compute the share of each cohort active in day, week or month N.
13

What is descriptive vs inferential statistics?

TCSEasy
Save to ▾
Show answer
Descriptive statistics summarise the data you have; inferential statistics use a sample to draw conclusions about a larger population.
14

What are slicers and filters?

TCSEasy
Save to ▾
Show answer
Slicers are on-page visual filters users click; filters can be set at visual, page or report level and may be hidden from users.
15

Explain time intelligence functions.

TCSMedium
Save to ▾
Show answer
DAX functions like TOTALYTD, SAMEPERIODLASTYEAR and DATEADD compare periods; they need a proper continuous date table marked as a date table.
16

What is conditional formatting?

TCSEasy
Save to ▾
Show answer
It automatically formats cells based on rules such as colour scales, data bars or highlighting values above a target, making patterns visible at a glance.
17

How do you clean messy text data in Excel?

TCSMedium
Save to ▾
Show answer
Use TRIM, CLEAN, UPPER or PROPER, Text to Columns, Flash Fill, SUBSTITUTE, and Power Query for repeatable cleaning steps.
18

Import mode vs DirectQuery?

TCSMedium
Save to ▾
Show answer
Import loads data into memory for fast visuals; DirectQuery queries the source live, giving fresh data but slower performance and some DAX limits.
19

How do you choose the right chart?

TCSEasy
Save to ▾
Show answer
Line for trends, bar for comparisons, scatter for relationships, histogram for distributions and pie only for few parts of a whole.
20

What is a PivotTable and when do you use it?

TCSMedium
Save to ▾
Show answer
A tool that summarises large tables by dragging fields into rows, columns, values and filters, so you can slice sales by region or month without writing formulas.
21

Mean vs median vs mode — when do you use which?

TCSEasy
Save to ▾
Show answer
Mean for symmetric data without outliers, median for skewed data (salaries, house prices), mode for categories (the most common city).
22

Explain INDEX and MATCH together.

TCSMedium
Save to ▾
Show answer
MATCH finds the position of a value in a range and INDEX returns the item at that position, giving a flexible lookup that works left or right and survives column insertions.
23

How would you investigate a sudden 20% drop in daily sales?

TCSMedium
Save to ▾
Show answer
Check data pipelines first, then segment by channel, region, product and device, compare to the same period last year, and look for launches, outages or campaigns.
24

A marketing campaign shows more sales. How do you prove it worked?

TCSHard
Save to ▾
Show answer
Compare with a control group or use difference-in-differences, control for seasonality, and measure incremental sales against campaign cost.
25

How do you change data types and parse dates?

TCSMedium
Save to ▾
Show answer
df['date'] = pd.to_datetime(df['date']); df['amount'] = pd.to_numeric(df['amount'], errors='coerce'); astype('category') for repeated strings.
26

What does the IF function do and how do you nest it?

TCSEasy
Save to ▾
Show answer
IF returns one result if a test is true and another if false. Nest IFs for multiple outcomes, or use IFS for cleaner formulas.
27

Find customers who ordered in January but not in February.

TCSHard
Save to ▾
Show answer
SELECT DISTINCT customer_id FROM orders WHERE month = 'Jan' EXCEPT SELECT customer_id FROM orders WHERE month = 'Feb';
28

What is a pivot table and when do you use it?

TCSEasy
Save to ▾
Show answer
A pivot table summarises large data by dragging fields into rows, columns, values and filters — for example total sales by region and month — without writing formulas.
29

What are relationships and cardinality in Power BI?

TCSMedium
Save to ▾
Show answer
Links between tables on key columns; cardinality can be one-to-many, many-to-one or many-to-many, and cross-filter direction controls how filters flow.
30

What are indexes and when can they hurt?

TCSMedium
Save to ▾
Show answer
Indexes speed up lookups by keeping sorted pointers. They slow writes and use space, so index columns used in filters and joins, not every column.
31

What is normalisation?

TCSMedium
Save to ▾
Show answer
Organising tables to reduce redundancy and anomalies by splitting data into related tables, commonly up to third normal form.
32

What is a primary key vs a foreign key?

TCSEasy
Save to ▾
Show answer
A primary key uniquely identifies each row in its table; a foreign key references another table's primary key to enforce relationships.
33

How do you optimise a slow SQL query?

TCSHard
Save to ▾
Show answer
Read the execution plan, add or fix indexes, select only needed columns, filter early, avoid functions on indexed columns, and replace correlated subqueries with joins.
34

Explain the types of SQL joins.

TCSEasy
Save to ▾
Show answer
INNER returns matching rows, LEFT keeps all left rows, RIGHT keeps all right rows, FULL keeps all rows from both, and CROSS returns every combination.
35

What is DAX and how does it differ from Excel formulas?

TCSMedium
Save to ▾
Show answer
DAX is the formula language for Power BI models. It works on columns and tables with filter context rather than on individual cells.
36

SUMIFS vs COUNTIFS?

TCSEasy
Save to ▾
Show answer
SUMIFS adds values that meet several conditions; COUNTIFS counts rows that meet several conditions. Example: =SUMIFS(Sales, Region, "North", Month, "Jan")
37

Sales dropped 20% last month. How will you analyse it?

TCSMedium
Save to ▾
Show answer
Confirm data accuracy first → break down by region, product, channel and customer segment → compare with seasonality and last year → check pricing, stock-outs, marketing changes and funnel conversion → present the root causes with clear charts.
38

How are NULLs handled in SQL?

TCSMedium
Save to ▾
Show answer
NULL means unknown, so comparisons with = fail; use IS NULL, COALESCE for defaults and remember most aggregates ignore NULLs except COUNT(*).
39

What is the difference between DELETE, TRUNCATE and DROP?

TCSEasy
Save to ▾
Show answer
DELETE removes chosen rows and can be rolled back; TRUNCATE empties the table quickly; DROP removes the table structure itself.
40

Difference between a CTE, a subquery and a temp table?

TCSMedium
Save to ▾
Show answer
A subquery is inline; a CTE is a named, readable block for one statement; a temp table is physically stored for the session and can be indexed and reused.
41

How do you handle large CSV files that do not fit in memory in Python?

TCSMedium
Save to ▾
Show answer
Read in chunks with chunksize, load only needed columns, set efficient dtypes or switch to Dask, Polars or a database.
42

What is Power Query's role in Power BI?

TCSMedium
Save to ▾
Show answer
It extracts and transforms data using recorded steps in M language, such as merging, unpivoting, changing types and removing errors, before loading to the model.
43

What is Power Query and why is it useful?

TCSMedium
Save to ▾
Show answer
An ETL tool inside Excel for importing, cleaning and shaping data with recorded steps that refresh automatically when the source changes.
44

How would you reconcile two large lists in Excel?

TCSHard
Save to ▾
Show answer
Use XLOOKUP or COUNTIF to flag missing items in each list, or merge them in Power Query with a full outer join and filter unmatched rows.
45

DAX: calculated column vs measure?

TCSMedium
Save to ▾
Show answer
A calculated column is computed row by row and stored in the model. A measure is computed at query time using the filter context, e.g. Total Sales = SUM(Sales[Amount]). Prefer measures for aggregations.
46

Which KPIs would you track for an e-commerce app?

TCSMedium
Save to ▾
Show answer
DAU/MAU, conversion rate, average order value, cart abandonment, retention/churn, CAC, LTV, return rate and NPS.
47

What is a star schema?

TCSMedium
Save to ▾
Show answer
A central fact table (sales, numeric events) linked to dimension tables (date, product, customer). It keeps Power BI models simple, fast and correct when filtering.
48

Explain GROUP BY with an example.

TCSMedium
Save to ▾
Show answer
It groups rows sharing values so aggregates run per group, for example SELECT region, SUM(sales) FROM orders GROUP BY region.
49

How do you calculate a rolling average?

TCSMedium
Save to ▾
Show answer
df['sales'].rolling(window=7).mean() gives a 7-period moving average, useful to smooth daily noise.
50

INNER JOIN vs LEFT JOIN — with an example.

TCSEasy
Save to ▾
Show answer
INNER JOIN returns only matching rows. LEFT JOIN returns every row from the left table and NULLs where the right table has no match — e.g. all customers, including those with no orders.
51

What is the difference between a view and a materialised view?

TCSMedium
Save to ▾
Show answer
A view stores a query and runs it each time; a materialised view stores the result physically and must be refreshed, making reads faster.
52

What is statistical significance vs practical significance?

TCSMedium
Save to ▾
Show answer
A result can be statistically significant yet too small to matter; always report effect size and business impact together with the p-value.
53

What is the difference between WHERE and HAVING?

TCSEasy
Save to ▾
Show answer
WHERE filters rows before grouping. HAVING filters groups after GROUP BY and can use aggregates like SUM() or COUNT().
54

How do you calculate a running total?

TCSMedium
Save to ▾
Show answer
SUM(amount) OVER (ORDER BY order_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) adds up values cumulatively.
55

How do you calculate month-over-month growth?

TCSMedium
Save to ▾
Show answer
Aggregate revenue by month, use LAG(revenue) OVER (ORDER BY month), then (revenue - prev) / prev x 100.
56

Show a Pandas groupby example.

TCSEasy
Save to ▾
Show answer
df.groupby('region')['sales'].agg(['sum', 'mean', 'count']) # splits by region, aggregates, combines the results
57

What are absolute and relative cell references?

TCSMedium
Save to ▾
Show answer
Relative references change when copied (A1); absolute references stay fixed ($A$1); mixed references lock only the row or column (A$1 or $A1).
58

How do you handle outliers in Pandas?

TCSMedium
Save to ▾
Show answer
Detect with IQR or z-score, then cap with clip, remove, transform with log, or keep and flag them depending on whether they are errors or real events.
59

How do you detect and handle skewed data?

TCSMedium
Save to ▾
Show answer
Check histograms and skew(), then apply log, square-root or Box-Cox transforms, or use medians and robust statistics.
60

What is the difference between a table and a normal range?

TCSMedium
Save to ▾
Show answer
A table auto-expands, supports structured references, banded rows and slicers, and keeps formulas consistent as rows are added.
61

How do you improve Power BI report performance?

TCSMedium
Save to ▾
Show answer
Use a star schema, remove unused columns, prefer measures, reduce visuals per page, limit high-cardinality fields and use aggregations or incremental refresh.
62

How do you detect outliers?

TCSMedium
Save to ▾
Show answer
Visually with a box plot, with the IQR rule (below Q1 − 1.5×IQR or above Q3 + 1.5×IQR) or a z-score above 3. Then decide with the business whether to cap, remove or keep them.
63

How do you present insights to non-technical stakeholders?

TCSMedium
Save to ▾
Show answer
Lead with the answer, use one simple chart per point, translate numbers into business impact (₹, %), avoid jargon and end with a clear recommendation and next step.
64

What is the difference between a calculated field and a helper column in Excel?

TCSMedium
Save to ▾
Show answer
A calculated field lives inside a PivotTable and works on summarised data; a helper column is a normal column of formulas that feeds the PivotTable or other formulas.
65

How do you create a dynamic dashboard in Excel?

TCSMedium
Save to ▾
Show answer
Build PivotTables from a clean table, add PivotCharts and slicers, link KPIs with formulas, and refresh from Power Query so everything updates together.
66

What does CALCULATE do in DAX?

TCSHard
Save to ▾
Show answer
CALCULATE evaluates an expression in a modified filter context, e.g. CALCULATE([Total Sales], Region[Name] = "North"). It is the key function for time intelligence and comparisons.
67

Difference between UNION and UNION ALL?

TCSMedium
Save to ▾
Show answer
UNION removes duplicate rows and sorts internally; UNION ALL keeps every row and is faster.
68

How do you remove duplicates in Excel?

TCSEasy
Save to ▾
Show answer
Data tab, Remove Duplicates, pick the columns to compare. For a non-destructive way use UNIQUE() or conditional formatting to highlight repeats first.
69

How do SUMIFS and SUMPRODUCT differ?

TCSMedium
Save to ▾
Show answer
SUMIFS sums values meeting several criteria and is fast. SUMPRODUCT multiplies arrays and adds them, handling more complex conditions and weighted totals.
70

How do you connect Python to a SQL database?

TCSMedium
Save to ▾
Show answer
Create an engine with SQLAlchemy or a driver such as psycopg2, then run pd.read_sql(query, engine) to load results into a DataFrame.
71

How would you find customers who never placed an order?

TCSMedium
Save to ▾
Show answer
LEFT JOIN customers to orders and keep rows where order_id IS NULL, or use NOT EXISTS, which also handles NULLs safely.
72

Find the second highest salary in SQL.

TCSEasy
Save to ▾
Show answer
SELECT MAX(salary) FROM emp WHERE salary < (SELECT MAX(salary) FROM emp); -- or: DENSE_RANK() OVER (ORDER BY salary DESC) = 2
73

What is the difference between a clustered and a non-clustered index?

TCSMedium
Save to ▾
Show answer
A clustered index defines the physical order of rows (one per table); a non-clustered index is a separate structure with pointers to the rows.
74

Write SQL for a running total of sales by date.

TCSMedium
Save to ▾
Show answer
SELECT order_date, SUM(amount) OVER (ORDER BY order_date) AS running_total FROM sales;