Coding Assessment — free practice test
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 · 8 marked questions on this page, no signup · 5 worked sample questions with answers · AI-scored mock tests run inside the OnJob app.
Take the practice test now
8 multiple-choice questions in the style of a real coding assessment, marked instantly on this page. Every answer comes with the working, so a wrong pick tells you which concept to revise. Nothing to install, no account, no email.
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.
- You can take a 8-question practice test on this page — it marks itself instantly and shows the working for every answer, with no signup.
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.
5 sample coding assessment questions with answers
Genuinely-correct, worked examples. Try each one before opening the answer , then go back to the marked practice test above and sit it against the clock .
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.
How to prepare for a coding assessment
- 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
Learn the core patterns (two-pointers, sliding window, BFS/DFS, dynamic programming) because most problems are variations of them.
- 3
Always clarify constraints first, then state your approach and its Big-O before you start coding.
- 4
Run through edge cases — empty input, one element, duplicates, very large input — to catch the hidden test cases that fail naive solutions.
- 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.
Frequently asked questions
Everything you need to know before you create your free profile.
Create My Free Profile What is a coding assessment?
+
Timed programming challenges that test data structures, algorithms and problem-solving — the core technical screen for developer roles. This page covers what it measures, 5 worked sample questions with answers, and 5 ways to prepare — then you can sit a timed, scored version in OnJob's free AI mock tests.
How would you check if a string is a palindrome in linear time?
+
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.
What is the time complexity of binary search and what does it require?
+
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.
Can I take the test on this page, or do I have to sign up?
+
You can take it right here. The practice test above has 8 multiple-choice questions, marks itself the moment you press "Check my score", and shows the working for every answer. No account, no email and no download. Signing up is only needed for OnJob's AI-scored mock tests, which grade written and spoken answers and can earn a verified skill badge.
Are these coding assessment questions free to practise?
+
Yes. Every sample question and answer on this page is free to read. OnJob's AI mock tests are free to start (₹0) — you get up to 3 mock tests and 1 real, badge-earning test every month, with instant scoring and feedback. Pro (₹99/month) adds more attempts and deeper analytics.
Practise your coding assessment under real conditions
The test above is self-marked and free. The next step is feedback: take a scored AI mock test on OnJob, see exactly where you stand against the role you want, then apply to AI-matched jobs in one click.