---
title: Creating custom programming questions
description: For more information about the various components of a programming problem, see Parts of a programming problem. Your problem has been created with a problem name and description. The next step is to a
---

[Skip to content](https://help.hackerearth.com/hc/en-us/articles/360005444233-creating-custom-programming-questions#main-content)

English

Show submenu for translations

![HE logo.png\]](https://help.hackerearth.com/hs-fs/hubfs/HE%20logo.png?height=40&name=HE%20logo.png)

Open main navigation

Close main navigation

- English
  
  Show submenu for translations

 Hello. How can we help you?

- There are no suggestions because the search field is empty.

1. [Help Center](https://help.hackerearth.com/?hsLang=en)
2. [Assessments: Recruiters](https://help.hackerearth.com/assessments-recruiters?hsLang=en)
3. [Programming](https://help.hackerearth.com/assessments-recruiters?hsLang=en#programming)

# Creating custom programming questions

*For more information about the various components of a programming problem, see [Parts of a programming problem](https://help.hackerearth.com/hc/en-us/articles/360004130894-parts-of-a-programming-problem?hsLang=en).*

 Description

### **Adding the problem statement and description**

1. In the **Test Details** section, click **Questions**.
2. Click **Create a new question**.
3. In the **Select question** **type** pane, click **Programming** in the **Coding** section.  
   ![mceclip0.png](https://help.hackerearth.com/hubfs/Knowledge%20Base%20Import/mceclip0-Jan-30-2023-11-30-30-1353-AM.png)
4. In the **Create Programming** **question** window, perform the following tasks:  
     - Enter the name of the problem in the Problem name field.
     - Enter a descriptive problem statement describing the problem, input and output format, and constraints.
5. Click **Next**.

Your problem has been created with a problem name and description.  
The next step is to add the solution and test cases.

 Solutions & test cases

### **Adding the sample input and output**

#### Sample input

Sample input is used to drive the candidate in the right direction with respect to the logic. This is one of the input cases that is exposed to the candidate. It is used to run their code when they click **Compile and Test**.

**Prerequisites**

- Format: .txt only
- Naming convention: in00.txt, in01.txt, in03.txt, etc.
- Size: Up to 5 MB

**Steps**

To upload the sample input file, follow these steps:

1. Hover over **You have not added the Sample input file**.
2. Click **Upload file**.
3. Navigate to the location where the .txt file is stored in the system.
4. Double-click the file.

**Input file guidelines**

 The input file must not contain the following:

- Empty lines anywhere in the file, even intermediate ones. This means that in a file, you cannot have lines that are completely blank.
- Leading white spaces in the first non-empty line (a line containing any character other than white space). When you have a line that contains text (letters, numbers, symbols, etc.), this line must not start with any spaces, tabs, or other types of whitespace characters. 
- Trailing white spaces in all the non-empty lines.

**Array input format**

By default, code snippets generated by the auto-generator read array elements as space-separated values on a single line. For a question whose inputs are **n** (the size of the array), **arr\[n\]** (the array), and **d** (an integer), the input file is as follows:

```
31 5 2 5
```

If you want the array elements to be on separate lines instead, you must configure the code snippet accordingly — either by selecting a 2D array data type in the auto-generator with the number of elements as rows and 1 as the column, or by writing the snippets manually for each language. For more information, see [Code snippets](https://help.hackerearth.com/hc/en-us/articles/360002884553-code-snippets?hsLang=en).

Make sure that the format in your input files matches the format that the code snippet reads. A mismatch causes the evaluation to fail.

**Sample output**

A sample output file comprises the output conditions that a solution must meet to be compiled successfully. After a candidate writes the solution to a problem, the solution must be compiled, tested, and then submitted.

**Prerequisites**

- Format: .txt only
- Naming convention: out00.txt, out01.txt, out02.txt, etc.
- Size: Up to 5 MB
- Array input format: the format of array values in the input files must match the format that the question's code snippet reads. See *Array input format* under Sample input.

**Steps**

To upload the sample output file, follow these steps:

1. Click **You have not added the Sample output file**.
2. Click **Upload file**.
3. Navigate to the location where the .txt file is stored.
4. Double-click the file.

**Downloading or changing the input or output files**

You can also download the uploaded file or change the file that you have uploaded by hovering over **Sample input**. Click **Download** to download the file and click **Change file** to change the file that you have uploaded.

![mceclip4.png](https://help.hackerearth.com/hubfs/Knowledge%20Base%20Import/mceclip4-Jan-30-2023-11-30-24-4236-AM.png)

### **Adding the ideal solution and sample explanation**

#### Ideal solution

This is the correct logic that is used to solve the question. It is used to generate an expected output based on the custom input that a candidate provides. Please take a look at the image below to see a sample ideal solution.

![Screenshot from 2023-10-18 17-43-42](https://help.hackerearth.com/hs-fs/hubfs/Screenshot%20from%202023-10-18%2017-43-42.png?width=670&height=747&name=Screenshot%20from%202023-10-18%2017-43-42.png)

**Ideal solution in C++**

**Prerequisites**

- Format: Must have the same file extension as the programming language in which the solution is written.
- Size: Maximum size of the file must be 1 MB

**Steps**

To upload the ideal solution, follow these steps:

1. Click **You have not added the ideal solution**.
2. Click **Upload** **file**.
3. Navigate to the location where the relevant file is stored.
4. Double-click the file.

#### Sample explanation

This is a logical explanation of how the sample output is derived from the sample input. This explanation is visible to the candidate.

**Steps**

To add a sample explanation, follow these steps:

1. In the Sample field, enter the logical explanation of how the sample output of the problem is derived from the sample input. 
2. Format as required

#### **Adding test cases**

Test cases, also known as input and output files or tasks, are used to evaluate a candidate's submissions. These test cases contain the actual conditions that a candidate's code must meet to get successfully submitted. An input file must have a corresponding output file. You can assign a score to each input and output file.

**Prerequisites**

- Format: .txt files
- Bulk upload format: .txt files zipped into individual .zip/.tar files
- Naming convention for input files: in00.txt|bin, in01.txt|bin, etc.
- Naming convention for output files: out00.txt|bin, out01.txt|bin, etc.

**Uploading manual test cases**

To upload manual test cases, follow these steps:

1. Click **Add test cases**.

![image\_\_42\_\_\_1\_.png](https://help.hackerearth.com/hubfs/Knowledge%20Base%20Import/image__42___1_-1.png)

1. A new modal of adding test case appears on the system.
2. Click the checkbox beside **Visible to candidates** to make this test case visible to candidates.
3. Hover over **Add input file** text box and add the input in the field.
4. Navigate to the location where the input file is stored in your system.
5. Double-click the file.
6. Hover over **Add output file** and add the output in the field.
7. Navigate to the location where the output file is stored in your system.
8. Double-click the file.
9. Enter the maximum score for this particular test case. For example, 20.
10. You can also add an explanation to this test case.
11. Click **Save**.  
    ![image\_\_43\_.png](https://help.hackerearth.com/hubfs/Knowledge%20Base%20Import/image__43_-1.png)
12. Repeat these steps for all the input and corresponding output files.

**Uploading test cases in bulk**

To upload test cases in bulk, follow these steps:

*Important: *The files should **not** be put in a folder and zipped. Zip individual .txt files.

1. Zip each set of input and output files by following these steps:  
     - Navigate to the location where the input and output files are saved.   
       **Note**: These must follow the naming convention.
     - Click an input file to select it and press Ctrl and click the corresponding output file to select it.
     - Right-click on any of the selected files-\>**Send to**-\>**Compressed (zipped folder)**. 
2. Click **Upload zip/tar**.
3. Navigate to the location where the zipped files are stored.
4. Double-click the required file. The file is uploaded successfully if you have followed the right naming convention and formats.
5. Assign the required score.

*Note*: You can also edit the test cases after adding or uploading the file. They will open in the same format they were uploaded in. For example, if a test case was a manual test case, then the modal will be a manual test case modal. If the test case was a file upload, the modal will have a file upload option. 

#### **Code checker settings**

This setting defines the following:

- Maximum time duration (in sec) in which a candidate's code must be executed for individual test cases
- Maximum memory (in MB) that a candidate's code can utilize while being executed
- Maximum size (in KB) of code that can be submitted by a candidate

To set these settings, follow these steps:

1. Set the Time limit (sec). For example, **5**.
2. Set the Memory limit (MB). For example, **256**.
3. Set the Maximum size of code. For example, **1024**.  
   ![mceclip2.png](https://help.hackerearth.com/hubfs/Knowledge%20Base%20Import/mceclip2-Jan-30-2023-11-30-23-1161-AM.png)

 Languages

### Allowed languages

Select the programming languages in which candidates can write their code for a programming question.  

![mceclip3.png](https://help.hackerearth.com/hubfs/Knowledge%20Base%20Import/mceclip3-Jan-30-2023-11-30-28-8265-AM.png)

Check the checkbox beside **Select all** to select all the **41** programming languages in which candidates can write their code. 

### Code snippets

A code snippet is a boilerplate code that can be used without changing it. This code helps such candidates who are not familiar with the online coding environment to focus more on the algorithm that is required to solve the question rather than understanding the STD INPUT and OUTPUT syntaxes.

To know more about how to generate code snippets in a question, click [here](https://help.hackerearth.com/hc/en-us/articles/360002884553-code-snippets?hsLang=en).

 Editorial

This section contains a detailed approach to solve the question. It is mainly used for internal purposes such as testing the question, formatting the question, and so on.

**Steps**

To add a sample explanation, follow these steps:

1. In the **Editorial** field, enter the logical explanation of how to solve the question. 
2. Format as required

Now, click **Publish** to add the question in the test. If you want to save the question as a draft for any future tasks, then click **Save as draft**.

**Important**: You can save your question as a draft at any time to save all the tasks that you have completed at that span of time. For example, if you have added the solution and test cases to the question but you want to select the allowed languages after some time, then click Save as draft. Your tasks or changes will not be lost and you can resume from where you left.

Here is a walkthrough video that demonstrates how to create programming questions step by step:

<iframe data-hsv-src="https://play.hubspotvideo.com/v/2586902/id/213379441819" referrerpolicy="origin" sandbox="allow-forms allow-scripts allow-same-origin allow-popups" allow="autoplay; fullscreen;" style="position: absolute !important; width: 100% !important; height: 100% !important; left: 0; top: 0; border: 0 none; pointer-events: initial" title="HubSpot Video" loading="lazy" data-hsv-id="213379441819" data-hsv-style="" data-hsv-width="1920" data-hsv-height="1080" data-hsv-autoplay="false" data-hsv-loop="false" data-hsv-muted="false" data-hsv-hidden-controls="false" data-hsv-full-width="false"></iframe>

 

- [Assessments: Recruiters](https://help.hackerearth.com/assessments-recruiters?hsLang=en#main-content)

    - [Getting started](https://help.hackerearth.com/assessments-recruiters?hsLang=en#getting-started)
    - [Account settings](https://help.hackerearth.com/assessments-recruiters?hsLang=en#account-settings)
    - [Admin management](https://help.hackerearth.com/assessments-recruiters?hsLang=en#admin-management)
    - [Creating tests automatically](https://help.hackerearth.com/assessments-recruiters?hsLang=en#creating-tests-automatically)
    - [Creating tests manually](https://help.hackerearth.com/assessments-recruiters?hsLang=en#creating-tests-manually)
    - [Test settings](https://help.hackerearth.com/assessments-recruiters?hsLang=en#test-settings)
    - [Sections and question pooling](https://help.hackerearth.com/assessments-recruiters?hsLang=en#sections-and-question-pooling)
    - [Libraries](https://help.hackerearth.com/assessments-recruiters?hsLang=en#libraries)
    - [Multiple Choice Questions (MCQs)](https://help.hackerearth.com/assessments-recruiters?hsLang=en#multiple-choice-questions-mcqs)
    - [Programming](https://help.hackerearth.com/assessments-recruiters?hsLang=en#programming)
    - [Project](https://help.hackerearth.com/assessments-recruiters?hsLang=en#project)
    - [SQL](https://help.hackerearth.com/assessments-recruiters?hsLang=en#sql)
    - [Data science](https://help.hackerearth.com/assessments-recruiters?hsLang=en#data-science)
    - [Machine Learning (ML)](https://help.hackerearth.com/assessments-recruiters?hsLang=en#machine-learning-ml)
    - [DevOps](https://help.hackerearth.com/assessments-recruiters?hsLang=en#devops)
    - [Python project questions](https://help.hackerearth.com/assessments-recruiters?hsLang=en#python-project-questions)
    - [Automation Testing](https://help.hackerearth.com/assessments-recruiters?hsLang=en#automation-testing)
    - [Java Project](https://help.hackerearth.com/assessments-recruiters?hsLang=en#java-project)
    - [C# project questions](https://help.hackerearth.com/assessments-recruiters?hsLang=en#c-project-questions)
    - [Subjective](https://help.hackerearth.com/assessments-recruiters?hsLang=en#subjective)
    - [Approximate](https://help.hackerearth.com/assessments-recruiters?hsLang=en#approximate)
    - [Diagram](https://help.hackerearth.com/assessments-recruiters?hsLang=en#diagram)
    - [File upload](https://help.hackerearth.com/assessments-recruiters?hsLang=en#file-upload)
    - [Invites](https://help.hackerearth.com/assessments-recruiters?hsLang=en#invites)
    - [Reports](https://help.hackerearth.com/assessments-recruiters?hsLang=en#reports)
    - [Billing](https://help.hackerearth.com/assessments-recruiters?hsLang=en#billing)
    - [HackerEarth Reports: Admins, Tests, and Teams](https://help.hackerearth.com/assessments-recruiters?hsLang=en#hackerearth-reports-admins-tests-and-teams)
    - [Technical Content Updates](https://help.hackerearth.com/assessments-recruiters?hsLang=en#technical-content-updates)
- [FaceCode](https://help.hackerearth.com/facecode?hsLang=en#main-content)

    - [FaceCode and its features](https://help.hackerearth.com/facecode?hsLang=en#facecode-and-its-features)
    - [Scheduling interviews on FaceCode](https://help.hackerearth.com/facecode?hsLang=en#scheduling-interviews-on-facecode)
- [Assessments: ATS integrations](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#main-content)

    - [Integration](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#integration)
    - [iCIMS](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#icims)
    - [Zoho Recruit](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#zoho-recruit)
    - [SmartRecruiters](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#smartrecruiters)
    - [EightFold](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#eightfold)
    - [SuccessFactors](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#successfactors)
    - [Greenhouse](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#greenhouse)
    - [Lever](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#lever)
    - [Linkedin Talent Hub](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#linkedin-talent-hub)
    - [JazzHR](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#jazzhr)
    - [Workable](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#workable)
    - [Recruiterbox - Trakstar Hire](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#recruiterbox-trakstar-hire)
    - [Jobvite](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#jobvite)
    - [Ashby](https://help.hackerearth.com/assessments-ats-integrations?hsLang=en#ashby)
- [Assessments: Product updates](https://help.hackerearth.com/assessments-product-updates?hsLang=en#main-content)

    - [Release notes: HackerEarth Assessment](https://help.hackerearth.com/assessments-product-updates?hsLang=en#release-notes-hackerearth-assessment)
    - [Root Cause Analysis (RCA)](https://help.hackerearth.com/assessments-product-updates?hsLang=en#root-cause-analysis-rca)
    - [Content updates](https://help.hackerearth.com/assessments-product-updates?hsLang=en#content-updates)
- [Assessments: Best practices](https://help.hackerearth.com/assessments-best-practices?hsLang=en#main-content)

    - [Recruit](https://help.hackerearth.com/assessments-best-practices?hsLang=en#recruit)
- [SSO](https://help.hackerearth.com/sso?hsLang=en#main-content)

    - [SSO](https://help.hackerearth.com/sso?hsLang=en#sso)
- [Upskilling](https://help.hackerearth.com/upskilling?hsLang=en#main-content)

    - [Introduction: Upskilling](https://help.hackerearth.com/upskilling?hsLang=en#introduction-upskilling)
- [Assessments: Candidates](https://help.hackerearth.com/assessments-candidates?hsLang=en#main-content)

    - [Getting started](https://help.hackerearth.com/assessments-candidates?hsLang=en#getting-started)
    - [Test environment](https://help.hackerearth.com/assessments-candidates?hsLang=en#test-environment)
    - [Question types](https://help.hackerearth.com/assessments-candidates?hsLang=en#question-types)
    - [FaceCode](https://help.hackerearth.com/assessments-candidates?hsLang=en#facecode)
    - [Feedback and queries](https://help.hackerearth.com/assessments-candidates?hsLang=en#feedback-and-queries)
- [Problem setting for HackerEarth](https://help.hackerearth.com/problem-setting-for-hackerearth?hsLang=en#main-content)

    - [Rate cards](https://help.hackerearth.com/problem-setting-for-hackerearth?hsLang=en#rate-cards)
- [Campus](https://help.hackerearth.com/campus?hsLang=en#main-content)

    - [Recruiters](https://help.hackerearth.com/campus?hsLang=en#recruiters)
    - [Recruiter FAQs](https://help.hackerearth.com/campus?hsLang=en#recruiter-faqs)
    - [Candidate FAQs](https://help.hackerearth.com/campus?hsLang=en#candidate-faqs)
- [Hackathons and Hiring Challenges](https://help.hackerearth.com/hackathons-and-hiring-challenges?hsLang=en#main-content)

    - [Hackathons](https://help.hackerearth.com/hackathons-and-hiring-challenges?hsLang=en#hackathons)
    - [Hiring challenges](https://help.hackerearth.com/hackathons-and-hiring-challenges?hsLang=en#hiring-challenges)
- [Frequently Asked Questions (FAQs)](https://help.hackerearth.com/frequently-asked-questions-faqs?hsLang=en#main-content)

    - [Assessments: Recruiters](https://help.hackerearth.com/frequently-asked-questions-faqs?hsLang=en#assessments-recruiters)
    - [GDPR compliance (Candidates)](https://help.hackerearth.com/frequently-asked-questions-faqs?hsLang=en#gdpr-compliance-candidates)
    - [GDPR compliance (Recruiters)](https://help.hackerearth.com/frequently-asked-questions-faqs?hsLang=en#gdpr-compliance-recruiters)
    - [General](https://help.hackerearth.com/frequently-asked-questions-faqs?hsLang=en#general)
    - [Assessments: Candidates](https://help.hackerearth.com/frequently-asked-questions-faqs?hsLang=en#assessments-candidates)
    - [HackerEarth Vs ChatGPT](https://help.hackerearth.com/frequently-asked-questions-faqs?hsLang=en#hackerearth-vs-chatgpt)
- [Profiles](https://help.hackerearth.com/profiles?hsLang=en#main-content)

    - [Profiles - Recruiter](https://help.hackerearth.com/profiles?hsLang=en#profiles-recruiter)
- [OnScreen](https://help.hackerearth.com/onscreen?hsLang=en#main-content)

    - [OnScreen - Interview templates](https://help.hackerearth.com/onscreen?hsLang=en#onscreen-interview-templates)
    - [OnScreen - Sending Invites](https://help.hackerearth.com/onscreen?hsLang=en#onscreen-sending-invites)
    - [OnScreen - Download reports](https://help.hackerearth.com/onscreen?hsLang=en#onscreen-download-reports)
    - [OnScreen - Interview Analytics](https://help.hackerearth.com/onscreen?hsLang=en#onscreen-interview-analytics)
    - [OnScreen - Overview](https://help.hackerearth.com/onscreen?hsLang=en#onscreen-overview)
    - [OnScreen - Interview Proctoring Settings](https://help.hackerearth.com/onscreen?hsLang=en#onscreen-interview-proctoring-settings)

[![Chill listening crop-3](https://help.hackerearth.com/hs-fs/hubfs/HE%20Logo%20for%20sig-1.png?width=120&height=24&name=HE%20Logo%20for%20sig-1.png "Chill listening crop-3")](https://www.hackerearth.com/)

Copyright © 2026, HackerEarth

```json
{
  "@context" : "https://schema.org",
  "@type" : "VideoObject",
  "caption" : {
    "@type" : "MediaObject",
    "contentUrl" : "https://help.hackerearth.com/media-transcripts/213369708096/en.vtt",
    "inLanguage" : "en",
    "name" : "en Captions"
  },
  "contentUrl" : "https://2586902.fs1.hubspotusercontent-na1.net/hubfs/2586902/video_assets/213369708096/inherited/web_optimized.mp4",
  "dateModified" : "2026-05-22T07:01:06.628Z",
  "duration" : "PT3M9S",
  "height" : 1080,
  "name" : "Programming_with_voiceover (1)",
  "thumbnailUrl" : "https://2586902.fs1.hubspotusercontent-na1.net/hubfs/2586902/Programming_with_voiceover%20(1).mp4/medium.jpg",
  "uploadDate" : "2026-05-22T07:00:53.869Z",
  "width" : 1920
}
```