Coding & technical

Coding Assessment

A coding assessment is a timed test where you solve programming problems by writing working code that passes hidden test cases. It evaluates your data-structures and algorithms knowledge, your ability to translate a problem into correct logic, and your code's efficiency. Most software-engineering hiring uses one as the first technical filter before live interviews.

Updated 2026-06-19 · 5 worked sample questions with answers · The interactive, scored tests run inside the OnJob app.

Key takeaways

  • A coding assessment is a timed test where you solve programming problems by writing working code that passes hidden test cases.
  • A Coding Assessment typically covers: Data structures, Algorithms, Complexity analysis, Debugging and edge cases.
  • This guide includes 5 worked sample questions with answers — then rehearse under timed, scored conditions in OnJob's free mock tests.
What it measures

What a coding assessment covers

Data structures

Arrays, strings, hash maps, stacks, queues, linked lists, trees and graphs.

Algorithms

Sorting, searching, recursion, two-pointers, sliding window, greedy and dynamic programming.

Complexity analysis

Reasoning about the time and space complexity of your solution in Big-O terms.

Debugging and edge cases

Handling empty inputs, duplicates, overflow and boundary conditions so all test cases pass.

Practice questions

5 sample coding assessment questions with answers

Genuinely-correct, worked examples. Try each one before opening the answer, then practise the full set under timed, scored conditions on OnJob.

Q1.How would you check if a string is a palindrome in linear time?

Answer: Use two pointers, one at the start and one at the end. Compare the characters they point to; if any pair differs the string is not a palindrome. Move the pointers inward until they meet. This runs in O(n) time and O(1) extra space.

Q2.What is the time complexity of binary search and what does it require?

Answer: Binary search runs in O(log n) time by halving the search range each step. It requires the data to be sorted, because it compares the target to the middle element and discards half the range. On unsorted data you must sort first or use linear search.

Q3.How do you find the first non-repeating character in a string efficiently?

Answer: Make one pass to count each character's frequency in a hash map, then make a second pass and return the first character whose count is 1. This is O(n) time and O(1) extra space for a fixed alphabet, beating the O(n²) brute-force compare.

Q4.How would you detect a cycle in a linked list?

Answer: Use Floyd's tortoise-and-hare: advance a slow pointer one node and a fast pointer two nodes per step. If they ever meet, the list has a cycle; if the fast pointer reaches null, it does not. This uses O(n) time and O(1) space.

Q5.Reverse the order of words in a sentence — what is an efficient approach?

Answer: Split the sentence on spaces into an array of words, reverse the array, then join with single spaces. This is O(n) time. In place, you can reverse the whole string then reverse each word back to its original spelling.

Step by step

How to prepare for a coding assessment

  1. 1

    Build fluency in one language's standard library — its arrays, maps, sets and sorting — so you spend the clock on logic, not syntax.

  2. 2

    Learn the core patterns (two-pointers, sliding window, BFS/DFS, dynamic programming) because most problems are variations of them.

  3. 3

    Always clarify constraints first, then state your approach and its Big-O before you start coding.

  4. 4

    Run through edge cases — empty input, one element, duplicates, very large input — to catch the hidden test cases that fail naive solutions.

  5. 5

    Practise on a timer; in a real assessment, a correct O(n log n) solution submitted on time beats a perfect one left unfinished.

Free forever — no credit card

Practise your coding assessment under real conditions

Reading worked answers is step one. Take a free, scored AI mock test on OnJob, see exactly where you stand, then apply to AI-matched jobs in one click.

Create my free profile — free