Skip to content

Draft: Job interview

Simon Wacker requested to merge job-interview into develop

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:

  1. List the directory content (Answer: Type ls and press enter)
  2. Print the content of one of the listed files (Answer: Type cat ${FILE_NAME} and press enter)
  3. Print the help information of the tail command (Answer: Type tail --help and press enter)
  4. Explain the usage information, explain what the argument --follow does, and follow the tail of the file you printed above (Answer: Type tail --follow ${FILE_NAME} and press enter)
  5. In another shell add the line Hello tail! to the end of the followed file (Answer: Type echo "Hello tail!" >> ${FILE_NAME} and press enter)
  6. Print the Python version (Answer: Type python --version and press enter)
  7. List all installed Python packages and count their number using pipes and wc (Answer: First, type pip list and press enter and then type pip list | wc -l and press enter)
  8. 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 type exit() and press enter. Note that we use list comprehensions here.)
  9. Check type hints with mypy (Answer: Type mypy . and press enter)
  10. Read output, interpret output, and fix type error (Answer: Turn return type of calculator.raize from str to int)
  11. Check type hints and if successful, commit fix in a new bug-fix branch (Answer: First, type mypy . and press enter, then type git checkout -b my-bug-fix and press enter, then type git add . and press enter, then type git commit -m 'Fix return type of "calculator.raize"' and press enter)
  12. Run tests with pytest (Answer: Type pytest ./tests and press enter)
  13. Read output, interpret output, and fix logic error (Answer: Remove - 1 from range in calculator.raize)
  14. Run tests and if successful, commit fix (Answer: First, type pytest ./tests and press enter, then type git add . and press enter, then type git commit -m 'Fix logic error of "calculator.raize"' and press enter)
  15. Push the fix and create a merge request into the job-interview branch (Answer: First, type git 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)
  16. Merge the branch through the user interface and back in the shell pull the new version of the job-interview branch and remove the my-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)
  17. 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)
  18. 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, ...)
  19. 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)
  20. Why use source control systems like git? (Partial Answer: Versioning. Collaboration. Knowing why certain changes where done and what changes belong to one another)
  21. Why use "environment tooling" like docker? (Partial Answer: To have reproducible environments across space and time)
  22. Use Python multiprocessing to compute something in parallel. (Missing Answer: For advanced applicants)
Edited by Simon Wacker

Merge request reports