Steps to Create a Coding Question
- Click on the Library tab on the Home page, then select the Create Question option.
-
In the Select Question Type dialog box, there are three options:
- Programming
- Projects
- General
- Choose Coding under the programming section.
Question Details
On the Question Details tab, specify the following:
Problem Details
- This section consists of Question Name and Problem Description.
- The problem name should be short and not give any hints to solve the problem.
-
The Problem description discusses the question or issues a project seeks to address.
- A good problem statement should comprise a clear and detailed problem description, at least one sample test case with an explanation, and problem constraints.
- Click on the Templates option to use the predefined HackerRank's Coding Question template to define your problem clearly.
- For more information, refer to the Defining the Problem Statement: Coding and Database Engineer Questions topic.
Question Properties
- Recommended Time: Enter the time you expect candidates to spend on this question while answering a test.
-
Tags: This is an optional field. Select the Tags from the drop-down list or add your custom tag.
- Tags are words or phrases that help with the searchability and organization of your questions. You can add the existing tags or create new tags. Set the difficulty level for your question by associating the tags as Easy, Medium, or Hard. Alternatively, associate custom tags with identifying your Question by its complexity or level.
- When you view your Questions in the Library, the associated tags will be indicated for every question. You can use these tags to generate candidate reports and performance graphs.
- Refer to Associating the Tags for Questions for more information.
- Skills: Here, you can select the skills associated with the question from the dropdown.
Interviewer Guidelines
- Interviewer guidelines are for later reference. You can include a rubric about scoring the questions or write solutions to the problems in this section. These can be used by your team while evaluating the test. This step is optional.
You can also attach a relevant reference file in these sections. Refer to the How to Attach a File to a Problem Statement topic for more information.
Note: Interviewer Guidelines are only visible to you and your team members and in the candidate report.
Once you have given the above details, click the Next button to move forward.
Languages
On the Languages tab, follow the below instructions:
- Click on the checkboxes to allow candidates to solve the problem in any of the selected languages.
- You can also Select all or Clear all with the options provided.
- Give a specific function name and click on Generate Code.
- A code editor comes up where you can edit the code if you want.
- You can disable the editing option for code stubs if you don't want the candidates to edit the code stub.
Test Cases
Upload Solution
- You can upload your solution to help the candidates debug and see the expected output for their custom input.
Adding Test Cases
In the Test Cases section, perform one of the following operations:
- If you want to add test cases individually, click on the Add test case button. In the Add Test Case dialog box:
- Specify the Name of the test case.
- Select the Difficulty level of the particular test case.
- Enter a Score for this test case. If the code passes this particular test case, this score is assigned. The sum of scores of all test cases is the total score assigned to a coding question.
- Specify the Input and Expected Output values for the test case.
- Optional: Select the Mark as sample test case check box if you want this case to be a sample test case.
- Click on the Save button.
Note: You must assign a score to a particular test case, depending on the difficulty level of the test case.
- Repeat the steps as illustrated above to add more test cases.
- Refer to the Defining Test Cases for Coding Questions article for more information on test cases.
- Click on the Bulk Upload as Zip to upload multiple test cases.
- Click the Choose File button to upload a zip file containing test cases from your local system.
- Click on the Upload button to upload the zip file.
Note: This method is preferred when either the size of input and output is large, or the number of test cases is large. The input files in the zip are named input000.txt, input001.txt, and so on. The output files are named output000.txt, output001.txt, and so on
Adding Data Sources to a Custom Coding Question
- Under the Test Cases section of a question, you can add data to the problem that will be accessible by the candidate in the working directory.
- Click Advanced settings, Add data sources, then add whatever data file you’d like to upload (.csv, .yaml, .txt, and so on.)
- This file will now be accessible to the candidate.
Note: You will have to instruct the candidate in the problem statement on the file name and extension so they know how to access the data properly.
- You can then instruct the candidate on accessing the data given the specific file extension and language or make it part of the question for the candidate to know how to access the file properly.
Below is an example of Python code accessing a .csv file and Ruby code accessing a .yaml file. (You can use whatever language/extension combination best suits your needs)
Python accessing a CSV
Ruby accessing a yaml
Quality Review
- While creating a question, you can see the Quality Review of your question in real time, as shown in the below screenshot.
Candidate Preview
- You can preview the question you have created by returning to the Question Details tab and clicking on the See Candidate Preview button.
- The preview will be visible on the right of your screen, as shown below.
Saving the Question
- When you are done with the question creation process, save it by choosing the desired option from above.