Anda di halaman 1dari 3

Formative Assessment for the DiRAC Supercomputing Facility

Sample Assessment
Mike Jackson (Software Sustainability Institute, University of Edinburgh)
Greg Wilson (Software Carpentry)
James Hetherington (University College London)
Andrew Turner (University of Edinburgh)
= Introduction =
You have one hour to complete the following tasks.
You may use the web, 'man' pages and any other resources you would
usually use when programming.
If you are completing the assessment with colleagues, you are free
to discuss hints, tips and the usage of commands, but do not
share the answers to tasks.
If at any point you would like clarification, please do not hesitate
to ask.
If at any point you are unable to complete a task, feel free to move
on to the next task. The major tasks (shell, shell scripts, make,
testing, code review) are all independent. You may ask for help
before moving on, but doing so will be considered equivalent to not
completing that task.
= Version Control =
You have just cloned a Git repository. This serves as both a
repository and your working copy. You will do all of your work in
this local repository, and use version control to commit your
solutions as you go.
= Shell =
Use the cd command to go into the python/ directory. Use a single
shell command to count the number of lines which include the word
"ATOM" in all the .pdb files in the inputs/ directory and that puts
this count in a file called atom-count.txt.
= Version Control =
Add atom-count.txt to the version control repository and commit it.
Create a file, shell-command.txt, containing the command you ran,
add this to the version control repository and commit it.
= Shell Scripts =
Using your command from the Shell exercise, write a shell script
called word-search.sh that outputs the counts for a list of words For
example:
./word-search.sh ATOM MOLECULE PROTON
must produce:
ATOM 41

MOLECULE 17
PROTON 3
as its output. You do not need to do error-checking on the
command-line parameters, i.e., you may assume that they are all
simple strings.
= Version Control =
Add word-search.sh to the version control repository and commit it.
= Version Control =
Commit your changes to Makefile to the version control repository.
= Testing =
The bubble.py program contains a function called bubble_sort, which
sorts a list of integers using an algorithm called bubble sort:
bubble_sort([6, 9, 2, 5]) == [2. 5, 6, 9]
bubble_sort([1, 4, 2])
== [1, 2, 4]
In the file test_bubble.py, you will find a unit test implementing the
first example above. Write three (3) more unit tests that you think
are most important to run to test this function. Do not test for
cases of invalid input (i.e., inputs that are strings, lists of lists,
or anything else that isn't a flat list of integers).
You can run your tests using the command:
py.test test_bubble.py
= Version Control =
Add test_bubble.py to the version control repository.
= Code Review =
The program divisors.py takes a single non-negative integer as a
command line argument and produces the divisors of that number. For
example:
./divisors.py 27
produces:
27
9
3
1
Change this program in at least 3 ways to improve its readability,
understandability and modularity *without* changing its behavior.
The file test_divisors.py has tests for divisors.py. You can check
that your changes have not changed divisors.py's behaviour by running,
py.test divisors.py

= Version Control =
Commit your changes to divisors.py to the version control repository.
= Secure Shell =
Assume you have an account, username "me", on a remote host,
server.dirac.org. Assume there is a file, data/run4/particles.dat
that you want to zip up and copy to your local host.
What secure shell commands would you run locally to zip up the file on
the remote host then copy the zipped file to your local host?
= Version Control =
Create a file, ssh-commands.txt, with the commands you would use, and
add this to the version control repository.
= Assesment Complete =
Please inform your examiner!

Anda mungkin juga menyukai