r/Python • u/annmeera • Dec 30 '15
100 Data Science in Python Interview Questions and Answers
https://www.dezyre.com/article/100-data-science-in-python-interview-questions-and-answers/188#.VoOJGaacd14.reddit10
u/f801fe8957 Dec 30 '15
4) Is all the memory freed when Python exits?
How the answer can be true, if an OS destroys the python process and releases the memory?
9
Dec 30 '15
[removed] — view removed comment
1
u/das_ist_nuemberwang Dec 30 '15
It appears to be sourced directly from this page: http://effbot.org/pyfaq/why-isn-t-all-memory-freed-when-python-exits.htm
3
u/SemaphoreBingo Dec 30 '15
So presumably it's asking something like "are all destructors called on exit".
8
Dec 30 '15
_init_.py is an empty py fileWhat?
17
Dec 30 '15
I think they are confused because it can have nothing in it.
I feel like these were written by someone who learned python a year ago and now wants to be a data scientist.
5
Dec 30 '15
Maybe he is a data scientist, and used R for that. Now he/she is learning python and teaching courses. At the same time ...
1
Dec 30 '15
[removed] — view removed comment
1
Dec 30 '15
Including the contents of
__init__.py, where any symbols in that file are importable from the module.
8
u/log_2 Dec 30 '15
Ridiculous list. No real data scientist would care about half of that shit. I mean, seriously...
12) Optimize the below python code-
word = 'word'
print word.__len__()
Answer: print ‘word’._len_()wut? Who cares?!
23
1
u/das_ist_nuemberwang Dec 30 '15
I think what they're checking is that you know that strings are objects and you can directly access methods on them, but if that was the case, why didn't they use
format?
7
u/das_ist_nuemberwang Dec 30 '15
These really don't seem great to me.
6) What is the different between range () and xrange () functions in Python?
Which one?
9) If you are gives the first and last names of employees, which data type in Python will you use to store them?
I would certainly not use a dictionary.
10) What happens when you execute the statement mango=banana in Python?
More information please?
1
Dec 30 '15
For 10, I assume they're going for 'assignment, not evaluation'.
3
u/das_ist_nuemberwang Dec 30 '15
Their provided answer is "A name error will occur when this statement is executed in Python." It's an awful question.
10
7
Dec 30 '15
OP's account only has four posts, all linked to the same company. Obviously a spammer, and not a very good one. Reported to /r/spam.
6
Dec 30 '15
I'm a primarily Python-using data scientist and I've never been asked questions like this. Usually a brief glance at my Github would make these questions unnecessary.
4
u/sentdex pythonprogramming.net Dec 30 '15
I tried to click the downvote on this, but couldn't. What gives?
The list is subpar, maybe 3 of these are questions that you actually might get in an interview from a decent company. The rest are really not that important that the typical employee has to heart.
...also... this list was not 100 data science interview questions. It was 24.
For that, you deserved the downvote that I apparently cannot give for some reason.
1
Dec 30 '15
2
u/sentdex pythonprogramming.net Dec 30 '15
Not that I know of. I could upvote the thread, just not downvote.
4
Dec 30 '15
5) What does init.py do?
init.py is an empty py file used for importing a module in a directory.
I stopped reading.
3
u/syrelyre Dec 30 '15
17) You are given a list of N numbers. Create a single list comprehension in Python to create a new list that contains only those values which have even numbers from elements of the list at even indices.
Aren't they missing a ":" in the solution, to get the step
[x for x in list [: 2] if x%2 == 0]
3
3
u/Sinidir Dec 30 '15
4) Is all the memory freed when Python exits? No it is not, because the objects that are referenced from global namespaces of Python modules are not always de-allocated when Python exits.
Huh? What does this mean?
3
3
u/wcastello Dec 30 '15
One more "I know the right answer to things" post, a thousand more to come.
2
3
u/equationsofmotion HPC Dec 30 '15
What on earth does this have to do with data science? I would expect data science questions to discuss topics like statistics, visualization, etc.
2
Dec 30 '15
This feels weird. Maybe because of the formatting or the strange answers to some of the questions. I'm not sure how to feel about this.
-1
u/dmarko Dec 30 '15
I was on board till a chat window appeared and made a loud sound. Needless to say it was a bot, because I started chatting and It didn't respond. But again, I was threatening to sue them over the unwanted and unnecessary chat window...
1
u/rnnnnr Dec 30 '15
I would end the interview process if someone asked me these questions for a Data Science position. Questions like this are a huge red flag.
1
Dec 30 '15
For number 9, aren't lists and dictionaries data structures? Because I was under the assumption data types were int, float, string, etc. and data structures were things like lists, trees, tuples, dicts, etc.
0
0
Dec 30 '15
[deleted]
1
u/sweettuse Dec 30 '15
actually, the decorator itself does no such assigning. it merely takes a function and returns another function/callable. the
@notation is the syntactic sugar that does the actual assignment. (e.g., you're free to writedef f(): passand thenf = decorator(f))
29
u/Jigsus Dec 30 '15 edited Dec 30 '15
These are bad and you should feel bad. This is exactly the kind of list a smug self-sufficient grad student would come up with because he's proud he learned programming but he only knows the gotchas in Python.