Antworten auf Fragen der Stadt Zürich

Why do you want to become a trainer ?

I would love to let others learn from the expertise I build up the last decades and help others enter software development.

Q1: According to the HTML code below, please describe what the visual end result will be when executed by a browser:

HTML Test

This HTML code will show a web page named “Document”. The page is labeled holding English content encoded in UTF-8, will be zoomed to 100% and full width of the device and will render in the highest version of Internet Explorer available. The page is divided into three sections: A header, a main section and a footer.

The header of the page will show a welcome heading followed by a navigation list element with three elements: First a link saying “Item nav 1” to Google’s search website opening in a new window/tab, second a text list item saying “Item nav 2” and third a search form with a search field saying “search…” followed by a search button.

The main section shows a list of two blog articles both holding a example heading, body text and a footer with meta data about the author and the date posted.

The footer shows a “Made with” text message followed by a ♥ symbol.

Last but not least the web page will load an additional, dedicated JavaScript file named “search.js” probably holding the logic for the search field in the third navigation element and will call the “start()” method of a “Search” JavaScript object. With no additional JavaScript code provided, I can’t tell for sure what this call really does.

Q2. Provide the CSS code to format the nav-bar present in the HTML of question 1 (Q1)

  1. The nav-bar elements should be in-line
  2. The link should react or change when hovered over
  3. The form input and the form button should have the same height
  4. The end result should be usable and coherent

Ich glaube, ich habe die Datei aus Versehen gelöscht. Allenfalls kann ich sie noch in einem Backup finden.

Q3. Explain what the search module does in the following code:

JavaScript Test

This JavaScript code binds a custom event handler to the search form element in the navigation bar that fetches search results from an API hosted at url.com as JSON data and then sets the content of the main section to the fetched results, if there are any.

Q4. The following PHP lines are taking care of a post request that registers a new user through a POST http call. What should be done in order to securely store the user’s information? What could be improved outside of security aspects?

PHP Test

First this app should only run at a HTTPS connection to secure transmition of the e-mail address and password. Second the UserRepository object that seams to follow Microsoft’s Repository pattern proposed for Laravel should make sure user data is not saved as clear text but rather hashed or protected by other measures by the Data Tier (i.e. Persistence Layer eg. a database). Further more I’d never expose such a vital function on the open internets and would make sure, any web app triggering this POST call is secured by a random hash key generated beforehand by the same app and any call is only answered if that hash is validated before processing the POST data. This would prevent outsiders to flood the UserRepository storage with randomly generated e-mail and password pairs. Last but not least I hope the UserRepository object (not further sepcified in the example) does incorporate checks for both validating e-mail addresses and password strength before creating and saving any new user.

Q5. Explain what the following SQL query does when executed. Explain what it yields.

SQL Test

This SQL query searches for a search term in the title and body fields of the articles table or in the lastname and firstname fields of the authors table and yields to a joined result set with title, body, cretaing_date, lastname and firstname limited to 10 results.