How to Insert Coding Test Cases

Test cases in coding questions are used to automatically evaluate candidate solutions. TestTrick supports multiple input formats depending on the parameter type, including primitive types, 1D arrays, and 2D arrays.


Primitive Data Types


Integer

  • Whole numbers.

    Example

10  

String

  • Text values.
  • Enter without quotes.

    Example

hello  

Double

  • Decimal or floating-point numbers.

    Example

3.14  

Multiple Parameters (New Line Separated)


Used when the function expects multiple individual parameters.

Example

1
2 
3 
4 
5  

Each value must be on a new line.


Integer / String Array (1D Array)

For 1D arrays, use the following format:

  1. First line → array size
  2. Remaining lines → array values

Example

3
100 
200 
300  

Represents:

arr = [100, 200, 300]  

Integer / String 2D Array


For 2D arrays, follow this format:

  1. First line → number of rows
  2. Second line → number of columns
  3. Remaining lines → values row-wise (each value on a new line)

Example

3
2 
1 2 
2 3 
5 6  

Represents:

arr = [[1, 2],       [2, 3],       [5, 6]]  

Parameter Types Supported


TestTrick supports the following parameter types in coding test cases:

  • Integer
  • String
  • Double
  • Integer Array
  • String Array
  • Integer 2D Array
  • String 2D Array

Each parameter must follow the exact input format for proper evaluation.


Important Notes


  • Inputs must match the parameter type and format defined in the question.
  • Test cases are matched exactly against expected outputs.
  • Test case weightage contributes to the total score unless the question is unscorable.


Best Practices


  • Mention input format expectations in the question description.
  • Use multiple test cases to validate edge conditions.
  • Ensure consistency across arrays and 2D arrays for correct evaluation.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.