Code Review questions are created to test the candidates based on real-world problems, where the code is written by someone else. The candidate will be asked to provide feedback on it. This type of question is given to senior-level candidates to test their existing industry experience, such as managers, mentors or simply contributing members of a high-performing team. In this article, we will dive into how you can create your own Code Review Question.
How to add Code Review Questions to a Test?
You can watch this clip to learn about how you can create Code Review questions in HackerRank. Alternatively, you can also read along and follow the steps mentioned below to create Code Review questions from your account.
- Create a new test or open an existing test
- Add a question from the library
- Select Code Review in the Type search area to display existing code review questions from the library. Click on the + icon to add a question to your test.
How to Create a Custom Question?
To create a custom Code review question in your library, follow these steps:
- Click on the Library tab, and then click on the Create Question button
- On the Select Question Type screen, click on the Code Review question type
- Fill out the Name, Score, Recommended Time, and the Problem Description
Note: In the problem description, you should explain to the candidate that they are reviewing code and are expected to leave comments.
- Save this page to go to the Upload Code step
- In the Upload Code step, you can set up the code that needs to be reviewed
The platform supports either reviewing a set of new files or Creating a Diff from 2 sets of files. This is useful for simulating a pull request where only a few changes were made, but the rest of the code should be there for context.
The system supports multiple changed files, so you must create 2 .zip files. The first .zip file should be the initial code file. The second .zip package should be the changed version. The platform will automatically create the diff between the two packages. Make sure that the folder path and filenames are the same inside of each zip file. That way the patch will look like a set of changed files instead of separate deleted and new files.
- After Saving, you can set up the Grading Rubric
- In the Gradic Rubric, you can add comments that will serve as a reference at the time of evaluation. These comments are private and won’t be visible to the candidates. Click on the + icon beside each line of code to add your comment against that line.
The Candidate Experience
Candidates will be able to leave comments on the code diff as shown in the below image.
The candidate can change their view to Unified or Split. Unified is the default. Split is helpful if an original set of files were provided.
When they are finished adding comments, they can click the Submit Review button to complete the question.
Note: At this point, code review questions can only be used in tests and you cannot import them to your interviews.