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

Home Page - http://www.wellho.net
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 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 may also give others a good feel as to whether they know the basics of Python - 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.

Name
email
 
Question 1: Which of these is a valid variable name in Python?
   $first
   @first
   first
   %first
 
Question 2: Which of these is NOT valid Python syntax?
   if k == 33: print (k)
   if (k == 33): print (k+1);
   if k == 33: print (k+2);
   if (k == 33) print (k+3);
 
Question 3: If I write [12,34,45,56], I have written what?
   A list
   An array
   A tuple
   A dict
   An array list
   None of the above
 
Question 4: Which of the following is a Python keyword
   private
   local
   static
   global
   uplevel
 
Question 5: Which of the following is not a valid Python variable name?
   abc
   def
   ghi
   unless
   until
 
Question 6: Which of these will NOT add multiple objects onto an existing list?
   demo.append([12,14,16])
   demo = demo + [12,14,16]
   demo += [12,14,16]
   demo.extend([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: 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 9: 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 A: 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 © 2024, WELL HOUSE CONSULTANTS LTD
This is http://www.wellho.net/demo/qzi.php
Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
Phone: +44 (0) 1225 708 225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net