Most data science interviews are tough for one reason: there’s no consistency on what types of questions get asked. Therefore, you need to prepare for the interview and practice a wide variety of data science interview questions.
The questions you’ll get asked are highly dependent on the position and company you are interviewing with. Some companies view data scientists as high-powered data analysts– in which you’d expect to be asked more SQL questions– while others look for data scientists with strong ETL and data engineering skills.
What comes up most frequently? Interview Query analyzed the most commonly asked questions in data scientist interviews by subject:
Overall SQL questions, machine learning, data structures and algorithms, and statistics and A/B testing interview questions dominated the data science interview.
SQL is most important topic. It’s asked in more than 90% of data science interviews. Machine learning (85%+) and Python (80%+) are also frequently asked topics.
To help you study, we’re going to run through the Top 110 data science interview questions. All of these are real questions asked in data science interviews at companies like Facebook, Google, Amazon, and more.
We highlighted the most important interview questions in nine categories. Of all nine, SQL is of highest significance, as they are asked in more than 90% of interviews, as are machine learning (85%+) and Python (80%+). Explore this guide by question category. Explore questions by category:
In data science interviews, behavioral interview questions are meant to assess technical competency, culture fit, past experience, and communication abilities.
Provide a concrete example and use statistics to back up your claim. You might talk about an increase in user engagement or improved marketing performance.
Be sure to structure your answer. The STAR format (Situation, Task, Actions, Results) is a go-to for many data science interviews. First, you outline the situation: “In my last job, I was working as a marketing analyst.” Then, highlight the task: “Marketing performance had stagnated, and we wanted to increase our marketing ROI.”
Finally, state the actions you took and the results: “I decided to do in-depth analysis on your audience targeting and found more profitable demographics to target. My analysis resulted in a 10 percent increase in marketing ROAS.”
Behavioral questions in data science interviews are commonly used to assess your communication style. This question will help the interviewer understand how well you communicate complex topics. One way to answer this is to talk about data visualization and how you have created visualizations that made your insights more understandable.
Be prepared to talk about any past data science projects that you have worked on. These could be professional projects or ones you have done in your free time. Practice talking about the project using the STAR format (or something similar), and always incorporate the challenges of the project.
Was there a challenge in gathering and cleaning the data? Did you have trouble generating insights? Was communicating the insights difficult?
A behavioral question like this is designed to understand your learning style, organization, and planning skills. First, define the goal. If you’re interviewing for your first data science job, you might choose a goal like learning to code in Python. Or, you might choose a professional goal like completing a project on a tight deadline.
After you’ve provided an overview of the goal, you can use a format like STAR to outline your exact thought and action process.
Inevitably, questions like this will arise in your interview. These are specifically designed to see how you respond to adversity. Be honest in your response, but also be aware of the lessons you learned and how you applied (or would apply) these lessons in future scenarios.
Let’s say the missed deadline was a result of having unclear expectations at the start of the project. You might say, “I learned how important it is to get stakeholder input and nail down requirements before starting a project.” Then, talk about a time you were able to apply those insights or how you would apply them to a future project.
Customer-related behavioral questions are common in Amazon data science interviews. This question you assesses that you can see problems through the customer’s eyes, and develop data-driven methods for helping make customer’s lives easier. You might say:
“In my previous job, I helped to build a predictive model that accurately identified potential customer service problems in real-time. Using the model, our customer success team would be alerted if a customer was experiencing a difficulty, e.g. unhappy with our chatbot process, having difficulty finding relevant information, difficulties in using our system. Using the alerts, the team could then reach out to customers in the moment and were able to resolve issues more quickly. As a result, the team reduced churn and improved customer satisfaction scores.”
Here’s a sample answer to our Data Science Behavioral Questions guide:
“In my last position at an e-commerce company, I was given a goal of developing a system to predict customers who were most likely to churn, which the company could then use to send personalized promotions to head off those customers. The goal was to increase customer retention by 20% and revenue by 10% over one year. Unfortunately, I missed that goal, with retention only increasing by 10% during the desired timeframe. I wanted to understand what went wrong, so I focused on improving and optimizing the prediction algorithm while also working with the marketing team to better personalize the offers.” If true, let the interviewer know if your response helped you accomplish additional goals set for you in the future.
Start with something like, “Yes, I’m experienced working on deadlines and maybe the best way to show is with an example.” Then, walk the interviewer an example like this:
A few tips for this question: 1) Keep it professional (don’t say, I really “liked the company software picnics”), 2) choose an example that aligns with the company you are interviewing with, 3) provide details.
Here’s a sample answer from LiveCareer:
“In my last job I was a member of a five-person team, and we worked together on a variety of large-scale projects where each of us was responsible for one part of the project. I really enjoyed the teamwork aspect of the job, and liked seeing how all the pieces of our projects came together in the end. The teamwork aspect of that job — and this job — is something that greatly appeals to me, because I typically end up learning a lot about what I’m capable of when working in synch with others.”
A good clarifying question would be: “What do you consider a large dataset?” This won’t necessarily change your answer, but it will show that you’re detail-oriented. Note: If you haven’t worked with a “large” dataset, choose a project with a smaller dataset that required a lot of data cleaning and describe how you might scale what you learned to a larger dataset.
A framework you could use for this question:
Start with a framework:
Your answer to this question should focus on results. An example response could be:
“When I joined my last job, the company had severe conversion rate issues. The marketing team was bringing in qualified leads, but they weren’t converting customers at a rate that would be profitable. They hired me as an analyst to determine what was going wrong and advise them on steps that they could take to correct the issue. I created a 3-month plan of attack. Phase 1 was analysis. Phase 2 was recommendations and prioritization. And Phase 3 was the roll-out and maintenance. Through my analysis, I uncovered issues in customer experience, customer segmentation, and messaging. After rolling out my recommendations, we were able to increase conversion rates by 200%.”
Interviewers want to know you’re confident in your communication skills and can effectively communicate complex ideas. With a question like this, walk the interviewer through your process:
In data science interviews, product metrics and analytics questions assess your product intuition and ability to make data-driven product decisions. Data science metrics questions ask you to investigate analytics, measure success, track feature changes, or assess growth. Sometimes, they take the form of data analytics case studies.
See a video mock interview for this product sense question:
See our guide to Facebook data science interview questions.
This decreasing comments product question assesses your product intuition. Here’s a sample solution:
You’re provided information that the user count is increasing linearly. Therefore, the decrease isn’t due to a declining user base. You might want to look at churn and active user engagement to solve this problem.
Active users will churn off the platform, resulting in fewer comments. In this case, you might be interested in the metric: comments per active user.
Let’s assume that, for this question, the VP of Sales provides you a graph that shows agents at Month 3 receiving more than three times the number of leads than agents in Month 1 as proof. What might be flawed about the VP’s thinking?
Hint: The key is to not confuse the output metrics with the input metrics. In this case, while the question makes us think that more leads is the output metric, what should really be investigated is churn. If you break out customers in cohorts based on the number of leads per month, we can see if churn goes down by cohort each month.
With product sense questions in data science interviews, always start with clarifying questions. With this Facebook product data science question, you could ask where the claim came from, and a definition of “younger” user. “Churn” and “active users” are two metrics that would help you verify the claim. In particular, you should be interested in daily, weekly, and monthly rates for both metrics.
By looking at daily, weekly, and monthly churn, we’d have a better grasp on whether younger users are less engaged, e.g. higher weekly churn vs. lower monthly churn, or if Facebook is actually losing younger users.
When initially reading this question, we should first assume that it is a debugging question, and then possibly dive into trade-offs.
WAU (weekly active users) and email open rates are most of the time directly correlated, especially if emails are used as a call to action to bring users back onto the website. An email opened and then clicked would lead to an active user, but it doesn’t necessarily mean that they have correlations or are the only factor causing changes. First, you might want to look at debugging: looking at problems in tracking, seasonality, open rates by country/demographic, etc.
If this doesn’t reveal a solution, you’d next want to consider trade-offs.
The first thing to answer with this question is: “What is success?” Ask clarifying questions like: Would success mean bringing new users onto the platform? Would it be converting users who have been using Uber for ridesharing? Is it new restaurant growth?
Additionally, you’d want to look at metrics like:
Questions like this are common in Pinterest data science interviews. Specifically, this question says the goal is to increase user engagement and the total audience size, and that you are tasked with measuring the impact of video pins on the user experience.
Hint: Since the it’s related to user engagement and total audience size, you need to define a few metrics related to retention and sharing.
To pull the best metrics for product data science questions, start with the goal of the product. In this case, Reddit’s search bar would be designed to provide the most relevant and interesting content to users. How would you measure this? A few metrics you might start with include click-through-rate (CTR), bounce rate (percentage of users who perform search but don’t click a result), and time users spend in search.
Follow up with clarifying questions like:
Then, outline a process. You’d likely start with checking for bugs or errors in the data. Was it an analytics error? Then we could look to internal and external factors like, competitor feature launches, traffic by geolocation, seasonality, similar declines in other metrics (marketing engagement, conversion rate).
Facebook Groups provide a space for users to connect with other users through a shared interest or real-life/offline relationship. Additionally, the overarching business goal is to increase user engagement.
Therefore, you could start with some of the most obvious metrics like monthly active users (is it increasing or decreasing), as well as general engagement metrics like number of posts, comments, and shares.
Some others to consider would be:
You could build a sophisticated sentiment analysis model for a task like this. But let’s say the company doesn’t have the time to invest in that approach? Are there metrics you could use to help you measure the negativity of an abusive tweet?
Video Solution:
More context: Suppose there exists a new airline named Jetco that flies domestically across North America. Jetco recently had a study commissioned that tested the boarding time of every airline, and it came out that Jetco had the fastest average boarding times of any airline.
In data science interviews, machine learning and modeling questions assess your experience using machine learning tools and depth of knowledge. Most commonly, these questions examine algorithm concepts, machine learning case studies, and recommendation engines.
With a question that asks the assumptions of linear regression, know that there are several assumptions, and that they’re baked into the dataset and how the model is built. The first assumption is that there is a linear relationship between the features and the response variable, otherwise known as the value you’re trying to predict. What else can we assume?
Random forest is a bagging algorithm, and in using it, you have several base learners or decision trees, which are generated in parallel and form the base learners of the bagging technique.
However, in boosting, the trees are built sequentially such that each subsequent tree aims to reduce the errors of the previous tree. Each tree learns from its predecessors and updates the residual errors. Hence, the tree that grows next in the sequence will learn from an updated version of the residuals.
Spam filtering is a binary classification problem in which the emails can either be spam or not spam. Also, be cognizant of how unbalanced the dataset might be, e.g. lots of non-spam emails vs much fewer spam emails.
With that in mind, define the classification definitions for each output scenario:
Given these definitions, what would be the metrics for measuring model accuracy? See the full solution on Interview Query.
This intermediate machine learning question was asked by Facebook. See a video mock interview solution for this question:
This classic data modeling question was asked by Redfin and Panasonic. A quick solution– you could build models with different volumes of training data. With this method, you can avoid using the 20% that are missing values. Imputation would be another option for solving this question.
A few questions to consider are: How would you evaluate performance of the model? And how would you compare a decision tree to other models? See a full solution in this YouTube mock interview:
See our guide to the Square data scientist interview.
The key difference in regression and classification models is the nature of the data they want to predict, their output. In regression models, the output is numeric, whereas, in classification models, the output is categorical.
See a full solution to this question on YouTube:
According to Machine Learning Mastery, K-fold cross validation is used to “estimate the skill of the model on new data.” With K-fold methods, there are various tactics you can use for selecting the value of K, and there are common variations such as stratified and repeated in scikit-learn.
With a question like this, start with some clarifying questions. How large is the dataset? What type of data is it? What type of problem are you trying to solve?
For example, with a large-scale dataset for a classification problem, you might use a Python package like LightGBM to impute values. Or you could use interpolation, which would use neighbor data to estimate values.
In simple terms, dimensionality reduction is the process of reducing the dimension of your feature set. For example, a dataset could have 50 features (columns), and with dimensionality reduction, we might reduce the number of features to 15.
Why would you do this? As the number of features increase, the model becomes more complex, and the risk of overfitting increases. This can result in poor performance. Some key benefits of dimensionality reduction include:
Ensemble learning is an approach to machine learning that combines the predictions of multiple models to improve predictive performance. There are three main classes of ensemble learning:
One example would be a random forest, which is an ensemble of multiple decision trees.
Variance is the measure of how much the prediction would vary if the model was trained on a different dataset, drawn from the same population. Can be also thought of as the “flexibility” of the model.
Data science SQL interview questions are very common and asked in about 90% of data science interviews. These questions assess your ability to write clean code, usually during a whiteboarding session. Common topics include pulling metrics, analytics case studies, ETL, and database design.
NULL is usually used in databases to signify a missing or unknown value. To compare the fields with NULL values, you can use the IS NULL
or IS NOT NULL
operator.
For this problem, which has been asked in Uber data science interviews, note that we are going to assume that the question states average order value for all users that have ordered at least once.
Therefore, we can apply an INNER JOIN between users and transactions.
SELECT
u.sex
, ROUND(AVG(quantity *price), 2) AS aov
FROM users AS u
INNER JOIN transactions AS t
ON u.id = t.user_id
INNER JOIN products AS p
ON t.product_id = p.id
GROUP BY 1
Here’s the key observation for this problem: Say that, for a given user, you sort their login dates in ascending order and assign a rank (row_num
) to each date (doesn’t matter if you use RANK()
or ROW_NUMBER()
if the dates are unique). If you subtract corresponding ranks from dates, you’ll find that days belonging in the same streak have the same number.
This question gives us two tables and asks us to find the names of customers who placed more than three transactions in both 2019 and 2020.
Note the phrasing of the question institutes this logical expression: Customer transaction > 3 in 2019 AND Customer transactions > 3 in 2020.
Our first query will join the transactions table to the user’s table so that we can easily reference both the user’s name and the orders together. We can join our tables on the id field of the user’s table and the user_id field of the transactions table:
FROM transactions t
JOIN users u
ON u.id = user_id
In this question, we need to order the salaries by department. A window function here is useful. Window functions enable calculations within a certain partition of rows. In this case, the RANK()
function would be useful. What would you put in the PARTITION BY
and ORDER BY
clauses?
Your window function can look something like:
RANK() OVER (PARTITION BY id ORDER BY metric DESC) AS ranks
with id and metric replaced by the fields relevant to the question
Let’s say we want to build a naive recommender for this SQL problem. We’re given two tables: one table called friends with a user_id
and friend_id
columns representing each user’s friends, and another table called page_likes
with a user_id
and a page_id
representing the page each user liked.
Let’s solve this problem by visualizing what kind of output we want from the query. Given that we have to create a metric for each user to recommend pages, we know we want something with a user_id
and a page_id
along with some sort of recommendation score.
Let’s try to think of an easy way to represent the scores of each user_id
and page_id
combo. One naive method would be to create a score by summing up the total likes by friends on each page that the user hasn’t currently liked. Then, the max value on our metric will be the most recommendable page.
CASE WHEN is used to perform a logical test and return a specified value when the test is true. The CASE function is used to evaluate the logical expression corresponding to a set of values. When the logical expression is true, WHEN returns the specified value.
If no default value is specified, NULL is returned. Here is example syntax for CASE WHEN:
CASE [<expression>]
WHEN <value1> THEN <return value1>
WHEN <value2> THEN <return value2>
ELSE <return value3>
END
In this Amazon data science interview question, you’re provided a transactions table and a users table. The first step is to join the transactions and users tables with an INNER JOIN.
Then, you could create two helper columns using the CASE WHEN statement. See the full solution on Interview Query.
A foreign key is a column or group of columns that establishes a link between the data in two tables. When the foreign key is referenced, a link is created between two tables when the column or group of columns containing the primary key value for one table is referenced by the column or group of columns in another table. This column becomes a foreign key in the second table.
The INNER JOIN returns rows only when there is a match in both tables. A LEFT JOIN returns all rows from the left table, even if there is not a match.
Our predicament is to find all the neighborhoods without users. In a sense we need all the neighborhoods that do not have a singular user living in them. This means we have to introduce a concept of the existence of a column in one table, but not in the other.
In this question, you’re given a users and rides table.
We need to accomplish two things. One is to figure out the total distance traveled for each user_id. The second is to get the user’s name then and order by the distance traveled.
Let’s break it down into steps and tackle an easier problem first. First off, how would we get the total distance traveled for all users?
One way to do so would be with the SUM function. Since the rides table represents all of the rides, each row in the rides table represents one ride, and the distance traveled in each ride. Therefore to get the total distance traveled, we just run:
SELECT SUM(distance) FROM rides
You’re given two tables: transactions and products.
Whenever there is a question month-over-month or year-over-year, etc. change in SQL, you can do that in two different ways. One is using the LAG function that is available in certain SQL services. Another is to do a sneaky join.
For both, we first have to sum the transactions and group by the month and the year.
These stand for:
Python interview questions test your technical coding skills, with questions that explore concepts like data structures, NumPy and data science packages, probability simulation, statistics and distributions, and string parsing / data manipulation.
This question requires us to filter a dataframe by two conditions: 1) the grade of the student and 2) their favorite color.
Let’s start with filtering by grade since it’s a bit simpler than filtering by strings. We can filter columns in pandas by setting our dataframe equal to itself with the filter in place.
This is a relatively simple problem because we have to set up our distribution and then generate n samples from it which are then plotted. In this question, we make use of the SciPy library which is a library made for scientific computing.
First, we will declare a standard normal distribution. A standard normal distribution, for those of you who may have forgotten, is the normal distribution with mean=0
and standard deviation = 1
. To declare a normal distribution, we use SciPy’s stats.norm(mean, variance)
function and specify the parameters as mentioned above.
In this question, we can write a Python function to simulate the scenario to see how frequently Amy wins first. To solve this question, you must understand how to create two people and simulate the scenario with one person rolling first each time.
In data science, there exists the concept of stemming, which is the heuristic of chopping off the end of a word to clean and bucket it into an easier feature set. That’s being tested in this Facebook question.
One tip: If a word has many roots that can form it, replace it with the root with the shortest length.
Example:
Input:
roots = ["cat", "bat", "rat"]
sentence = "the cattle was rattled by the battery"
Output:
"the cat was rat by the bat"
Example:
Input:
m = 2
sd = 1
n = 6
percentile_threshold = 0.75
Output:
def truncated_dist(m,sd,n, percentile_threshold): ->
[2, 1.1, 2.2, 3, 1.5, 1.3]
All values in the output sample are in the lower 75% = percentile_threshold
of the distribution.
Hint: First, for this question, we need to calculate where to truncate our distribution. We want a sample where all values are below the percentile_threshold
.
For this Facebook data science interview question, you’re given two lists of dictionaries representing friendship beginnings and endings: friends_added
and friends_removed
. Each dictionary contains the user_ids
and created_at
time of the friendship beginning /ending.
Input:
friends_added = [
{'user_ids': [1, 2], 'created_at': '2020-01-01'},
{'user_ids': [3, 2], 'created_at': '2020-01-02'},
{'user_ids': [2, 1], 'created_at': '2020-02-02'},
{'user_ids': [4, 1], 'created_at': '2020-02-02'}]
friends_removed = [
{'user_ids': [2, 1], 'created_at': '2020-01-03'},
{'user_ids': [2, 3], 'created_at': '2020-01-05'},
{'user_ids': [1, 2], 'created_at': '2020-02-05'}]
Output:
friendships = [{
'user_ids': [1, 2],
'start_date': '2020-01-01',
'end_date': '2020-01-03'
},
{
'user_ids': [1, 2],
'start_date': '2020-02-02',
'end_date': '2020-02-05'
},
{
'user_ids': [2, 3],
'start_date': '2020-01-02',
'end_date': '2020-01-05'
},
]
In Python, data types classify or categorize data, and all values have a data type. Some of the most common built-in data types in Python are:
Negative indexes are used in Python to assess and index lists and arrays from the end of your string, moving backwards towards your first value. For example, n-1 will show the last item in a list, while n-2 will show the second to last. Here’s an example of a negative index in Python:
b = "Python Coding Fun"
print(b[-1])
>> n
Lists and tuples are classes in Python that store one or more objects or values. Key differences include:
In Python, the values of mutable objects can change, while the values of immutable objects cannot. These are the most common mutable and immutable data types in Python:
Both print and return display values, however there are key differences. For example, print in Python displays a value in the console. To do this, you use:
print()
Return in Python, on the other hand, returns a value from a function and exits the function. You use the return keyword to return a value from a function.
Although both are rectangular data types that store table data with rows and columns, there are key differences. The biggest difference is that matrices in Python can only contain a single class of data. Dataframes on the other hand, can contain multiple classes of data.
A library in Python is a collection of modules. A module is a set of code that is used for a specific purpose. Modules are typically used to split scripts into smaller files for easier maintenance. Modules also make code easier to use in many different programs.
Probability Theory underpins all of statistics and machine learning, and, in data science interviews, probability questions are useful for assessing analytical reasoning. Most commonly, you’ll be asked to calculate probability based on a given scenario.
Unbiased estimators is a statistic that’s used to approximate a population parameter. An example would be taking a sample of 1,000 voters in a political poll to estimate the total voting population. There is no such thing as a perfectly unbiased estimator.
Need some help? See our probability course for an in-depth explanation.
A probability distribution is not normal if most of its observations do not cluster around the mean, forming the bell curve. An example of a non-normal probability distribution is a uniform distribution, in which all values are equally likely to occur within a given range.
First, we consider how many ways we can possibly roll a seven. Let D_1 and D_2 be the result of the first and second dice respectively. There are six ways that the sum (D_1+D_2)=7. See the solution on Interview Query.
Imagine this as a sample space problem, ignoring all other distracting details. If someone randomly picks three differently numbered unique cards without replacement, then we can assume that there will be a lowest card, a middle card, and a high card.
Let’s make this easy and assume we drew the numbers 1, 2, and 3. In our scenario, if we drew (1,2,3) in that exact order, then that would be the winning scenario.
But what’s the full range of outcomes we could draw? See the full solution to this LinkedIn question on Interview Query.
More context: Out of all of the raters, 80% of the raters carefully rate movies and rate 60% of the movies as good and 40% as bad. The other 20% are lazy raters and rate 100% of the movies as good.
This question is asking us what percentage of movies are being rated good. How would we formally express this probability given the information provided?
The solution to this question requires knowledge of Bayes’ Rule, which says:
P(U|T)P(T)=P(T|U)P(U)
Therefore, we have P(U|T) * 33⁄64 = 1 * ½. P(U|T) = ½ / (33⁄64) or 32⁄33
This question is a simple calculation. The probability of rolling a 4 is 1⁄6. The probability of not rolling a 6 on the second role is 5⁄6.
Therefore, the answer is 1⁄6 * 5⁄6 = 5⁄36.
Here’s an excerpt from a full solution by Robert Eisele:
“If you have a biased coin, how can we simulate a fair coin? The naïve way would be throwing the coin 100 times, and if the coin came up heads 60 times, the bias would be 0.6. We could then conduct an experiment to cope with this bias.
A better solution was introduced by John von Neumann. We are going to consider the outcomes of tossing the biased coin twice. Let p be the probability of the coin landing hands and q be the probability of the coin landing tails – where q = 1 – p.”
There’s a simple answer to this question called the Probability Integral Transform or Universality of the Uniform. You would plug the draw into the CDF of the normal distribution with those parameters.
High bias models make more assumption, and these models do not work well on new data. Some examples of high bias models include: linear regression, linear discriminant analysis, and logistic regression.
With this question, the solution requires a multinomial distribution, with n=12 and k=3.
Note: In this problem, the players are indistinguishable from each other.
See our full list of practice probability questions.
Statistics and A/B questions test your ability to design tests, understand the results, and perform statistical computations. Most commonly, they’ll be framed as:
In general, you should start with understanding what you want to measure. From there, you can begin to design and implement a test. There are four key aspects to consider:
Maximum likelihood estimation (MLE) and maximum a posterior (MAP) are methods used to estimate a variable with respect to observed data. They are both good for estimating a single variable, as opposed to a distribution.
In machine learning, you can think of this variable as a model parameter or a weight that the model can learn. These functions are used to find the optimal parameter given the training dataset. However, they are different in that they take different approaches to estimate the variables.
Overview: You are designing an experiment to measure the impact financial rewards have on user response rates. The results show that the treatment group (received a $10 reward) has a 30% response rate, while the control group (no rewards) has a 50% response rate.
See a full video solution this A/B testing experiment design problem on YouTube:
Having the vocabulary to describe a distribution is an important skill as a data scientist when it comes to communicating ideas to your peers. There are four important concepts, with supporting vocabulary, that you can use to structure your answer to a question like this. These are:
See a full solution for this problem on Interview Query.
More context: Suppose you work for a company whose main product is a sports app that tracks and displays running/jogging/cycling data for its users. Some metrics tracked by the app are distance, pace, splits, elevation gain, and heart rate.
You’re given the task of formulating a method to identify dishonest or cheating users – such as users who drive a car while claiming they’re on a bike ride.
Try this question on Interview Query.
Usually, A/B test design starts with randomly dividing users into two groups. Then, you give each group a different version of the product, and look for differences in behavior between the groups. Random assignment is done on a per-user basis, typically. Unfortunately, this standardized method doesn’t work well in this A/B testing case question for Instagram Stories. Why is that?
With A/B tests, there are two parameters determine the risk of decisions based on the test’s results. They are significance level and power level. As a general rule, most target a significance level of 95%, however some may consider a range between 90-99%. Generally, the power level is targeted at 80%.
The p-value is the probability of observing results as least as extreme as your observed results, if your hypothesis is true. When this probability is very low, it indicates that there’s significant evidence that your hypothesis is not true, simply because observing that much of an extreme result has a very low probability of occurring.
A function is monotonic when it is strictly increasing or decreasing. The monotonicity of a function is related to its derivative. When the derivative is positive, it is increasing, and when it is negative, it is decreasing.
If you’re looking for an alternative to A/B testing, there are two common tests that are used to make UI design decisions. They include:
P-value is used to determine statistical significance. If the p-value falls below the significance level, then the result is statistically significant.
Selection bias refers to using data that has not been properly randomized.
In data science interviews, business case questions provide a scenario and test your problem-solving approach. You’ll be provided with a dataset and problem, and then you’ll be asked to investigate and offer solutions to the problem.
First, think about the criteria? Would it be the same for both cities? Certainly not. That’s because they are very different in terms of density; dashers in NYC might prefer bikes, while Charlotte’s dashers might prefer cars. See a full solution to this question on Interview Query.
More context: The duplicates may be listed under different sellers, names, etc. For example, “iPhone X” and “Apple iPhone 10” are two names that mean the same iPhone.
See a full mock interview solution for this question on YouTube:
Start with some clarifying questions. How large is the user base of this third-party app? What are the user demographics? Additionally, you’d want to learn some more about Spotify’s marketing strategy, e.g. how much you spend on similar campaigns, the goals of the ad campaign, target CPA (if that’s the goal).
Then, you can start to estimate pricing based on probable conversion rates.
See a full solution for this business case question on YouTube:
One thing that helps with product questions is to go back to the raw understanding of what the product feature is for.
Facebook groups provide a way for Facebook users to connect with other users through a shared interest or real-life/offline relationship. This space enables these Facebook users to easily socialize in a group-like setting; planning events, discussing topics etc. Facebook also allows groups to be private/closed off or more open and public facing.
In this case, the user’s goal is to experience a sense of community. By doing so, we derive our business goal of increasing user engagement with Facebook Groups. What general engagement metrics we can associate with this value?
Let’s say you’re asked to calculate LTV for a company that’s been in operation for less than one year.
Average lifetime value is defined by the prediction of the net revenue attributed to the entire future relationship with all customers averaged. Given that we don’t know the future net revenue, we can estimate it by taking the total amount of revenue generated divided by the total number of customers acquired over the same period time.
So given that we know that the average customer length on the platform is 3.5 months, couldn’t we just calculate the LTV as $100 * 3.5 = $350? Not exactly.
This is a pretty short time for a business to be around when the lifetime subscription of a customer could be much longer. Our average customer length is then biased based on the fact that the business hasn’t been around long enough to correctly measure a sample average that is indicative of the true mean.
This is a question with many paths and no correct right answer. Rather the interviewer is looking towards how you can explain your reasoning when facing a practical product question.
The first assumption is that the goal of the discount is to increase retention and revenue. Let’s also assume that this discount is going to be applied uniformly across all users of time length on the platform (i.e. not targeting new users). Lastly let’s assume that the 50% discount is applied on only one ride.
Now that we’ve stated our assumptions, let’s figure out how we can evaluate the change. Since the question prompts a feature change in the form of pricing, this means we can propose an AB test and set metrics for evaluation of the test. Our AB test would be designed with a control and a test group, with only new users getting bucketed into either variant. The test group would receive a 50% rider discount on one ride and the control group would not.
What comes next?
Product questions ask you to pull metrics. In this case, what metrics could help us estimate demand for rides? Some metrics you might choose include:
Suppose you’re on Facebook’s revenue forecasting team. How would you estimate revenue? First, start with some clarifying questions:
To set up our forecast model, we want to look at historical revenue data for Facebook. We should consider revenue streams from the different services Facebook offers. For example, if the three primary revenue streams are Newsfeed, Messenger, and Marketplace, we can analyze revenue from the past five years from each product individually instead of in aggregate.
Next, we want to look for certain attributes like seasonality and trends. What comes next?
Database design questions are asked to test your knowledge of data architecture and design. In data science interviews, database design questions will usually ask you to design a database from scratch for a provided application or business idea.
Here’s an overview of the features in physical models:
With a question like this, focus on outlining the project and the unique challenges of the project. For example, if you worked with a healthcare company, patient privacy could have been a potential problem. Additionally, explain all of the entities that were linked and your process for designing the data model.
A simple but effective design schema for this question would be to first represent each action with a specific label. In this case, assigning each click event a name or label describing its specific action.
For example, let’s say the product is Dropbox and we want to track each folder click on the UI of an individual person’s Dropbox. We can label the clicking on a folder as an action name called folder_click.
When the user clicks on the side panel to login or logout and we need to specify the action, we can call it login_click
and logout_click
.
See the full solution for this database design question on YouTube:
More context: The application will allow anyone to review restaurants. This app should allow users to sign up, create a profile, and leave reviews on restaurants if they wish. These reviews can include texts and images. A user can only write one review for a restaurant, but can update their review later on.
The two main tables that can support the application functions would be a user
table & a review
table. You can include an additional restaurants table to normalize the restaurant information better.
An ETL tester is responsible for running extensive tests on ETL software. In particular, the tester will create and design and execute test cases and test plans. Testers also identifies problems and suggestion solutions, as well as approves the design specification for the ETL system.
You can track changes in a database by creating a separate table that gets entries added via triggers when INSERT, UPDATE or DELETE statements are used. This is the most common way, and it covers general changes.
You would also want to track changes by user. There are many ways to do this, but one would be to have a separate table that inserts a record every time a user updates data. This would record the user, time, and the ID of the changed record.
This is a classic data engineering case study question, and your goal is to walk the interviewer through a data model. Here, start with a clarification about the notifications. Typically, you’ll have two types:
Next, walk the interviewer through how you would design a simple database for notifications. This database might include two tables:
A conceptual data model is a high-level model that includes the entities stored in a database, as well the relationships between these entities. Typically, the details about each entity isn’t included in a conceptual model.
A physical model on the other hand is a model of the data that uses table and column names, as well as data types and constraints.
Start with a clarifying question about the data that is being stored. Star schemas are generally simpler and are useful for datamarts, due to the simpler relationships. In the star schema, one or more fact tables are used to index a series of dimension tables.
Snowflake schemas use less space to store dimension tables but are generally more complex. They also have no redundant data and are easier to maintain. Snowflake schemas are better for data warehouses.
Join Interview Query today and begin preparing for your interview.
Members have access to:
Gain insight access to all of these resources when you join.