- fork the repo at https://github.com/rflynn/interview-questions
- clone the repo locally. Do all subsequent work there.
- complete as many of the following problems as you can in 30 minutes in any order. commit work locally as it is done.
Create the following files in python/. As you create them, commit them to your git repository.
| file | spec |
|---|---|
| fizzbuzz.py | write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. |
| primes100.py | print the primes between 1-100 |
| checkstr.py | a string may contain alphanumeric characters. it may also contain dashes, but not begin or end with them or contain 2 or sequentially. write a function that checks for this format. |
| randomtuples.py | write a function to generate a list of length 0-3 of the following tuple: (an integer between 0-3, a float between -0.5 and 0.5, a random alphanumeric string of length 0-5 which may also be None) |
| inherit.py | write a class Foo and a class Bar that inherits from Foo. when a Foo object is created it prints "foo". when a Bar object is created it prints "foo" using inheritance and "bar". |
| perm2.py | permutations of size 2 of a given list |
Given the file python/get.py
- summarize what the file does
- get it to run. use any tools/references you want.
- get it to pass all tests
- add an additional meaningful test
- if an operation fails, return a non-zero exit code to the shell
- add the capability to fetch multiple urls in one invocation
- what additional improvements can you make?
cd interview-questions/sql
- install sqlite3 from http://sqlite.org/download.html
- briefly review the schema and data in
sql/employees.sql - load data
sqlite3 employees.sqlite3 < sql/employees.sql - write queries to the following files
sql/employees-all.sqldisplay all employeessql/employees-total.sqldisplay the total number of employeessql/employees-salary-total.sqldisplay the total salary paid to all employeessql/employees-lowest-paid.sqldisplay the name of the lowest-paid employeesql/employees-managed-by-bob.sqldisplay all employees under manager 'Bob'sql/employees-managers.sqldisplay a list of managerssql/employees-brian.sqldisplay all employees with first name 'Brian'- be ready to discuss
- how well would these queries hold up against large datasets?
- how could we speed up queries?
- what are some problems with this schema? how can they be improved?
sql/employees.sql: rewrite this schema