Skip to content

Data Science Interview Questions in Thiruvananthapuram

36 practice questions with answers for Data Science interviews in Thiruvananthapuram.

Data Science jobs in Thiruvananthapuram

Thiruvananthapuram's Technopark is one of India's oldest IT parks, hosting IT-services, product and engineering-services companies. Data and testing teams here often work with global clients in finance, travel and healthcare.

Below are 36 questions that match the mix of service, product and domain employers hiring data scientists in Thiruvananthapuram.

Solved for ThiruvananthapuramStart practicing
3 QUESTIONS FREESign up 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

Write SQL to show each customer's first order date, last order date and the gap between them in days.

Save to ▾
Show answer
SELECT customer_id, MIN(order_date) AS first_order, MAX(order_date) AS last_order, MAX(order_date) - MIN(order_date) AS days_between, COUNT(*) AS orders FROM orders GROUP BY customer_id ORDER BY days_between DESC; -- PostgreSQL: DATE minus DATE gives days; use DATEDIFF in other engines
02

Explain Bayes' theorem with an example.

Save to ▾
Show answer
P(A given B) = P(B given A) x P(A) / P(B). In a medical test it converts test accuracy and disease prevalence into the real chance a positive result means disease.
03

Why do we use activation functions? Why is ReLU popular?

Save to ▾
Show answer
Activations add non-linearity so networks can learn complex patterns. ReLU (max(0, x)) is cheap and reduces vanishing gradients compared with sigmoid/tanh; Leaky ReLU avoids 'dead' neurons.
04

What is the difference between zero-shot and few-shot prompting?

Save to ▾
Show answer
In zero-shot prompting you give only instructions, like classify this review as positive or negative. In few-shot prompting you also include a few worked examples of input and correct output, which shows the model the format and decision boundary. Few-shot usually improves consistency on custom labels, at the cost of more tokens. Pick examples that cover tricky cases and keep their format identical to what you want back.
05

What is recursive feature elimination?

Save to ▾
Show answer
Recursive feature elimination trains a model, ranks features by importance or coefficient size, removes the weakest ones, and repeats until the desired number remains. RFECV picks the number of features using cross-validation. It considers features together rather than one at a time. The downsides are high compute cost on large data and unstable results when features are correlated, so check stability across folds.
06

How do you deal with high-cardinality categorical features?

Save to ▾
Show answer
Use target or frequency encoding with cross-validation, hashing, embeddings or grouping rare categories, instead of huge one-hot matrices.
07

What is PCA and when do you use it?

Save to ▾
Show answer
It projects data onto orthogonal directions of maximum variance to reduce dimensions, remove correlation and speed up models, at some cost of interpretability.
08

Your model's most important feature is customer_id. What is wrong?

Save to ▾
Show answer
An ID has no real meaning, so high importance means the model is memorising individual customers. It often happens when the same customers appear in both train and test, or when IDs were assigned in time order and act as a proxy for date or signup cohort. I would drop the ID, use a group-based split by customer, and if timing matters, add an explicit feature like account age instead.
09

How would you quickly build a sentiment analysis model for product reviews?

Save to ▾
Show answer
Step 1: collect and label a sample of reviews, checking class balance. Step 2: build a baseline with TF-IDF and logistic regression to get a quick benchmark. Step 3: fine-tune a small pretrained transformer such as DistilBERT for better accuracy, or use a multilingual model if reviews mix languages. Step 4: evaluate with F1 per class and read wrong predictions. Step 5: handle sarcasm and neutral reviews explicitly.
10

What is SVM and the kernel trick?

Save to ▾
Show answer
SVM finds the maximum-margin separating hyperplane. Kernels such as RBF compute similarity in a higher-dimensional space implicitly, so non-linear boundaries are possible.
11

How does a CNN work?

Save to ▾
Show answer
Convolution filters slide over the input to detect local patterns, pooling reduces size, and deeper layers combine edges into shapes and objects. Used mainly for images.
12

What is the attention mechanism?

Save to ▾
Show answer
It lets a model weigh which input positions matter most for each output, computing weighted combinations of values from query-key similarity. It is the core of transformers.
13

Your model performance degrades every few months. Would you retrain on a fixed schedule or based on triggers?

Save to ▾
Show answer
Scheduled retraining, like monthly, is simple and predictable but may be too late after a sudden change or wasteful when nothing changed. Trigger-based retraining runs when monitoring shows drift or a performance drop, which reacts faster but needs reliable monitoring. Many teams combine both: a regular schedule plus triggers for big shifts. Either way, a retrained model must pass the same evaluation gate before replacing the current one.
14

How do you check whether a variable is normally distributed?

