Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python Interview Questions

Reply
Thread Tools

Python Interview Questions

 
 
Chris Angelico
Guest
Posts: n/a
 
      09-05-2012
On Thu, Sep 6, 2012 at 12:34 AM, Chris Angelico <> wrote:
> However, this strikes me as encouraging some really
> inefficient code, like iterating over all the rows in a table with N+1
> queries (one to get the length, then a separate query for each row).


Huh. And then I scroll down, and that's precisely what he's doing. Do
you understand why this is a bad thing to do?

ChrisA
 
Reply With Quote
 
 
 
 
Ian Kelly
Guest
Posts: n/a
 
      09-05-2012
On Wed, Sep 5, 2012 at 8:34 AM, Chris Angelico <> wrote:
> I wouldn't go that far. The 'name' parameter, I would expect, would be
> a constant.


The 'item' parameter, though, is probably not a constant, and it's
interpolated just the same.

> However, this strikes me as encouraging some really
> inefficient code, like iterating over all the rows in a table with N+1
> queries (one to get the length, then a separate query for each row).
> Plus, use of limit without order by is not guaranteed (although since
> this is specific to MySQL, it's unlikely you'll run into trouble - but
> PostgreSQL, with its MVCC storage system, frequently reorders rows in
> a table).


The lack of an ORDER BY is the least of the problems with that SQL.
He's also using LIMIT without OFFSET, so the only thing that the
'item' argument changes is how many rows are returned (all but one of
which are ignored), not which one is actually fetched.

It's a bit sad that these are touted as answers to interview
questions. I wouldn't hire anybody who gave answers like these.
 
Reply With Quote
 
 
 
 
Chris Angelico
Guest
Posts: n/a
 
      09-05-2012
On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly <> wrote:
> The lack of an ORDER BY is the least of the problems with that SQL.
> He's also using LIMIT without OFFSET, so the only thing that the
> 'item' argument changes is how many rows are returned (all but one of
> which are ignored), not which one is actually fetched.


No, he's using the two-arg form of LIMIT.

> It's a bit sad that these are touted as answers to interview
> questions. I wouldn't hire anybody who gave answers like these.


The code does not work as posted; there are args missing from the
INSERT example, for, uhh, example. It makes it hard to evaluate the
quality of the code, in some places. I'm not sure what these posts are
supposed to be, but I hope they're not being held up as model answers
to interview questions. For a start, I can't find any sort of clear
questions.

Or is the code itself the question and "How would you improve this"?

ChrisA
 
Reply With Quote
 
Dave Angel
Guest
Posts: n/a
 
      09-05-2012
On 09/05/2012 11:34 AM, Chris Angelico wrote:
> On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly <> wrote:
>> The lack of an ORDER BY is the least of the problems with that SQL.
>> He's also using LIMIT without OFFSET, so the only thing that the
>> 'item' argument changes is how many rows are returned (all but one of
>> which are ignored), not which one is actually fetched.

> No, he's using the two-arg form of LIMIT.
>
>> It's a bit sad that these are touted as answers to interview
>> questions. I wouldn't hire anybody who gave answers like these.

> The code does not work as posted; there are args missing from the
> INSERT example, for, uhh, example. It makes it hard to evaluate the
> quality of the code, in some places. I'm not sure what these posts are
> supposed to be, but I hope they're not being held up as model answers
> to interview questions. For a start, I can't find any sort of clear
> questions.
>
> Or is the code itself the question and "How would you improve this"?
>
> ChrisA


Skip ahead to about page 13 to get more traditional questions, There,
many of the simplest questions have invalid answers, or confusing
explanations.

For example, on page 15, the question that says " ... if a list of words
is empty..." uses a="" as its source data to test with.

The first question on page 16 forgets to construct a loop, thus
processing only the first line in the file.

page 18 introduces new syntax to the language:
print n+=1 ##will work

and reassures us in the comment that it will work !!

page 18 also claims that values are passed to function by value.





