Computer Science Assignment

Name : Ryano Praputranto

Date : 20 July, 2017

This is a short questionnaire to assess your technical skills required for this role. Some of the questions may require you to write some code - please write as syntactically correct as possible in that case.

To keep this fair and square for all candidates, please don’t use any devices to find the answers to these questions.

Please answer in English.

General
  1. What is the difference between cause and correlation?
    Cause is the root of the particular subject while Correlation is the relationship of one subject with another.

  2. What is the difference between mean and median?
    In a set sequence of 11 numbers, the 6th number will be the median, while the average of the 11 numbers (sum of all the numbers divided by 11) is called the mean

  3. When would you present either the mean or the median value?
    Median is used when we are trying to find the middle number among a set of data, while mean will describe the overall set, which might be skewed due to outliers.

Databases and SQL
  1. What does the JOIN command in SQL do?
    JOIN is a clause used to combine rows from two or more tables, based on a related column between them. There are four different types of JOIN command:

    1. (Inner) JOIN – Returns records that have matching values in both tables

    2. Left (Outer) JOIN – Return all records from the left table, and the matched records from the right table

    3. Right (Outer) JOIN – Return all records from the right table, and the matched records from the left table

    4. Full (Outer) JOIN – Return all records where there is a match in either left or right table

  2. Part of this position involves connecting to databases to extract data. What is/are your suggestion(s) for keeping passwords secure while doing so?

  3. You have the following table in a MySQL database:
    | id | name | parent |
    | 1 | ’home’ | 1 |
    | 2 | ‘mobil’ | 1 |
    | 3 | ‘motor’ | 1 |
    | 147 | ‘toyota’| 2 |
    | 160 | ‘bmw’ | 2 |
    | 301 | ‘honda’ | 3 |
    | 488 | ‘vespa’ | 3 |
    Write an SQL-query to produce the following output:
    | id | category | subcategory |
    | 147| ‘mobil’ | ‘toyota’ |
    | 160| ‘mobil | ‘bmw’ |
    | 301| ‘motor’ | ‘honda’ |
    | 488| ‘motor’ | ‘vespa’ |

Python
  1. Assume you have managed to load the expected output from the previous question to a Pandas DataFrame (if you are not familiar with Pandas, show how you would load the output from a .csv file and continue with your preferred method). Write code that gives you only the rows where the category is ‘mobil’.
    Expected output (no need to print):
    | id | category | subcategory |
    | 147| ‘mobil’ | ‘toyota’ |
    | 160| ‘mobil’ | ‘toyota’ |

  2. What is/are, in your opinion, the best and worst features in Python?