Save to ▾
Show answer
Start visually with a histogram and a Q-Q plot; points close to the straight line suggest normality. Check skewness and kurtosis values. Then use a formal test such as Shapiro-Wilk for small samples or Anderson-Darling. Remember that with very large samples, tests flag tiny harmless deviations, so judge by the plots too. If data is skewed, consider a log transform or a non-parametric method.
15

What is the difference between saving a model with pickle, joblib and ONNX?

Save to ▾
Show answer
pickle serialises Python objects; it is simple but tied to Python and library versions, and loading untrusted pickle files is a security risk. joblib is similar but more efficient for objects with large NumPy arrays, like scikit-learn models. ONNX is an open, language-neutral format that runs in optimised runtimes across languages and hardware, useful for fast serving. Always store library versions alongside pickle or joblib files.
16

Write Pandas code to resample daily sales into weekly totals and monthly averages.

Save to ▾
Show answer
import pandas as pd df['date'] = pd.to_datetime(df['date']) s = df.set_index('date')['sales'].sort_index() # Weekly totals, weeks ending on Sunday weekly = s.resample('W-SUN').sum() # Monthly average of daily sales monthly = s.resample('MS').mean() print(weekly.head()) print(monthly.head())
17

Tell me about a time your analysis contradicted what leadership expected.

Save to ▾
Show answer
Situation: leadership believed a discount campaign drove a sales spike. Task: I was asked to measure its impact. Action: I compared similar regions with and without the campaign and found the spike matched a festival week in both. I shared the method, the charts and the limits openly. Result: they cut the next discount budget by half and moved it to retention. I learned to present surprising results with clear evidence and calm framing.
18

Why is cross-entropy preferred over MSE for classification in neural networks?

Save to ▾
Show answer
Cross-entropy measures how far predicted probabilities are from the true class and strongly penalises confident wrong predictions. With a softmax or sigmoid output, it gives large, useful gradients when the model is wrong. MSE with sigmoid outputs gives very small gradients when predictions saturate, so learning slows down. Use binary cross-entropy for two classes, categorical cross-entropy for many classes, and MSE for regression targets.
19

What is an AI agent in the context of LLMs?

Save to ▾
Show answer
An AI agent is an LLM that works in a loop: it plans a step, calls a tool, reads the result and decides the next step until the goal is met. For example, it might query a database, run Python on the result and write a summary. Agents handle multi-step tasks but are less predictable, slower and costlier than a single call. Good designs limit tools and steps, log every action and keep a human check for risky actions.
20

Why do you apply a log transform to some features?

Save to ▾
Show answer
A log transform compresses large values and spreads small ones, which reduces right skew in features like income, price or page views. This helps linear models and distance-based models that are sensitive to scale and outliers. Use log1p, which is log of 1 plus x, when the feature has zeros. For negative values, a Yeo-Johnson transform works. Tree models generally do not need it.
21

Explain exponential smoothing and the Holt-Winters method.

Save to ▾
Show answer
Simple exponential smoothing forecasts with a weighted average of past values where weights decay exponentially, so recent points matter more. Holt's method adds a smoothed trend component. Holt-Winters adds a seasonal component as well, either additive or multiplicative. Each component has a smoothing parameter between 0 and 1 that is fitted to the data. These models are fast, easy to explain and strong baselines for retail and demand data.
22

Your manager asks whether collecting more training data will improve the model. How do you answer using a learning curve?

Save to ▾
Show answer
A learning curve plots training and validation scores against the size of the training set. If both scores are low and close, the model has high bias and needs more features or a more flexible model. If training is high but validation is much lower and the gap narrows as data grows, the model has high variance and more data will help. It tells you whether collecting more data is worth the cost.
23

What is a CTE and what is a recursive CTE?

Save to ▾
Show answer
A CTE, common table expression, is a named temporary result defined with WITH and used in the query that follows. It breaks complex SQL into readable steps and can be referenced more than once. A recursive CTE refers to itself: an anchor query starts the result and a recursive part keeps adding rows until none are added. It is used for hierarchies like employee-manager chains or generating date series.
24

Your daily sales forecast badly misses the Diwali spike every year. How do you fix it?

Save to ▾
Show answer
The model is treating Diwali as noise because the festival moves on the calendar and a fixed yearly seasonality does not align. Add explicit holiday features: a flag for Diwali and a few days before and after, since buying starts early. Include other regional festivals and sale events too. Models like Prophet or gradient boosting with holiday features handle this well. Then backtest specifically on past festive periods to confirm the fix.
25

What is TF-IDF?

Save to ▾
Show answer
Term Frequency × Inverse Document Frequency: a word scores high if it is frequent in one document but rare across all documents. A classic way to turn text into numeric features.
26

What is the difference between list, tuple, set and dict in Python?

Save to ▾
Show answer
List: ordered and mutable. Tuple: ordered and immutable (hashable, slightly faster). Set: unordered, unique items, fast membership checks. Dict: key–value pairs with fast lookup by key.
27

