5 exercises — developers who mix up error types sound imprecise in code reviews, incident reports, and interviews. Naming the error type correctly shows technical fluency.
The four error type categories
Syntax error — violates language grammar; caught before execution (parser, compiler, IDE)
Semantic / Type error — valid grammar, wrong meaning or types; caught by type system or compiler
Runtime error — the program crashes during execution (null reference, stack overflow, divide by zero)
Logic error — runs without crashing; produces wrong output; only caught by tests or humans
0 / 26 completed
1 / 26
The terminal prints:
SyntaxError: Unexpected token '}' (line 47)
The developer has not run the program yet — this message appeared immediately when loading the file. Which error type is this?
Syntax error — a violation of the language's grammar rules, caught by the parser or compiler before the program runs. The code cannot even be parsed. Examples: missing closing bracket, unmatched quotes, misspelled keyword (funciton instead of function). Error messages often say: SyntaxError, ParseError, unexpected token. In interpreted languages (Python, JavaScript), syntax errors are caught when the interpreter first reads the file. In compiled languages (Java, C++), they are caught at compile time. Key indicator: "it failed before I ran it" → almost certainly a syntax error. The four error type categories: Syntax (grammar) → Semantic/Type (meaning/types) → Runtime (crash during execution) → Logic (wrong output, no crash).
2 / 26
A developer writes a function to calculate the area of a circle:
function circleArea(r) { return 2 * Math.PI * r; }
The code runs without any error message. However, all the results are wrong. What type of error is this?
Logic error — the code is syntactically correct, compiles/runs without crashing, but produces incorrect results because the algorithm itself is wrong. The correct formula is Math.PI * r * r (area = πr²); the code uses 2 * Math.PI * r (circumference formula). There is no error message. Logic errors are the hardest to find because the program does not crash — they are only discovered by testing against expected outputs, code review, or catching unexpected behavior in production. Examples of logic errors: off-by-one errors (< vs <=), wrong operator (&& vs ||), wrong formula, swapped conditions, missing edge case. Tool for finding them: unit tests with assertions that check the actual expected output, not just "did it crash".
3 / 26
During a production incident, an alert fires:
TypeError: Cannot read properties of null (reading 'split')
The code had been running fine for months. Today, one specific API response returned null instead of a string, and the code crashed. What type of error is this?
Runtime error — occurs during program execution, not during parsing or compilation. The code is syntactically valid and the types may look fine statically, but at runtime something unexpected happens (null reference, division by zero, stack overflow, out-of-memory, network timeout). Common runtime errors: NullPointerException / TypeError on null, ArrayIndexOutOfBoundsException, StackOverflowError (infinite recursion), IOException (file not found), UnhandledPromiseRejection. Important nuance: You could also argue there is a logic error (failure to validate the API response). In engineering practice, one bug can be described from multiple perspectives — the immediate error is a runtime crash (RuntimeError), but the root cause is a logic error (missing null check). In most technical discussions, "runtime error" refers to the category of crash-at-execution-time errors. Defensive pattern: always validate data from external sources before using it.
The IDE underlines greet(42) before you even run the file. What type of error is this?
Semantic error / Type error — the code is syntactically correct (valid expression), but it violates the meaning or type contract of the language. In TypeScript and other statically-typed languages, the type system catches these errors at compile time (or in the IDE, before you run). The error: Argument of type 'number' is not assignable to parameter of type 'string'. Semantic errors are sometimes called type errors in typed languages. They differ from syntax errors (wrong grammar) and logic errors (wrong algorithm). In dynamic languages (plain JavaScript, Python without type hints), this would instead be a runtime error — no type check happens until execution. The four categories in context:Syntax = bad grammar (parser catches it); Semantic/Type = bad types/meanings (type system or compiler catches it); Runtime = crashes during execution; Logic = wrong output, no crash.
5 / 26
A sorting function runs successfully and returns a result. The QA engineer reports: "The list is sorted, but in descending order instead of ascending order as specified in the requirements." What type of error is this?
Logic error — the most common category in real-world software bugs. The code compiles, runs, and does not crash — but it produces an output that does not match the specification. In this case, the developer likely wrote b - a instead of a - b in the comparator (or > instead of <), reversing the sort order. Logic errors are often the hardest to catch because: (1) no error message is produced, (2) the behavior looks right at a glance, (3) they require understanding the expected output to detect. How to prevent logic errors: Unit tests with explicit expected-output assertions, code reviews focused on business logic correctness, Test-Driven Development (TDD) where you write the expected output first. In interviews: "What types of bugs are hardest to find?" — logic errors, because tools (compilers, linters, type checkers) cannot detect them; only humans and tests can.
6 / 26
During a code review of a new feature for an e-commerce platform, a senior developer comments on a PR:
"I'm seeing a potential issue here with the order processing logic. The `calculateDiscount` function is calling a third-party API to determine the discount based on the customer's loyalty tier. However, it doesn't handle cases where the API returns an error – specifically, a 404 status code. This could lead to incorrect discounts being applied and frustrated customers."
This is a logical error because the code isn't handling an exceptional circumstance (an API returning an error). The developer is pointing out that the function should anticipate and gracefully deal with potential issues rather than simply assuming success. A runtime error would have occurred *during* execution if the API was unavailable, but this scenario highlights the need for proactive error handling – insufficient describes a missing feature entirely, and semantic refers to the incorrect meaning of the result.
7 / 26
During a sprint retrospective, the team discusses a recent bug. A junior developer explains: "I was debugging this issue and I kept seeing 'SemanticError: Unexpected type' in the logs. It seemed like the database wasn't returning the data in the format I expected – sometimes it had extra fields, sometimes it was missing them entirely. It wasn't a syntax or logic error, just that the *meaning* of the data changed unexpectedly.", What does this scenario illustrate?
This is an example of a *semantic* error because it highlights a difference in meaning between the code's expectations and the actual data received. The core issue isn't with the code's structure or execution, but rather that the *semantics* – the intended meaning – of the returned data differed from what the application was designed to handle. A syntax error would involve invalid SQL; runtime errors relate to issues during program execution; and an insufficient error typically points to a resource constraint.
8 / 26
During a daily standup meeting, a developer explains to the team that they've encountered an issue with their new microservice. They describe it as follows: 'I'm getting this error intermittently – `LogicError: Unexpected state transition`. It seems like sometimes the service transitions between states without any triggering event, leading to unpredictable behavior. I've added logging to try and track down the root cause, but it's proving difficult.' What type of error is the developer describing?
This scenario describes a LogicError because the problem lies not with the structure of the code itself (syntax), nor with external factors like runtime issues (runtime errors) or the meaning of data (semantic errors). Instead, it's an error in the *logic* – the service is transitioning between states unexpectedly without a valid reason, indicating a flaw in its state management and processing flow. The key here is the unexpected transition, which points to a problem with the program's control flow.
9 / 26
A developer is reviewing a PR for a new API endpoint that handles user profile updates. The PR includes the following code snippet:
function updateProfile(userId, newData) {
// ... some logic ...
if (newData.hasOwnProperty('email')) {
// Perform email update...
}
// ... more logic ...
}
During the review, a senior developer points out: 'I'm concerned about this `hasOwnProperty` check. It only validates if the `email` property exists *within* the `newData` object. It doesn't guarantee that the user actually *has* an email address associated with their profile in the database. What type of error does this represent?'
This scenario illustrates a Semantic error. It's not a syntax or logic issue because the code compiles and runs without immediate errors. Instead, the problem lies in the *meaning* – the code doesn't validate the actual existence or validity of the data being used, relying solely on its presence within the input object. This can lead to unexpected behavior down the line if the underlying database structure changes or if a user doesn't have an email address.
10 / 26
During a code review of a new feature for an e-commerce platform, a senior developer comments on a PR:
"I'm seeing a potential issue here with the order processing logic. The `calculateDiscount` function is calling a third-party API to determine the discount based on the customer's loyalty tier. However, it doesn't handle cases where the API returns an error – specifically, a 404 status code. This could lead to incorrect discounts being applied and frustrated customers."
This is a logical error because the code isn't handling an exceptional circumstance (an API returning an error). The developer is pointing out that the function should anticipate and gracefully deal with potential issues rather than simply assuming success. A runtime error would have occurred *during* execution if the API was unavailable, but this scenario highlights the need for proactive error handling – insufficient describes a missing feature entirely, and semantic refers to the incorrect meaning of the result.
11 / 26
During a sprint retrospective, the team discusses a recent bug. A junior developer explains: "I was debugging this issue and I kept seeing 'SemanticError: Unexpected type' in the logs. It seemed like the database wasn't returning the data in the format I expected – sometimes it had extra fields, sometimes it was missing them entirely. It wasn't a syntax or logic error, just that the *meaning* of the data changed unexpectedly.", What does this scenario illustrate?
This is an example of a *semantic* error because it highlights a difference in meaning between the code's expectations and the actual data received. The core issue isn't with the code's structure or execution, but rather that the *semantics* – the intended meaning – of the returned data differed from what the application was designed to handle. A syntax error would involve invalid SQL; runtime errors relate to issues during program execution; and an insufficient error typically points to a resource constraint.
12 / 26
During a daily standup meeting, a developer explains to the team that they've encountered an issue with their new microservice. They describe it as follows: 'I'm getting this error intermittently – `LogicError: Unexpected state transition`. It seems like sometimes the service transitions between states without any triggering event, leading to unpredictable behavior. I've added logging to try and track down the root cause, but it's proving difficult.' What type of error is the developer describing?
This scenario describes a LogicError because the problem lies not with the structure of the code itself (syntax), nor with external factors like runtime issues (runtime errors) or the meaning of data (semantic errors). Instead, it's an error in the *logic* – the service is transitioning between states unexpectedly without a valid reason, indicating a flaw in its state management and processing flow. The key here is the unexpected transition, which points to a problem with the program's control flow.
13 / 26
A developer is reviewing a PR for a new API endpoint that handles user profile updates. The PR includes the following code snippet:
function updateProfile(userId, newData) {
// ... some logic ...
if (newData.hasOwnProperty('email')) {
// Perform email update...
}
// ... more logic ...
}
During the review, a senior developer points out: 'I'm concerned about this `hasOwnProperty` check. It only validates if the `email` property exists *within* the `newData` object. It doesn't guarantee that the user actually *has* an email address associated with their profile in the database. What type of error does this represent?'
This scenario illustrates a Semantic error. It's not a syntax or logic issue because the code compiles and runs without immediate errors. Instead, the problem lies in the *meaning* – the code doesn't validate the actual existence or validity of the data being used, relying solely on its presence within the input object. This can lead to unexpected behavior down the line if the underlying database structure changes or if a user doesn't have an email address.
14 / 26
During a code review of a new feature for an e-commerce platform, a senior developer comments on a PR:
"I'm seeing a potential issue here with the order processing logic. The `calculateDiscount` function is calling a third-party API to determine the discount based on the customer's loyalty tier. However, it doesn't handle cases where the API returns an error – specifically, a 404 status code. This could lead to incorrect discounts being applied and frustrated customers."
This is a logical error because the code isn't handling an exceptional circumstance (an API returning an error). The developer is pointing out that the function should anticipate and gracefully deal with potential issues rather than simply assuming success. A runtime error would have occurred *during* execution if the API was unavailable, but this scenario highlights the need for proactive error handling – insufficient describes a missing feature entirely, and semantic refers to the incorrect meaning of the result.
15 / 26
During a sprint retrospective, the team discusses a recent bug. A junior developer explains: "I was debugging this issue and I kept seeing 'SemanticError: Unexpected type' in the logs. It seemed like the database wasn't returning the data in the format I expected – sometimes it had extra fields, sometimes it was missing them entirely. It wasn't a syntax or logic error, just that the *meaning* of the data changed unexpectedly.", What does this scenario illustrate?
This is an example of a *semantic* error because it highlights a difference in meaning between the code's expectations and the actual data received. The core issue isn't with the code's structure or execution, but rather that the *semantics* – the intended meaning – of the returned data differed from what the application was designed to handle. A syntax error would involve invalid SQL; runtime errors relate to issues during program execution; and an insufficient error typically points to a resource constraint.
16 / 26
During a daily standup meeting, a developer explains to the team that they've encountered an issue with their new microservice. They describe it as follows: 'I'm getting this error intermittently – `LogicError: Unexpected state transition`. It seems like sometimes the service transitions between states without any triggering event, leading to unpredictable behavior. I've added logging to try and track down the root cause, but it's proving difficult.' What type of error is the developer describing?
This scenario describes a LogicError because the problem lies not with the structure of the code itself (syntax), nor with external factors like runtime issues (runtime errors) or the meaning of data (semantic errors). Instead, it's an error in the *logic* – the service is transitioning between states unexpectedly without a valid reason, indicating a flaw in its state management and processing flow. The key here is the unexpected transition, which points to a problem with the program's control flow.
17 / 26
A developer is reviewing a PR for a new API endpoint that handles user profile updates. The PR includes the following code snippet:
function updateProfile(userId, newData) {
// ... some logic ...
if (newData.hasOwnProperty('email')) {
// Perform email update...
}
// ... more logic ...
}
During the review, a senior developer points out: 'I'm concerned about this `hasOwnProperty` check. It only validates if the `email` property exists *within* the `newData` object. It doesn't guarantee that the user actually *has* an email address associated with their profile in the database. What type of error does this represent?'
This scenario illustrates a Semantic error. It's not a syntax or logic issue because the code compiles and runs without immediate errors. Instead, the problem lies in the *meaning* – the code doesn't validate the actual existence or validity of the data being used, relying solely on its presence within the input object. This can lead to unexpected behavior down the line if the underlying database structure changes or if a user doesn't have an email address.
18 / 26
During a code review of a new feature for an e-commerce platform, a senior developer comments on a PR:
"I'm seeing a potential issue here with the order processing logic. The `calculateDiscount` function is calling a third-party API to determine the discount based on the customer's loyalty tier. However, it doesn't handle cases where the API returns an error – specifically, a 404 status code. This could lead to incorrect discounts being applied and frustrated customers."
This is a logical error because the code isn't handling an exceptional circumstance (an API returning an error). The developer is pointing out that the function should anticipate and gracefully deal with potential issues rather than simply assuming success. A runtime error would have occurred *during* execution if the API was unavailable, but this scenario highlights the need for proactive error handling – insufficient describes a missing feature entirely, and semantic refers to the incorrect meaning of the result.
19 / 26
During a sprint retrospective, the team discusses a recent bug. A junior developer explains: "I was debugging this issue and I kept seeing 'SemanticError: Unexpected type' in the logs. It seemed like the database wasn't returning the data in the format I expected – sometimes it had extra fields, sometimes it was missing them entirely. It wasn't a syntax or logic error, just that the *meaning* of the data changed unexpectedly.", What does this scenario illustrate?
This is an example of a *semantic* error because it highlights a difference in meaning between the code's expectations and the actual data received. The core issue isn't with the code's structure or execution, but rather that the *semantics* – the intended meaning – of the returned data differed from what the application was designed to handle. A syntax error would involve invalid SQL; runtime errors relate to issues during program execution; and an insufficient error typically points to a resource constraint.
20 / 26
During a daily standup meeting, a developer explains to the team that they've encountered an issue with their new microservice. They describe it as follows: 'I'm getting this error intermittently – `LogicError: Unexpected state transition`. It seems like sometimes the service transitions between states without any triggering event, leading to unpredictable behavior. I've added logging to try and track down the root cause, but it's proving difficult.' What type of error is the developer describing?
This scenario describes a LogicError because the problem lies not with the structure of the code itself (syntax), nor with external factors like runtime issues (runtime errors) or the meaning of data (semantic errors). Instead, it's an error in the *logic* – the service is transitioning between states unexpectedly without a valid reason, indicating a flaw in its state management and processing flow. The key here is the unexpected transition, which points to a problem with the program's control flow.
21 / 26
A developer is reviewing a PR for a new API endpoint that handles user profile updates. The PR includes the following code snippet:
function updateProfile(userId, newData) {
// ... some logic ...
if (newData.hasOwnProperty('email')) {
// Perform email update...
}
// ... more logic ...
}
During the review, a senior developer points out: 'I'm concerned about this `hasOwnProperty` check. It only validates if the `email` property exists *within* the `newData` object. It doesn't guarantee that the user actually *has* an email address associated with their profile in the database. What type of error does this represent?'
This scenario illustrates a Semantic error. It's not a syntax or logic issue because the code compiles and runs without immediate errors. Instead, the problem lies in the *meaning* – the code doesn't validate the actual existence or validity of the data being used, relying solely on its presence within the input object. This can lead to unexpected behavior down the line if the underlying database structure changes or if a user doesn't have an email address.
22 / 26
During a code review of a new microservice API, Alice comments on the following response from the server:
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "error",
"code": 500,
"message": "Internal Server Error"
}
Which of the following best describes the *semantic* error Alice is pointing out?
This question tests understanding of *semantic* errors. A semantic error isn't about syntax or code structure; it's about meaning – in this case, the response indicates a problem within the server-side logic, not a formatting issue. The server returned an 'error' status and a 500 code signifying an internal server issue.
23 / 26
Ben is writing a Slack message to his team explaining why the build failed. He includes the following log excerpt:
[2023-10-27T10:30:00Z] ERROR: Could not connect to database server at 192.168.1.100. Connection refused.
What type of error does Ben's message primarily highlight?
Ben's message focuses on a failure to establish a connection. This is a classic *runtime* error – it means that during program execution, something went wrong with accessing the resources required. It's distinct from syntax errors (which are about code structure) and logical errors (which are about incorrect calculations).
24 / 26
Sarah is preparing a PR description for a new feature that calculates shipping costs. She includes the following note:
'The `calculateShipping` function is intended to handle all shipping calculations based on weight and destination. However, it currently doesn't account for any potential discounts or promotions.'
Sarah's description correctly identifies a *logical* error. The code is syntactically correct (we assume), but it doesn't fulfill its intended purpose – accurately calculating shipping costs considering discounts. This highlights a missing condition in the function's logic.
25 / 26
During a standup meeting, David says: 'I'm seeing this error intermittently – `SyntaxError: Unexpected token u` – when the application attempts to parse JSON data from the API. It seems like there might be an issue with the encoding of the response.'
What type of error is David describing?
David's explanation refers to a `SyntaxError`, which is fundamentally a *semantic* error. It means the parser couldn't understand the data because it didn't conform to the expected JSON syntax – specifically, the 'u' token was unexpected. It's not about code structure or runtime execution.
26 / 26
Mark is reviewing a PR that implements a new feature for validating user input. The PR includes the following snippet:
if (userInput.length > 255) { throw new Error('Input too long'); }
What type of error does this code primarily address?
This code snippet directly addresses a *syntax* error. The `throw new Error()` statement represents invalid or unexpected code within the program's flow – it's not about the meaning of the input itself, nor does it represent a logical flaw in the validation process.
What does the "Error Types in IT English: Syntax, Logic, Runtime, Semantic — Exercises" exercise cover?Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to use with no account, sign-up, or paywall.
How many questions are in "Error Types in IT English: Syntax, Logic, Runtime, Semantic — Exercises"?
This exercise has 26 questions. Each one gives instant feedback with an explanation, so you can see exactly why an answer is right or wrong.
Do I need to create an account to save my progress?
No account is required. The progress bar and score are tracked in your browser for the current session -- the exercise is designed to be a quick, repeatable drill rather than something you resume later.
What happens if I get an answer wrong?
You'll see the correct answer highlighted immediately, along with a short explanation of why it's correct. Wrong answers aren't penalized beyond your score, and you can keep going through every question.
How is this exercise different from reading an article?
Articles explain vocabulary and concepts through prose, while exercises like this one are interactive drills -- multiple-choice questions -- that test and reinforce your recall of specific terms and phrasing.
Can I retry this exercise?
Yes -- use the "Try again" button on the results screen to reset your score and go through all the questions again from the start.
Where can I find more False Friends & Tricky Words exercises?
Browse the full False Friends & Tricky Words hub for related drills, or check the site-wide exercises index for other IT English topics.
Is this exercise suitable for beginners?
This exercise assumes basic familiarity with IT terminology. If a term feels unfamiliar, check the site Glossary for a plain-English definition before attempting the questions.
How often is new content like this published?
New exercises are added regularly across all categories, alongside new vocabulary sets and articles. Check back on the exercises hub to see what's new.