You can create coding questions to test the most relevant skills of the candidates. By creating questions that require candidates to write real working code and not just pseudocode, you can ensure that candidates have the required skills for the role.
Steps to Create a Coding Question
- You must have a HackerRank for Work account.
- You must log in as a company admin user.
- Click on the Library tab in the Home page and click on Create Question.
HackerRank Library Page
- In the Select Question Type dialog box, under Programming category, click on Coding.
Selecting a 'Coding' type Question
In the Problem Statement page, specify the following:
- The problem name should be short and should not give any hints to solve the problem.
- (Optional) Select the Tags from the drop-down list or add your own custom tag.
- Tags are words or phrases that help with 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 to identify your question by its complexity or it’s levels.
- 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 Setting the Difficulty Level for Questions for more information.
- A good problem statement should comprise a clear and detailed problem description, at least one sample test case with an explanation, and constraints of the problem.
- Click the Templates option to use the predefined HackerRank's Coding Question template to define your problem clearly.
- Refer to the Defining the Problem Statement: Coding and Database Engineer Questions topic for more information.
Defining Question and Problem Statement
- As an interviewer you can add a set or rules or guidelines. Or click the Templates option to use the predefined templates to define the Interviewer Guidelines. 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.
- Enter the amount of time, you expect candidates to spend on this question.
- Click Save & Proceed.
Note: Internal notes are only visible to you and your team members and in the candidate report.
In the Languages page, follow the below instructions:
- Click Clear all and candidates can select the check-boxes to solve the problem in any selected language.
Allowed Programming Languages Answer the Question
- In the Code Stub section, specify the function name, return type, and it is optional to add function parameters and then click on Generate Code to generate the code stub. Refer to the article on Coding question: code stub for more information.
Generating Code Stubs
- A dialog box is displayed that lists the languages for which auto-generated code stub is not supported.
Programming Languages for which Code Stubs not Supported
Note: This dialog box is only displayed if your allowed languages include one or more unsupported language for automatically generated code stub.
- In the displayed dialog box, you can either choose to deselect the unsupported languages for automatically generated code stub or retain these languages and then click Yes, Generate Code.
- If you deselect the languages, then those languages are not allowed for answering this question. If you keep these languages, you have to manually select the language in the Default Stub section and type the code stub.
- In the Default Stub section, you can select the languages from the drop down menu to see the generated code stub.
- Click Save & Proceed.
In the Test Cases section, perform one of the following operations:
- If you want to add test cases one by one, click Add test case. 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 Save.
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.
Defining Test Cases to Validate the Code
- Refer to the Coding question: test cases topic for more information on test cases.
- Click Upload as .zip to upload multiple test cases.
- In the Upload Test Cases dialog box, click Choose File to upload a zip file that contains test cases from your local system.
Click Upload to upload the zip file.
Click Upload as .zip.
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.
- Click Advanced Settings to add additional data source files or to enable the network access for the questions. You can enable the network access by ticking the Enable network access for the question checkbox.
- Click Upload Solution to add a solution for this problem to help candidates debug and see the expected output for their custom input.
- Click Save Question to save the question and exit.
- Alternatively, click Save & Add another to save this question and proceed to create another one.
- The Questions you create are stored in the HackerRank Library under the “My Company questions” section. The Question type and the associated tags are indicated below every Question title as shown below.
Coding Question in the Library
In the Quality Review section, you can review and add test cases or sample test cases, modify the code stubs and add more tags.
- Click on Try question and Select the check-box Test against custom input to add your custom input.
- Click Run Code to check the status if the code is passed or failed the compilation.
- Click My Company Questions to view your company questions.
Validation in Quality Review Section