10 Coding Questions for Data Science Interview

Nishesh Gogia
4 min readFeb 25, 2022

--

In this blog we gonna discuss about the 10 most asked question from data science , I am assuming that you are a Fresher with <2 years of experience. With More experience questions could change from candidate to candidate.

Before starting, I want to clarify one thing, “These set of questions are very common in my experience but can vary company to company”.

I have a request for you all, please read the questions, try to implement it on your own and then jump to the solutions. This struggles with the questions will make you good at programming, nothing else.

Question-1

Simple POWER FUNCTION which we all have used in python, we are trying to implement it from scratch.

Question-2

Masking is widely done specially by Banks to secure the payment process. This is a simple program of masking.

QUESTION-3

We all have gone through Dot Product in our high school specially in physics, In Machine Learning algorithm we use dot product extensively so why not try to implement it from scratch.

QUESTION-4

Now we have a simple coding problem, given a list every element in the list appears twice except for one, you just need to find that single element in the list.

Question-5

Now again a simple list problem, you have a list from 1 to n and there is one missing value in the list, you need to find that one missing value. You can assume that there wont be any duplicate and only one value is missing in the list.

Question-6

This is a very interesting and a simple problem, we all have been studying euclidian distance or distance between 2 points from school days, lets try to implement that in python.

Euclidian distance is-:

Question-7

Here you are given n numbers as well as n probabilities that sum up to 1. Write a function to generate one of the numbers with its corresponding probability.

Please refer the example below to understand the problem in a better way, this problem is of medium level difficulty on a intuitive level but very simple to code.

Question-8

Again some very famous concepts from Statistics

MEAN, MEDIAN AND MODE.

I have just implemented them from scratch by using simple for loop and if-else.

QUESTION-9

I love these shapes printing problems, so adding one very simple kite print. Please write python code to implement this.

QUESTION-10

We all know range function in python which has 3 parameters( start, stop, step) where stop is exclusive. Lets try to implement it from scratch.

So these were some of the coding questions which were widely asked in different interviews.

One thing is very clear, just try to implement things from scratch and do not depend on inbuilt functions, try to see how inbuilt functions has been implemented from simple for loop and if-else.

Thanks for reading…

Nishesh Gogia

--

--