Online Coding Test — free practice test
An online coding test is a remotely administered, automatically graded programming round, usually hosted on a platform such as HackerRank, Codility or HackerEarth. You solve one or more problems in a browser editor against hidden test cases within a time limit. It is the most common way companies screen developers at scale before scheduling 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 online coding test, 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
- An online coding test is a remotely administered, automatically graded programming round, usually hosted on a platform such as HackerRank, Codility or HackerEarth.
- A Online Coding Test typically covers: Problem solving, Language and IDE, Multiple-choice technical, Time management.
- 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 an online coding test covers
Problem solving
Implementing correct, efficient solutions to algorithmic problems against hidden tests.
Language and IDE
Working comfortably in the platform's browser editor and your chosen language.
Multiple-choice technical
Many tests bundle MCQs on output prediction, complexity and core CS concepts.
Time management
Allocating minutes per problem and submitting partial solutions before the timer ends.
5 sample online coding test 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. What is printed by a loop that sums integers from 1 to 100?
Answer: The sum of 1 to n is n(n+1)/2, so for n = 100 it is 100 × 101 ÷ 2 = 5050. Knowing the closed-form formula lets you verify a loop's output and solve the problem in O(1) instead of O(n).
Q2. Given an array, how do you find the maximum subarray sum?
Answer: Use Kadane's algorithm: track a running sum, resetting it to the current element whenever it goes negative, and keep the best sum seen. It finds the maximum contiguous subarray sum in a single O(n) pass.
Q3. How do you remove duplicates from an array of integers efficiently?
Answer: Insert every element into a hash set, which automatically discards duplicates, then read the set back out. This is O(n) time and O(n) space. If the array is sorted, you can instead do it in place with two pointers in O(1) extra space.
Q4. What is the difference between O(n) and O(n²) and why does it matter on large inputs?
Answer: O(n) grows in direct proportion to input size, while O(n²) grows with the square. For n = 1,000, that is 1,000 versus 1,000,000 operations — so an O(n²) solution can time out on the large hidden test cases that an O(n) one passes.
Q5. How would you count the number of vowels in a string?
Answer: Make a single pass over the string, and for each character check if it belongs to the set {a, e, i, o, u} (case-insensitive), incrementing a counter when it does. This is an O(n) one-pass solution.
How to prepare for an online coding test
- 1
Read every problem fully before coding any, then solve the easiest ones first to lock in guaranteed points.
- 2
Test your code against the sample cases the platform gives, plus your own edge cases, before submitting.
- 3
Watch the constraints: an input size up to a million signals you need an O(n) or O(n log n) solution, not O(n²).
- 4
Submit partial, working solutions — many platforms award points per passing test case, so never leave a problem blank.
- 5
Practise on the exact platform the company uses so the editor, custom-input box and submission flow feel familiar on test day.
Frequently asked questions
Everything you need to know before you create your free profile.
Create My Free Profile What is an online coding test?
+
Remote, auto-graded coding rounds run on platforms like HackerRank and Codility — what to expect and how to pass them. 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.
What is printed by a loop that sums integers from 1 to 100?
+
The sum of 1 to n is n(n+1)/2, so for n = 100 it is 100 × 101 ÷ 2 = 5050. Knowing the closed-form formula lets you verify a loop's output and solve the problem in O(1) instead of O(n).
Given an array, how do you find the maximum subarray sum?
+
Use Kadane's algorithm: track a running sum, resetting it to the current element whenever it goes negative, and keep the best sum seen. It finds the maximum contiguous subarray sum in a single O(n) pass.
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 online coding test 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 online coding test 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.