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.
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
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?
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.
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?
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?
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?
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.
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.
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.
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?
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?
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?
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.
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?
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.
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?
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.
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?
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.
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?
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.
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?
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.
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?
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?
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?
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?
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?
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.
# 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?
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.
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.