Question type - Code compile

mceclip0.png

Automatically marked question.

Question where the candidates enter a code snippet that is automatically run and validated. 

Information: This question type is still in Closed Beta access and requires an active Internet connection to work. In order to use the question type it must be activated. Please contact your Inspera primary contact for more information.

 

Known limitations

  • This question type does not have offline support.
  • Service-level agreements do not include this question type.
  • There may be instances of delay or lag experienced by users.
  • In the event of code compilation failure, there will not be any automatic retries and the candidate will need to manually attempt again.
  • We do not recommend using this feature on large tests (ie. over 1000 candidates).
  • The question is not compatible with the design setting "Show warning when navigating away from pages with incomplete responses", see Design settings in question sets.

Introduction

This is available for Authors.

Code compile is a question type where the candidate can write code that is automatically run and validated. As for the question type Programming, it is written in an editing tool specially adapted for writing and displaying code. The editing tool displays line numbers and supports highlighting specific syntax for the selected programming language. For some languages, some degree of auto-correction is also supported. As an author, you can choose whether this should be available or not. 

In addition, it is possible to specify two sets of test cases: one set that candidate can use to test his or her own answer along the way, and one set used for automatically marking of the answer after the submitting. A test case consists of two parts: Input and expected output. 

It is also possible to enter a code snippet which the question is pre-populated with. 

Note: To begin creating a code compile question, you must select a programming language. This is done under Options in Specific options

When using Java, the class defined by the candidate have to be named Main for the compiler to work. This is because when compiling the file created is always named Main.java, and the class name should always match the filename.

 

In the question's edit mode, you can do the following: 

mceclip1.png

1. Replace text with desired question text.

2. Add math (LaTex), files, tables, links, PDF, images and / or audio clips to the question text.

3. Set general options for the question type. Read more about general options for questions.

4. Add marking test cases: Test cases for marking are used for automatically marking of the answers and are not visible for the candidate.

  • Input: One or more lines of text that can be read into the code answer.
  • Expected output: One or more lines of text expected as output when the code is run with the input specified above.

5. Add sample test cases: Like marking test cases (4), but this test case is visible to the candidate and can be used to test own code along the way. 

 

Specific options

Clicking on the interaction element gives you the specific options for the question type.

mceclip2.png

1. Prompt: Write an explanation text for the question. The text will appear in the workspace. "Fill in your answer here" is set by default. 

2. Options: Select programming language and insert predefined code snippet.

  • Programming language:
    The programming language must be selected for the system to know how to execute and test the code. The selected programming language is also used by the code editor to provide the proper syntax highlighting. 
  • Edit default code snippet (after choosing a programming language): 
    Code entered here is displayed in the code editor as pre-filled part of the response. This is especially useful for showing the candidate how data is read in and out of the system, and for setting a context for the question. 

3. External identifier: For information on external identifier, read general options for questions

 

Articles in this section

Was this article helpful?
1 out of 5 found this helpful