Newton Institute of Technology Logo
Newton Institute of Technology Building Your Dream Career

What Happens in a Coding Interview? Beginner’s Guide

ICT Career Guide Beginners

What Happens in a Coding Interview? A Beginner’s Guide

From the first question to the final test

Step inside a real-world coding interview simulation. See what the interviewer asks, follow a JavaScript challenge, correct a mistake and test the solution.

A practical interview journey

Understand, plan, code, test and explain each decision.

Published byNewton Institute of Technology

LevelBeginner-friendly

Inside the guide3 realistic examples · practical JavaScript

Updated11 Nov 2026

Quick answer

What actually happens in a coding interview?

An employer gives you a programming problem and assesses how you solve it. In a live session, you may write code while talking to an interviewer, run tests, correct mistakes and explain your decisions. In an independent test, you may submit code for automated evaluation. The exact tools and questions depend on the role. [1] [2]

The practical sequence: understand → clarify → plan → code → test → explain.

Before your first session

What will you see on the coding interview screen?

Imagine opening an invitation link for a junior developer internship. An interviewer greets you and displays a short programming question. A typical browser-based coding environment may give you a question panel, editor, Run button, and output or test-results panel. Some assessments show a timer; some require submission without a live interviewer. [3]

Screen areaWhat it does
Question panelStates the task, inputs and expected result
Code editorWhere you type a program
Run / test controlsExecute code and inspect output where the platform supports it
Output panelDisplays returned values or errors
Timer / submitAppears when the assessment uses these features

On a phone, swipe horizontally inside the table to view all columns.

For example, writing console.log(5 + 3) in JavaScript and running it produces 8. Available controls vary across interview platforms. During live coding, the interviewer may see your editor as you work; in an independent assessment, your submission may be evaluated later.

Understand the format

What are the main types of coding interviews?

The word “coding interview” can mean several different practical assessments. The invitation and job description tell you which form to expect. [1] [4]

FormatTypical activityBeginner example
Live codingWork in a shared editor while explaining choicesAdd even numbers in an array
Timed online assessmentSolve independently and submit within a time windowCount matching words
DebuggingFind and correct a fault in existing codeRepair a webpage button
Pair programmingWork together on a small featureAdd search to a product list
Take-home assignmentBuild and submit the requested workMake a stock-status function

On a phone, swipe horizontally inside the table to view all columns.

A coding interview is one possible part of a broader developer interview. Other stages may cover your projects, teamwork, technical knowledge or experience.

Follow a realistic session

A 45-minute coding interview: what happens and when

Amina is a fictional beginner who has applied for a junior developer internship. This timeline illustrates a live assessment, not a fixed requirement for every company.

0–5 minutes · Introductions

Amina briefly describes a school revision quiz she built in JavaScript.

5–10 minutes · Clarify

The interviewer shares a problem; Amina checks assumptions and expected outputs.

10–15 minutes · Plan

She explains her intended solution in ordinary language.

15–35 minutes · Implement

She writes code, talks through important choices and corrects a mistake.

35–42 minutes · Test

She checks an empty array, negative numbers and other cases.

42–45 minutes · Discuss

She explains efficiency and asks what happens next.

Timing varies

University interview-preparation guidance describes common live sessions around 45–60 minutes, but always follow your own invitation. [1]

The central practical example

Full mock interview: solve an even-number problem

Interviewer: “Write a JavaScript function that receives an array of integers and returns the sum of all even numbers.”

Example inputExpected outputWhy
[4, 7, 2, 9]64 + 2 = 6
[]0No numbers to add
[-4, 5, 8]4−4 + 8 = 4

On a phone, swipe horizontally inside the table to view all columns.

An array holds several values. An even integer divides by two with a remainder of zero. This example starts with basic JavaScript and builds toward testing and efficiency.

Ask questions

Amina asks: “If the list is empty, should I return zero? Can the integers be negative?” The interviewer confirms both.

Explain the plan

Start at zero; examine each number; add it when even; return the sum.

Write the first version

Amina writes a loop but accidentally replaces the total instead of adding.

First attempt — deliberately incorrect:

interview-solution.js
function sumEven(numbers) {  let total = 0;  for (const number of numbers) {    if (number % 2 === 0) {      total = number;    }  }  return total;}console.log(sumEven([4, 7, 2, 9]));

The program runs but prints 2 instead of 6. This is a logic error: the instructions execute, but the calculation is wrong.

NumberEven?Incorrect totalCorrect total
Start—00
4Yes44
7No44
2Yes26
9No26

On a phone, swipe horizontally inside the table to view all columns.

Interviewer: “What did you expect?” Amina: “Six. I can see I am replacing the running total each time instead of adding to it.”

She changes total = number to total += number.

Corrected JavaScript:

interview-solution.js
function sumEven(numbers) {  let total = 0;  for (const number of numbers) {    if (number % 2 === 0) {      total += number;    }  }  return total;}console.log(sumEven([4, 7, 2, 9])); // 6

