Draft: Job interview
Long running branch for job interviews with one typing error and one logic error. Other errors that could be added are syntax errors, runtime errors, arithmetic errors, resource errors, and interface errors or other kinds of programming errors.
Tasks to ask the applicant to do within a POSIX-compatible shell like bash
in a clone of this repository with the branch job-interview
checked-out:
- List the directory content (Answer: Type
ls
and press enter) - Print the content of one of the listed files (Answer: Type
cat ${FILE_NAME}
and press enter) - Print the help information of the
tail
command (Answer: Typetail --help
and press enter) - Explain the usage information, explain what the argument
--follow
does, and follow the tail of the file you printed above (Answer: Typetail --follow ${FILE_NAME}
and press enter) - In another shell add the line
Hello tail!
to the end of the followed file (Answer: Typeecho "Hello tail!" >> ${FILE_NAME}
and press enter) - Print the Python version (Answer: Type
python --version
and press enter) - List all installed Python packages and count their number using pipes and
wc
(Answer: First, typepip list
and press enter and then typepip list | wc -l
and press enter) - Enter the Python REPL (read, evaluate, print, loop), write an expression whose result is the list of squares of the numbers 1 to 10, and exit the REPL (Answer: First, type
python
and press enter, then type[x**2 for x in range(1, 11)]
and press enter, then typeexit()
and press enter. Note that we use list comprehensions here.) - Check type hints with mypy (Answer: Type
mypy .
and press enter) - Read output, interpret output, and fix type error (Answer: Turn return type of
calculator.raize
fromstr
toint
) - Check type hints and if successful, commit fix in a new bug-fix branch (Answer: First, type
mypy .
and press enter, then typegit checkout -b my-bug-fix
and press enter, then typegit add .
and press enter, then typegit commit -m 'Fix return type of "calculator.raize"'
and press enter) - Run tests with pytest (Answer: Type
pytest ./tests
and press enter) - Read output, interpret output, and fix logic error (Answer: Remove
- 1
fromrange
incalculator.raize
) - Run tests and if successful, commit fix (Answer: First, type
pytest ./tests
and press enter, then typegit add .
and press enter, then typegit commit -m 'Fix logic error of "calculator.raize"'
and press enter) - Push the fix and create a merge request into the
job-interview
branch (Answer: First, typegit push --upstream origin my-bug-fix
and press enter, then in a web browser navigate to https://gitlab.cc-asp.fraunhofer.de/ise621/sample-python-project/-/merge_requests and create a new merge request through the user interface) - Merge the branch through the user interface and back in the shell pull the new version of the
job-interview
branch and remove themy-bug-fix
branch (Answer: Press the merge button in the user interface and then in the shell execute `git checkout job-interview && git pull -p && git branch -d my-bug-fix) - What are the advantages and disadvantages of Python compared to C#, Java, Rust (or any other compiled and typed language)? (Partial Answer: Python is interpreted and untyped whereas C# is compiled and typed. Compilation makes running code faster in general and typing ensures overall consistency at compile-time reducing run-time errors)
- Why is testing important? Which testing granularities do you know? (Partial Answer: Testing ensures that code does what the developer intended it to do now and in the future and also documents what it was intended to do in an executable way that can be checked automatically. If there are no tests, then regression can happen, either by a developer introducing changes with unforeseen side-effects or a developer changing the run-time environment, for example by upgrading the operating system, system dependencies or dependent packages. Tests can also be used to check that code does what is intended to do when switching devices, for example using the code on a developer machine versus using it on a simulation server. Well-known testing granulatirites are integration testing, unit testing, performance testing, ...)
- Why is typing important? (Partial Answer: To check code consistency without running the code reducing run-time errors or wrong results due to wrong usage)
- Why use source control systems like
git
? (Partial Answer: Versioning. Collaboration. Knowing why certain changes where done and what changes belong to one another) - Why use "environment tooling" like
docker
? (Partial Answer: To have reproducible environments across space and time) - Use Python
multiprocessing
to compute something in parallel. (Missing Answer: For advanced applicants)
Edited by Simon Wacker