Skip to content

Midterm Interview Exam - Case 1: Student Activity Tracker

TL;DR: Read the Specifications and start working on the Programming Tasks. To understand the background, read the problem description from the beginning.

It is very challenging to keep track of student activities during synchronous and asynchronous course activities. Students may have varying pace and schedule when participating in the course. Moreover, students also use multiple learning tools such as GitLab and Moodle (Scele), where each tool may have its way in defining and storing students' activities. The teaching team needs to compile the activity logs by exporting the records from each teaching tool and integrating them into a unified view.

For the interview exam, the scope of the requirements is simplified. Instead of developing a fully-fledged working system that monitors student activities across multiple learning tools, the project only requires a single Web service that lets the user (i.e., the teaching assistant (TA) and lecturer) create an activity log of a student. The activity logs are stored in an in-memory data storage such as Java collection (e.g., List). In addition, there is no authentication required in the Web service.

For example, the TA noticed that one student made a contribution by increasing the line coverage of a sample project. The TA can open his or her terminal and use curl to send an HTTP POST to the Web service containing the activity log as form data:

1
2
3
4
5
$ curl -X POST \
    -d 'date=2021-04-01' \
    -d 'name=The student' \
    -d 'description=Contributed to the sample project' \
    https://example.com/activity

Or if the TA prefer to use Python script over curl:

1
2
3
4
# Note: Using `requests` module. Install: pip install requests
import requests
response = requests.post('https://example.com/activity',
    data={'date': '2021-04-01', 'name': 'The student', 'description': 'Contributed to the sample project'})

Both script examples send a form data containing three fields (date, name, description) to the /activity endpoint served at https://example.com. You are allowed to deploy and run the Web service locally during the exam, i.e., on localhost.

Specifications

Estimated reading time: 5 minutes

Develop a Web service with a single endpoint named /activity that handles an HTTP POST message containing form data with the following fields:

  • date : Date of the activity, written in yyyy-mm-dd format
  • name : Name of the student
  • description : Description of the activity

If all fields are present and contain valid values, store them as an object in data storage. Then, return an HTTP 200 response if the activity log is successfully stored. Otherwise, implement basic error handling. For example, return an HTTP 400 response if some of the fields are missing.

Programming Tasks

Estimated working time: 10 - 15 minutes

Turn on your camera and share your desktop screen. Ensure that the proctor (in most cases, the lecturer and sometimes the TAs) can monitor your activities during the interview exam. Imagine you are conducting a remote pair programming where the partner needs to observe your work.

Do the tasks in the Mandatory subsection. If there is some time left after you completed the Mandatory subsection, you can do the tasks in the Optional subsection.

Mandatory

We recommend you to do the tasks according to the given order. The tasks are sorted based on the required effort and logical order to complete them.

  1. Create a new project under your own GitLab subgroup in KKI 2021 group.
  2. Initialise the Git repository to track your progress.

    You can commit and push the initial commit that only contains the starter code at this point.

  3. Prepare the starter code for building the project. The starter code may be written in Java (Spring Boot) or any programming language/framework that you are familiar with.

    If you choose to use another programming language/framework, make sure it has support for developing a Web service, writing unit test and can be deployed on Heroku.

  4. Design a test case that verifies only one of the following: (1) Checks whether a valid activity log is successfully stored in the data storage; or (2) Ensures a valid HTTP POST request to /activity endpoint will return a HTTP 200 response; or (3) Ensures an invalid HTTP request to /activity endpoint will return a HTTP 400 response.
  5. Work on the problem set. Write the code to implement the required feature. Do not forget to commit and push your work-in-progress frequently.
  6. Write a test program using the testing framework provided by the programming language/framework and implements the test case you have designed in the previous problem.

Optional

Feel free to do the tasks in any order. It is alright if some of the tasks are not completed. The discussion session may ask you to complete the unfinished tasks.

  • Implement a basic authentication mechanism by checking whether the HTTP request contains a header named X-AdvProg-Auth with the value 2021. If the request is valid, then proceed to store the new activity log. Otherwise, reject the input and return an HTTP 403 response.
  • Design and implement the test case for verifying the basic authentication mechanism.
  • Create a new Heroku app and deploy the local version of the project to Heroku using Heroku CLI.
  • Create a new project on SonarQube AdvProg and run SonarScanner that sends the scan result to SonarQube AdvProg.
  • Set up a GitLab CI/CD pipeline that automatically runs the test suite each time a new commit has been pushed to master branch.

Discussion

Estimated discussion time: 5 - 10 minutes

The list of possible topics during the discussion is as follows:

  • Development workflow (Git, IDE)

    Examples: How do you use Git when working on your course work?; How to merge a branch into another branch?; How do you resolve a merge conflict?

  • Writing and running test

    Examples: How do you design the test cases to test a piece of code?; How to measure line coverage?

  • Concurrency

    Examples: How to prevent a race condition in implementation level or architectural level?; Describe one example of serialisation technique employed in a programming language/framework of your choice

  • Deployment workflow (GitLab CI/CD, Heroku)

    Examples: Describe one or more elements commonly found in a .gitlab-ci.yml file; Show how to deploy a codebase to Heroku using Heroku CLI

  • Code quality (SonarQube, SonarScanner)

    Examples: Mention some code smells that you have encountered throughout this course; What is the responsibility of SonarQube and SonarScanner?

It is also possible that the proctor will ask questions that are not listed above.

Hints

  • As mentioned in the requirements, you do not have to set up a database. The most straightforward approach is to use the collection library provided by the standard library of programming language/framework of your choice.
  • If you are using Spring Boot, you only need Spring Web in the project dependencies. Do not make the project more complex by adding other dependencies such as Spring Data REST or database connection drivers.
  • You already have a collection of code examples that you can adapt to solve this problem. Hence, we do not recommend you to search for tutorials or code snippets through a search engine. You may do so, but we think it is better to spend your time in coding and reuse the available resources.

Last update: 2022-03-24 15:13:08
Created: 2022-03-24 15:13:08
Back to top