The % remainder operator checks divisibility. For an integer, number % 2 === 0 is true when it is even. The += operator adds the current number to the accumulated total. [5]

Amina then checks more than the sample input:

Test inputExpected resultWhat it checks
[]0Empty array
[1, 3, 5]0All odd
[-4, 5, 8]4Negative and positive
[0, 0]0Zeros
[-6, -2]−8Negative even values
[12]12One element

On a phone, swipe horizontally inside the table to view all columns.

Interviewer: “What if the list has 1,000 numbers?” Amina: “My loop examines each number once, so it checks 1,000 values. Its running time is O(n) for n elements, and it uses constant extra working memory, O(1).”

What the interviewer learned

Amina clarified the requirements, found an actual wrong answer, traced the error, fixed it and tested edge cases. A correct answer is important, but her explanation also shows how she works through problems.

Understand errors

What happens when your coding test fails?

A failing test does not always mean the program has the same kind of error. The message and behaviour provide clues.

FailureWhat you seeUseful next step
Syntax errorThe code cannot be parsedInspect brackets, quotes and syntax
Runtime errorIt starts but fails during executionCheck missing or invalid values
Wrong answerIt runs but returns the wrong resultTrace calculations and conditions
Edge-case failureSample passes, unusual input failsCheck empty, negative or boundary inputs
Slow executionLarge input takes too longReview repeated work and algorithm choice

On a phone, swipe horizontally inside the table to view all columns.

For an unknown failed test, revisit the requirement, reproduce the failure if possible, inspect likely boundary cases, make one reasoned correction and rerun available tests. Some platforms do not reveal every hidden test input.

A failed test can be informative

Do not randomly change code until the displayed result turns green. Explain what you expected, what happened and what you will investigate.

Practical example two

Debug a school webpage: why does the button do nothing?

A fictional school webpage should display Total Marks: 90 when a user clicks a button. The two marks are 65 and 25. The HTML contains:

school-marks.html
<button id=”showMarks”>Show Total Marks</button><p id=”result”></p>

The JavaScript below is run after those HTML elements have loaded, but it contains a mistake:

interview-solution.js
document.getElementById(“showMarks”)  .addEventListener(“click”, function () {    const total = 65 + 25;    document.getElementById(“results”)      .textContent = “Total Marks: ” + total;  });

The paragraph is named result, but JavaScript looks for results. When no matching element exists, getElementById() returns null. Setting textContent on null causes an error. [6]

Observe the problem

The click does not display a total. Check the browser console if available.

Find the mismatch

Compare the HTML ID result with the JavaScript string results.

Correct and test

Change JavaScript to look for result; click again and confirm Total Marks: 90.

interview-solution.js
document.getElementById(“result”).textContent =  “Total Marks: ” + total;

What to say: “The arithmetic was correct, but the element lookup used a different ID. I changed the identifier and verified that the button displays the expected total.”

Practical example three

Build a small shop stock-status function

A small shop needs a status label for each product. The task says: 0 = OUT OF STOCK; 1–4 = LOW STOCK; 5 or more = IN STOCK; invalid or negative quantities must be rejected.

QuantityExpected status
0OUT OF STOCK
4LOW STOCK
5IN STOCK
20IN STOCK
−1INVALID QUANTITY
2.5INVALID QUANTITY

On a phone, swipe horizontally inside the table to view all columns.

interview-solution.js
function stockStatus(quantity) {  if (!Number.isInteger(quantity) || quantity < 0) {    return “INVALID QUANTITY”;  }  if (quantity === 0) return “OUT OF STOCK”;  if (quantity < 5) return “LOW STOCK”;  return “IN STOCK”;}console.log(stockStatus(4)); // LOW STOCKconsole.log(stockStatus(5)); // IN STOCKconsole.log(stockStatus(-1)); // INVALID QUANTITY

The first condition rejects quantities that are not non-negative integers. Number.isInteger() checks whether its argument is a JavaScript integer value. [7]

The important boundary is between 4 and 5. An interviewer may ask why input validation comes first or how you tested the boundary.

For a take-home version

Complete the requested logic first. Then supply the required source file, run instructions, tests and short explanation. Confirm the deadline and the rules for documentation or AI assistance before beginning. [3]

What matters to the assessor

What do interviewers evaluate?

Assessment criteria differ across employers, but official technical-interview guidance commonly emphasises problem-solving, coding and communication. [2] [4]

AreaWhat it revealsExample
UnderstandingYou interpret the requirementRestate input and expected output
CorrectnessThe program solves the specified taskPass normal and boundary tests
ReasoningYou choose a workable approachExplain the loop before coding
DebuggingYou can investigate errorsFind why a total was overwritten
CommunicationYou can explain your choicesDescribe what you changed and why
EfficiencyYou notice performance trade-offsExplain one pass through n values

On a phone, swipe horizontally inside the table to view all columns.

One passing output does not guarantee a passing assessment. Your code might miss conditions or fail other tests. Conversely, a mistake that you identify and fix can demonstrate useful debugging ability. What the employer ultimately requires depends on the role.

