Perl, PHP, Python, Ruby, Lua, C, C++, Tcl
Open Source Programming Training

Home Page -
Public courses at Well House Manor
Private courses at your offices

Article on how to read your results

Test your current Python knowledge ...

A short test to see how you're getting along ...

This test has been prepared for one of our customers, to assess their delegate's Python knowledge before and after a course. There is no time limit for this test. However, we do note the time you have taken, and would be concerned if you took a long time.

The test will also give others a good feel as to whether they know the basics of Perl well - a helpful assessment to aid the selection of training. We request your name and email address simply so that we can correlate the results and refer back to your answers should you get in touch with us. You will not be added to any databases. Written and hosted by Well House Consultants - contact details at base of page. This page does NOT use cookies.

Question 1: What is a decorator?
   A function wrapper
   Nothing to with Python - a painter
   An optional parameter on a method call
Question 2: When would you use a generator function
   When creating a list or tuple to a formula
   When stepping item by item through a large data flow
   Generaor functions are deprecated and should no longer be used
Question 3: Which is a difference between old and new style classes
   You call the parent constructuctor via a super call in new style
   In old style classes, assigning an object to a new variable clones it but in the new style it copies the reference
   Old style classes only support inheritance to one level, but that limit is removed in new style
   You can only use the property() builtin on new style classes
Question 4: Which of the following is not a valid Python variable name?
Question 5: Which database support is shipped with a standard Python distributon?
   CSV files at database tables
Question 6: Which of these will NOT add multiple objects onto an existing list?
   demo = demo + [12,14,16]
   demo += [12,14,16]
Question 7: How do you insert a floating point number variable into the middle of a string
   Write the string in double quotes, with a $ in front of the variable name where you want it
   The only way to do it is to use the + operator to concatenate strings
   Using either the % operator or the format method on a string object
   Using the #{varname} structure in a non-raw string
Question 8: Unittests allow you to
   Check that modules and packages you've loaded are the current ones
   Test whether code performs to specification
   Check that you have all your dependencies matched
   Distribute your own code and charge for it, even though Python is GPL license compatible
Question 9: Python is called "Python" because
   The Author thought that an O'Reilly book with an animal on the cover would come, and liked snakes
   Named after Monty Python - "And now for something completely different"
   It's just a nice name a word chosen more or less at random
   It stands for "Programming - with Yield High Through Object Nodes" (words other way round in Dutch - native tongue of author)
Question A: What is 'if __name__ == "__main__":' commonly used for?
   Adding a test harness to a class
   Checking whether there are command line arguments available to you
   Providing user documentation
   All of the above
Question B: Under what circumatances can a dictionary have two identical keys?
   It can't
   Only if the keys are objects of a type you have defined yourself
   If the keys are muttable objects
   If the keys are immutable objects
   If the keys are object which extend the base class cloneable
Question C: What does "vals = range(20); print vals[2:17:3]" print?
   SyntaxError: invalid syntax
   [2, 5, 8, 11, 14]
   [2, 5, 8, 11, 14, 17]
   2, 5, 8, 11, 14
   2, 5, 8, 11, 14, 17
When done, please

Set by Well House Consultants

Training sample © 2023, WELL HOUSE CONSULTANTS LTD
This is
Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
Phone: +44 (0) 1225 708 225 • EMAIL: • WEB: