This is a general outline of the key concepts (arranged by topic) that you should know for Exam 02.
The exam will have the following format:
Code Snippets: Write Python code snippets to perform certain tasks.
Short Answers: Briefly answer questions about
Functional Programming and Generators
Concurrency and Parallelism and MapReduce
Translation: Convert Unix pipelines to Python code.
Parts 1 and 2 are to be done first on paper. After these parts are completed, part 3 can be done with the aid of your laptop and the Internet (but not other people).
This check list is meant to be representative, rather than exhaustive (ie. there may be questions that show up on the exam that are not shown below).
What are the advantages and disadvantages of using command line tools such as pdflatex and gnuplot to create documents?
How would you use ImageMagick to:
How is Python different from the Bourne shell? How is it similar?
How do we manage control flow in Python? How do we utilize these constructs?
Conditionals
Loops
Exceptions
Functions
What data structures do we have in Python? What are their basic operations?
Lists
Dictionaries
Sets
How do we do the following in Python?
Process command-line arguments
Read and write files
Read standard input
Check if a file exists
Execute an external command
Fetch data from the web
Process JSON data from the web
Given the following Unix pipelines, write Python code that accomplishes the same task.
Note: No credit will be given for simply calling os.system
on the given pipeline.
cat /etc/passwd | cut -d : -f 1 | grep d$ | wc -l
cat /etc/passwd | cut -d : -f 3 | grep -E '^[0-9]{2}$' | sort | uniq
curl -s http://sprunge.us/bJIN | cut -d , -f 3 | grep -Eo '^[^aeoiu]*@.*'
curl -s http://sprunge.us/bJIN | grep -Eo '^B.*' | cut -d , -f 1 | sort
who | sed -rn 's|.*\((.*)\).*|\1|p' | sort | uniq
ls -l /etc | awk '{print $2}' | sort | uniq -c
What is the difference between procedural and functional programming?
What are some benefits of functional programming?
How is functional programming related to the Unix Philosophy?
How do we use map, filter, reduce, and lambda to do functional programming in Python?
How do we use list comprehensions to do functional programming in Python?
What is a generator and how it is different from a list?
What does the yield command do?
How do we convert a list comprehension to a generator comprehension?
What is the difference between concurrency and parallelism?
What are some problems with concurrency?
How does functional programming help enable concurrency and avoid these problems?
What does it mean for a problem to be data parallel or embarrassingly parallel?
What is MapReduce?