--

DaveA

 
Reply With Quote
 
Roy Smith
Guest
Posts: n/a
 
      09-05-2012
In article <d4e47e64-91d3-4b9f-9e98->,
wrote:

> Hi Guys,
>
> Finally I have decided to put best interview question and answers.
>
> Please visit http://www.f2finterview.com/web/CorePython/ for core python and
> http://www.f2finterview.com/web/PythonAdvanced/ for advanced python


I was going to comment on some of the specific items, but I got hung up
being unable to copy-paste text from your site so I could quote it.
That's usually done with some variation on "user-select: none" in the
CSS, but I didn't see that. I'm assuming it's some javascript trickery.

Why do you do that? It degrades the usability of the site, and doesn't
provide any real protection against people stealing content.
 
Reply With Quote
 
Roy Smith
Guest
Posts: n/a
 
      09-05-2012
In article <mailman.245.1346858610.27098.python->,
Ian Kelly <> wrote:

> It's a bit sad that these are touted as answers to interview
> questions. I wouldn't hire anybody who gave answers like these.


Over time, I've become convinced that most interview questions are crap.
The best programming interview questions always start with, "write a
program ...".
 
Reply With Quote
 
Roy Smith
Guest
Posts: n/a
 
      09-05-2012
In article <mailman.255.1346863293.27098.python->,
Ian Kelly <> wrote:

> My mistake. I didn't even know there was a two-arg form of LIMIT.
> Must be a MySQL thing.


What are you talking about? SQL is an ISO Standard. Therefore, all
implementations work the same way. Didn't you get the memo?
 
Reply With Quote
 
Chris Angelico
Guest
Posts: n/a
 
      09-05-2012
On Thu, Sep 6, 2012 at 2:40 AM, Ian Kelly <> wrote:
> On Wed, Sep 5, 2012 at 9:34 AM, Chris Angelico <> wrote:
>> On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly <> wrote:
>>> The lack of an ORDER BY is the least of the problems with that SQL.
>>> He's also using LIMIT without OFFSET, so the only thing that the
>>> 'item' argument changes is how many rows are returned (all but one of
>>> which are ignored), not which one is actually fetched.

>>
>> No, he's using the two-arg form of LIMIT.

>
> My mistake. I didn't even know there was a two-arg form of LIMIT.
> Must be a MySQL thing.


Yeah, it's not something I've used, but when my current job started,
we were using MySQL and I used to eyeball the logs to see what queries
were performing most suboptimally. (There were some pretty egregious
ones. Most memorable was rewriting a TEXT field several times a second
with several KB of PHP serialized array with status/statistical
information. Structured information, yes. Stored as a clob.) My first
databasing experience was DB2, with the uber-verbose "FETCH FIRST n
ROW[S] ONLY", but now I'm happily on Postgres.

Everyone who wants to use LIMIT without ORDER BY should try their code
on Postgres. You'll quickly discover the problem.

ChrisA
 
Reply With Quote
 
Kushal Kumaran
Guest
Posts: n/a
 
      09-06-2012
On Wed, Sep 5, 2012 at 3:11 PM, Stephen Anto <> wrote:
> On Wed, Sep 5, 2012 at 2:10 PM, Kushal Kumaran
> <kushal.kumaran+> wrote:
>>
>> On Wed, Sep 5, 2012 at 12:20 PM, <> wrote:
>> > On Tuesday, October 30, 2007 11:44:01 PM UTC+5:30, Krypto wrote:
>> >> Hi,
>> >>
>> >> I have used Python for a couple of projects last year and I found it
>> >> extremely useful. I could write two middle size projects in 2-3 months
>> >> (part time). Right now I am a bit rusty and trying to catch up again
>> >> with Python.
>> >>
>> >> I am now appearing for Job Interviews these days and I am wondering if
>> >> anybody of you appeared for a Python Interview. Can you please share
>> >> the questions you were asked. That will be great help to me.
>> >>
>> >
>> > Finally I have decided to put best interview question and answers.
>> >
>> > Please visit http://www.f2finterview.com/web/CorePython/ for core python
>> > and http://www.f2finterview.com/web/PythonAdvanced/ for advanced python
>> >