Pandas: find customers whose monthly spend increased for three consecutive months.

Save to ▾
Show answer
m = (df.assign(month=df['date'].dt.to_period('M')) .groupby(['customer_id', 'month'])['amount'].sum() .reset_index() .sort_values(['customer_id', 'month'])) m['up'] = (m.groupby('customer_id')['amount'].diff() > 0).astype(int) # three rises in a row = three consecutive increases m['streak'] = (m.groupby('customer_id')['up'] .rolling(3).sum().reset_index(level=0, drop=True)) result = m.loc[m['streak'] == 3, 'customer_id'].unique()
28

Your LLM assistant confidently quotes a policy clause that does not exist. Why does this happen and how do you reduce it?

Save to ▾
Show answer
Hallucination is when a model produces confident text that is false or not supported by any source. It happens because the model generates plausible tokens rather than checking facts. Reduce it by grounding answers in retrieved documents, asking the model to cite sources and say I do not know when context is missing, using low temperature, and validating outputs with rules or a second checking step. Measure it with a labelled evaluation set.
29

How do you pull large data from a SQL database into Pandas efficiently?

Save to ▾
Show answer
Push as much work as possible into SQL: filter, aggregate and select only needed columns before pulling. Use pd.read_sql with a SQLAlchemy engine and chunksize to stream large results. For very large extracts, export to Parquet from the warehouse and read that, which is much faster than row-by-row transfer. Set dtypes like category early, and never use SELECT star on a big table from a notebook.
30

What is the difference between a subquery and a correlated subquery?

Save to ▾
Show answer
A normal subquery runs once on its own and its result is used by the outer query, for example WHERE price > (SELECT AVG(price) FROM products). A correlated subquery refers to columns of the outer query, so it is logically evaluated once per outer row, for example comparing each product with its own category average. Correlated subqueries can be slow; joins or window functions are usually faster alternatives.
31

How do you use groupby with multiple aggregations?

Save to ▾
Show answer
df.groupby('region').agg(total=('sales','sum'), avg=('sales','mean')) gives named aggregations per group in one pass.
32

Explain the chi-square test.

Save to ▾
Show answer
It checks whether observed category counts differ from expected counts, used for independence between two categorical variables and for goodness of fit.
33

What is the difference between stemming and lemmatisation?

Save to ▾
Show answer
Both reduce words to a base form. Stemming chops suffixes using rules, so studies becomes studi; it is fast but can produce non-words. Lemmatisation uses vocabulary and grammar to return the real dictionary form, so studies becomes study and better becomes good. Lemmatisation is more accurate but slower. With modern transformer models, neither is usually needed because subword tokenisers handle word forms.
34

What is the difference between layer normalisation and batch normalisation?

Save to ▾
Show answer
Batch normalisation normalises each feature using the mean and variance across the batch, so it depends on batch size and behaves differently in training and inference. Layer normalisation normalises across the features of each single example, so it works with any batch size and with variable-length sequences. That is why transformers use layer norm, often in the pre-norm position, while CNNs traditionally use batch norm.
35

Write Pandas code to read a large CSV in chunks and compute total sales per city.

Save to ▾
Show answer
# process 1 million rows at a time import pandas as pd totals = {} for chunk in pd.read_csv('sales.csv', usecols=['city', 'amount'], chunksize=1_000_000): part = chunk.groupby('city')['amount'].sum() for city, amt in part.items(): totals[city] = totals.get(city, 0) + amt result = pd.Series(totals).sort_values(ascending=False)
36

What is the difference between a Pandas Series and a DataFrame?

Save to ▾
Show answer
A Series is a one-dimensional labelled array: one column of values with an index. A DataFrame is a two-dimensional table made of several Series that share the same index, and each column can have its own dtype. Selecting one column, like df['price'], gives you a Series. Selecting with a list, like df[['price']], gives you a DataFrame. Many methods work on both, but the output shape is different.

Companies with offices in Thiruvananthapuram (3)

Few big employers listed in Thiruvananthapuram?

Many Thiruvananthapuram candidates also apply to teams in Bangalore and to remote or hybrid roles. Practise the Bangalore set as well.

Frequently asked questions

Which companies hire Data Science professionals in Thiruvananthapuram?

Companies with large offices in Thiruvananthapuram include UST, Tata Elxsi, Quest Global. Use their company pages below to practise employer-specific sets.

Are Data Science interviews in Thiruvananthapuram different from other cities?

The questions depend more on the company than the city. Thiruvananthapuram's mix of employers decides the style: Data and testing teams here often work with global clients in finance, travel and healthcare

How do I find Data Science jobs in Thiruvananthapuram?

Shortlist companies with Thiruvananthapuram offices, keep your CV focused on Data Science projects, apply on company career pages and job portals with the Thiruvananthapuram filter, and practise the questions on this page before each interview.