When you need another approach

What should you say when you get stuck?

Suppose you are asked to return all numbers greater than ten from [5, 12, 8, 20]. The expected result is [12, 20]. You understand the comparison but cannot immediately write the solution.

Restate the task

“I need to examine each number and keep values greater than ten.”

Break it down

Loop through the list, compare each value, store matches and return them.

Describe the difficulty

“I understand the condition but need to decide how to collect the matching values.”

If the interviewer allows clarification, ask a specific question or request a hint when necessary. Then implement and test the part you understand. Explain unfinished work accurately rather than claiming unverified tests passed.

After the exercise

What happens at the end of a coding interview?

The interviewer may ask you to summarise the solution, discuss tests, explain an alternative approach or describe what you would improve. You may then have an opportunity to ask about the team or recruitment process.

Possible next stages include another technical assessment, a project discussion, a team interview or a hiring decision. Some employers provide detailed feedback; others do not. Follow the recruiter’s instructions rather than assuming there is one standard timeline.

Five-minute practice

Try your own mini coding interview

A fictional stationery shop sells notebooks for KSh 80 each. Write a JavaScript function that takes the number of notebooks and returns the total price. For this exercise, assume the quantity is a valid non-negative whole number.

NotebooksExpected total
0KSh 0
1KSh 80
3KSh 240
5KSh 400

On a phone, swipe horizontally inside the table to view all columns.

Understand

Say what the function receives and returns.

Plan

Total price = quantity × 80.

Code, test, explain

Run at least two inputs, then explain the multiplication.

Example solution — read only after you try:

interview-solution.js
function notebookTotal(quantity) {  return quantity * 80;}console.log(notebookTotal(3)); // 240

For an extra challenge, extend the function to reject negative quantities, decimals and non-numeric inputs.

Common questions

Frequently asked questions about coding interviews

How long does a coding interview last?

It depends on the format. University guidance describes many live coding sessions around 45–60 minutes, and some independent timed assessments around 30–60 minutes. The invitation is the authority for your particular session. [1]

Will the interviewer watch me type?

During live coding, the interviewer may observe a shared editor or screen. In an independent assessment, your work may be evaluated without a person watching live.

Do I need to memorise code?

Understand the core syntax of your chosen language and practise solving problems without copying solutions. Whether reference material is allowed depends on the assessment rules.

Can I use ChatGPT or another AI assistant?

Only when permitted. Some platforms can provide AI features, but the employer or interviewer controls what use is acceptable. Follow the stated rules. [3]

What if I cannot finish?

Explain what you completed, which tests you ran and where you are stuck. Employers decide outcomes using their own criteria; neither an incomplete answer nor fluent explanations guarantee a result.

Can I attend without previous employment?

Yes, employers may interview students and beginners for suitable internships and entry-level positions. Be ready to explain projects you personally completed.

What if my internet disconnects?

Contact the interviewer or recruiter through their specified channel. Do not assume the assessment automatically pauses or resets.

Can running code still be wrong?

Yes. A program can execute without an error but return incorrect results or miss required cases. Test both normal and boundary inputs.

Key lesson

What should you remember from your first coding interview?

You may be asked to write code, debug an application, explain a technical decision or complete a short project. The central habit is the same: understand → clarify → plan → code → test → explain.

In this guide, the first solution produced a wrong result, the school webpage used a mismatched ID, and the shop task required careful boundary testing. Each example showed how a candidate can turn an unfamiliar challenge into smaller, testable steps.

When you have working programming projects, see NIT’s coding portfolio guide for ways to present and explain your own work.

Learn by building real programs

Register for Full-Stack Software Development at Newton Institute of Technology

Learn frontend and backend programming, databases, APIs, debugging and practical software projects. NIT’s course includes 8 months of training followed by at least 3 months of industrial attachment.

Training8 months + 3+ months attachment

Course feeKSh 90,000

Call / WhatsApp+254 713 584 858

Emailinfo@niteducation.com

CampusMigori Town, Kenya

Starting levelBeginners welcome

Sources and references

Candidate and interviewer conversations are original fictional teaching examples. Technical and interview claims are supported by the following resources.

  1. Princeton University, Center for Career Development. Coding Interview Preparation. Interview formats, typical timings and how candidates work through problems. Source.
  2. Microsoft Careers. Technical Interviewing. Technical problem-solving, coding, testing and communication. Source.
  3. CoderPad. Interview Preparation Guide for Candidates. Candidate editor, live coding, assignments and AI assistance permissions. Source.
  4. Amazon Jobs. Software Development Interview Topics. Developer interview subjects and assessment formats. Source.
  5. MDN Web Docs. Remainder (%) operator. Official JavaScript technical explanation. Source.
  6. MDN Web Docs. Document.getElementById(). What happens when a matching element does not exist. Source.
  7. MDN Web Docs. Number.isInteger(). JavaScript integer validation behaviour. Source.

Prepared by Newton Institute of Technology Editorial Team · Editorial date: 11 November 2026.