>>
>> As I see from a quick glance, several of your answers seem to be
>> copied from the python faq at http://docs.python.org/faq/. The
>> copyright notice for the python.org website seems to be at
>> http://docs.python.org/copyright.html. Do you have the Python
>> Software Foundation's permission to copy large chunks of the
>> python.org website and claim it as your own content?
>>

>
> Thank you for your information, I really sorry for this, if possible could
> you note which are the questions taken from faq, we will remove it as early
> as possible.
>


Since your website's Terms of Use state that you own the content, it
is your problem to make sure whatever's there is there legally.

Here's one example, though, to get you started: See the entry "Why
can’t I use an assignment in an expression?" at
http://docs.python.org/faq/design.html, and compare with the content
under the identical heading on page 3 of the CorePython section.

--
regards,
kushal
 
Reply With Quote
 
MRAB
Guest
Posts: n/a
 
      09-06-2012
On 06/09/2012 05:24, Kushal Kumaran wrote:
> On Wed, Sep 5, 2012 at 3:11 PM, Stephen Anto <> wrote:
>> On Wed, Sep 5, 2012 at 2:10 PM, Kushal Kumaran
>> <kushal.kumaran+> wrote:
>>>
>>> On Wed, Sep 5, 2012 at 12:20 PM, <> wrote:
>>> > On Tuesday, October 30, 2007 11:44:01 PM UTC+5:30, Krypto wrote:
>>> >> Hi,
>>> >>
>>> >> I have used Python for a couple of projects last year and I found it
>>> >> extremely useful. I could write two middle size projects in 2-3 months
>>> >> (part time). Right now I am a bit rusty and trying to catch up again
>>> >> with Python.
>>> >>
>>> >> I am now appearing for Job Interviews these days and I am wondering if
>>> >> anybody of you appeared for a Python Interview. Can you please share
>>> >> the questions you were asked. That will be great help to me.
>>> >>
>>> >
>>> > Finally I have decided to put best interview question and answers.
>>> >
>>> > Please visit http://www.f2finterview.com/web/CorePython/ for core python
>>> > and http://www.f2finterview.com/web/PythonAdvanced/ for advanced python
>>> >
>>>
>>> As I see from a quick glance, several of your answers seem to be
>>> copied from the python faq at http://docs.python.org/faq/. The
>>> copyright notice for the python.org website seems to be at
>>> http://docs.python.org/copyright.html. Do you have the Python
>>> Software Foundation's permission to copy large chunks of the
>>> python.org website and claim it as your own content?
>>>

>>
>> Thank you for your information, I really sorry for this, if possible could
>> you note which are the questions taken from faq, we will remove it as early
>> as possible.
>>

>
> Since your website's Terms of Use state that you own the content, it
> is your problem to make sure whatever's there is there legally.
>
> Here's one example, though, to get you started: See the entry "Why
> can’t I use an assignment in an expression?" at
> http://docs.python.org/faq/design.html, and compare with the content
> under the identical heading on page 3 of the CorePython section.
>

The section below it comes from here:

http://svn.effbot.org/public/stuff/s...c-analysis.xml

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please come and add questions to C++ interview questions onListenVoice Vijay C++ 2 05-07-2010 03:02 PM
Re: Anyone read "Python Interview Questions: Python CertificationReview"? Steve Holden Python 0 03-04-2009 02:44 PM
Re: Anyone read "Python Interview Questions: Python CertificationReview"? Tim Chase Python 0 03-04-2009 01:45 PM
ASP Interview Questions ASP Interview Questions reema ASP General 0 08-26-2008 11:57 AM
.NET Interview Question, C#, ASP.NET Interview Questions dotnetuncle Javascript 0 10-30-2007 03:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57