Coding Challenges
Solve 365+ interactive puzzles — predict outputs, hunt bugs, complete code & reorder logic across 19 languages.
Level 1 — Novice Coder
0 / 50 XP to next level
0/365
solved
Language
Type
Difficulty
Status
Showing 365 of 365 challenges
String Concatenation
What does this code print?
Type Coercion
What is the output?
Array Destructuring
What gets logged?
Spread Operator
What is the result?
Closure Trap
What does this log?
Off-by-One Error
This function should return the last element of an array, but it has a bug.
Equality Check Bug
This comparison always returns false even for matching values.
Async Await Missing
This function should wait for data but returns a Promise instead.
Arrow Function
Complete the arrow function that doubles a number.
Array Method Chain
Complete the chain to get names of adults.
Promise.all Pattern
Complete the code to fetch multiple URLs concurrently.
Function Declaration
Arrange these lines to create a working function.
Fetch API Pattern
Reorder to make a proper fetch call.
Event Listener Setup
Reorder to properly set up a click counter.
List Slicing
What does this print?
String Multiply
What is the output?
Dictionary Comprehension
What does this produce?
Unpacking Values
What gets printed?
Mutable Default Argument
What happens when we call this twice?
Indentation Error
This function has a bug preventing it from running.
Integer Division Bug
This should return a float average but returns an integer.
Scope Error in Loop
This should create 3 functions that print 0, 1, 2 but all print 2.
List Comprehension
Complete the list comprehension for squares.
Exception Handling
Complete the error handling pattern.
Decorator Syntax
Complete the decorator pattern.
Class Definition
Arrange to create a proper Python class.
File Reading Pattern
Reorder to read a file properly.
String Comparison
What does this print?
Array Length
What is the output?
Integer Caching
What does this comparison return?
Missing Semicolon
This code won't compile. Find the fix.
String Equality Bug
This always returns false for matching strings.
Main Method Signature
Complete the Java main method.
Enhanced For Loop
Complete the enhanced for loop.
Simple Class
Arrange to create a valid Java class.
Vector Size
What does this output?
Reference vs Copy
What is the output?
Pointer Arithmetic
What is printed?
Missing Include
This code won't compile. What's missing?
Auto Keyword
Complete using the auto keyword.
Range-Based For
Complete the range-based for loop.
Type Assertion
What does this output?
Optional Chaining
What is the output?
Enum Values
What does this output?
Missing Type Annotation
This function has a type error.
Interface Definition
Complete the interface.
Generic Function
Complete the generic function.
Type Guard Pattern
Arrange to create a proper type guard.
COUNT Function
What does this query return?
NULL Comparison
How many rows does this return if 3 users have NULL email?
GROUP BY with HAVING
What does this query do?
Wrong Wildcard
This LIKE query finds no matches.
JOIN Clause
Complete the JOIN query.
Subquery Pattern
Complete the subquery.
Complete SELECT Query
Arrange the SQL clauses in correct order.
Boolean Conversion
What is the output?
Object Keys
What does this log?
Promise.race
What gets logged?
String Methods
What is the output?
Zip Function
What does this produce?
Const Assertion
What is the type of colors?
Null Check Missing
This crashes when user is null.
Ternary Operator
What does this print?
StringBuilder
What is the output?
String Length
What does this output?
Map Insertion
What is printed?
DISTINCT Keyword
What does DISTINCT do?
GROUP BY Error
This query fails. What's wrong?
Template Literals
What is the output?
NaN Comparison
What does this log?
Generator Expression
What is the output?
F-String Format
Complete the f-string.
Stream API
Complete the stream operation.
Dangling Reference
This function returns a dangerous reference.
Window Function
Complete the window function.
Mapped Type
Complete the mapped type.
Const Reassignment
This code throws an error.
Wrong Comparison
This always returns True for None checks.
ConcurrentModificationException
This crashes when removing items while iterating.
Context Manager
Arrange the custom context manager.
Class with Constructor
Arrange the C++ class properly.
Generic Class
Arrange the generic stack class.
Complex Query
Arrange this analytics query.
Heading Tag
What does this render?
Anchor Tag
What does this create?
Input Placeholder
What attribute shows hint text inside an input?
Missing Alt Attribute
This image is missing an accessibility attribute.
Unclosed Tag
This HTML is broken. Find the bug.
DOCTYPE Declaration
Complete the HTML5 document declaration.
Semantic Section
Complete the semantic HTML for navigation.
HTML Boilerplate
Arrange the HTML document structure.
Box Model
What is the total rendered width of this element?
Specificity Winner
Which rule applies to <p class='text' id='main'>?
Flexbox Direction
Items should be in a row but they stack vertically.
Z-index Not Working
The z-index has no effect on this element.
Center with Flexbox
Complete to center content both ways.
CSS Variable
Complete the CSS custom property usage.
Media Query
Arrange the responsive CSS rule.
Variable Concatenation
What does this output?
Array Functions
What is the output?
Missing Dollar Sign
This PHP code has a syntax error.
SQL Injection Risk
This query is vulnerable to SQL injection.
Echo Shorthand
Complete the PHP opening tag with echo shorthand.
Null Coalescing
Complete the null coalescing operator.
PDO Query
Arrange the PDO prepared statement correctly.
Printf Format
What does this print?
Pointer Dereference
What is the output?
sizeof Operator
On a 64-bit system, what is the output?
Missing Return Type
This function declaration is incomplete.
Memory Leak
This code allocates memory but has a bug.
Include Header
Complete to include the standard I/O header.
Struct Definition
Complete the struct keyword.
Malloc Pattern
Arrange the correct memory allocation pattern.
useState Initial Value
What is the initial value of count?
useEffect Dependency
When does this effect run?
Missing Key Prop
This list renders but causes a console warning.
Stale Closure
The counter always shows 1, not the incremented value.
JSX Return
Complete the functional component.
useCallback Hook
Complete to memoize the handler.
Component with Hook
Arrange a functional component with state.
HTTP Status
What HTTP status code means 'Not Found'?
Middleware Order
What does next() do in Express middleware?
Missing Await
This async route doesn't wait for the database.
Express Route
Complete the GET route definition.
Environment Variable
Complete the environment variable access.
Express Setup
Arrange the Express server setup.
State Variable Visibility
Which visibility allows external access to this variable?
Modifier Effect
What does the onlyOwner modifier do?
Missing Event Emit
This transfer function updates state but breaks off-chain tracking.
Pragma Version
Complete the Solidity version pragma.
Mapping Declaration
Complete the mapping for token balances.
String Interpolation
What does this output?
LINQ Count
What does this return?
Null Reference
This throws NullReferenceException.
Async Method
Complete the async method signature.
LINQ Select
Complete the LINQ projection.
ORM Query
What does this Django ORM call return?
Model Meta Ordering
In what order are posts returned by default?
Missing Migration
Model changes aren't reflected in the database.
URL Pattern
Complete the URL pattern function.
Model ForeignKey
Complete the relationship field.
Eloquent All
What does this return?
Route Helper
What does this generate?
Mass Assignment
This creates a user but throws MassAssignmentException.
Auth Middleware
Complete the route middleware for authentication.
Eloquent Where
Complete the query to find active users.
Train-Test Split
What does test_size=0.2 mean?
Model Accuracy
What does model.score() return?
Data Leakage
This code has data leakage. Find the bug.
Pandas Read CSV
Complete the data loading function.
Model Compile
Complete the Keras model compilation.
toBe vs toEqual
Which assertion compares object structure?
Mock Return Value
What does mockFn() return?
Missing Async Await
This test always passes even when the promise rejects.
Jest Assertion
Complete the assertion to check the value.
Testing Library Query
Complete to find an element by its text.
AAA Pattern
Arrange the Arrange-Act-Assert test pattern.
Form Method
What HTTP method does this form use by default if method is omitted?
Broken Script Load
The script runs before the DOM is ready.
ARIA Role
Complete the ARIA role for a dialog.
CSS Grid Columns
How many equal columns does this create?
Animation Not Running
This animation is defined but never plays.
Pseudo-element
Complete the pseudo-element for content before an element.
Strict Comparison
What is the result of this comparison?
Session Not Started
Session data is not saved.
Array Map
Complete the array_map call to double values.
String vs Char
What is the difference between these two declarations?
Buffer Overflow
This code has a dangerous security vulnerability.
Function Pointer
Complete the function pointer declaration.
useMemo Return
When does useMemo recompute?
Infinite Loop
This component re-renders infinitely.
Context Consumer
Complete the hook to consume context.
Event Loop Priority
In what order do these execute?
Unhandled Rejection
This promise error crashes the process.
Mongoose Schema
Complete the Mongoose model export.
msg.value Usage
What does msg.value contain in a payable function?
Reentrancy Vulnerability
This withdraw function is vulnerable to reentrancy.
ERC-20 Transfer
Arrange the safe ERC-20 transfer logic.
Value vs Reference
What is x after this code?
Deadlock Risk
This async code can deadlock in ASP.NET.
LINQ Pipeline
Arrange the LINQ query to get top 3 names.
get_object_or_404
What happens when the object isn't found?
N+1 Query
This view runs 1 + N queries for N posts.
Class-Based View
Arrange the Django class-based view.
Eager Loading
What problem does with() solve?
CSRF Missing
This form submits but gets a 419 error.
API Resource Route
Arrange creating and responding to a resource.
Overfitting Sign
What does this pattern indicate?
Wrong Loss Function
This binary classifier uses the wrong loss.
ML Pipeline
Arrange the standard ML workflow.
beforeEach Purpose
What is beforeEach used for?
Test Pollution
Tests pass individually but fail when run together.
Mock Setup
Arrange Jest mock setup correctly.
Class Inheritance MRO
What does this print?
Default int Value
What is the default value of an int field in a class?
Static Method Call
What does this print?
Autoboxing Trap
What does this print?
NullPointerException
This code crashes with NPE.
Checked Exception Unhandled
This code won't compile.
Optional Chaining
Complete to safely get value from Optional.
Lambda Comparator
Complete the lambda to sort by name length.
Try-With-Resources
Arrange the try-with-resources pattern.
Builder Pattern
Arrange the builder pattern call correctly.
ORDER BY Default
In what order does this return results?
LEFT JOIN Nulls
What happens to customers with no orders in this query?
CTE Result
What does this CTE query return?
UPDATE Without WHERE
This UPDATE is dangerous. What's wrong?
Aggregate Without GROUP BY
This query fails when mixing aggregate and non-aggregate columns.
NULL Check
Complete to find rows where email is missing.
CASE Expression
Complete the CASE expression.
ROW_NUMBER Window
Complete the window function to number rows per department.
INSERT Statement
Arrange a valid INSERT statement.
Transaction Block
Arrange a safe database transaction.
Button Type Default
What type does a button have by default inside a form?
Table Cell Span
How many columns does this cell occupy?
Meta Viewport
What does this meta tag do on mobile?
Label Not Linked
Clicking the label doesn't focus the input.
Broken Image Path
The image shows a broken icon.
Duplicate IDs
JavaScript only finds one of these elements.
Checkbox Input
Complete the checkbox input type.
Data Attribute
Complete the custom data attribute.
HTML Table Structure
Arrange the correct table structure.
Open Graph Meta
Complete the Open Graph property for the page title.
Union Type Check
What is the type of x?
Partial Utility Type
What does Partial<User> do?
Discriminated Union
How does TypeScript narrow this union?
Type Mismatch
TypeScript reports an error on this assignment.
Index Signature Error
This object access gives a TypeScript error.
Missing Return in Union
TypeScript reports not all code paths return a value.
Pick Utility Type
Complete to pick only name and email from User.
Infer in Conditional
Complete the conditional type to extract the return type.
Zod Schema Validation
Arrange the Zod schema parse pattern.
Readonly Array
Complete the type for an immutable string array.
Character Arithmetic
What does this print?
Array Decay
What does sizeof print for the pointer?
Bitwise AND
What is the result?
Uninitialized Variable
This code has undefined behavior.
Off-by-One in Loop
This loop writes past the array boundary.
Double Free
This code causes heap corruption.
Scanf Input
Complete the scanf format for reading an integer.
Typedef Struct
Complete the typedef to create a Point type.
Linked List Node
Arrange the linked list node creation.
File Write Pattern
Arrange to safely write to a file.
Inheritance
Does the <p> inherit the parent color?
Position Absolute
What is this element positioned relative to?
Stacking Context
Which element appears on top?
Width on Inline Element
The width has no effect on this element.
Margin Collapsing
Two vertical margins of 20px overlap giving 20px, not 40px.
Subgrid Missing
Grid items don't align to parent grid columns.
Font Import
Complete to import a Google Font.
Transition Property
Complete to animate opacity on hover.
Custom Property Usage
Arrange the CSS custom property declaration and usage.
Calc Function
Complete to make an element fill remaining width.
String Functions
What does this return?
Type Coercion
What does this output?
Static Property
What does this print?
Undefined Index
This causes a PHP notice/warning.
Wrong String Comparison
This comparison gives unexpected results.
Missing Exception Handling
Database errors crash the application.
Array Push
Complete to add an element to an array.
Heredoc Syntax
Complete the heredoc opening delimiter.
OOP Constructor
Arrange the PHP class with constructor.
Trait Usage
Arrange trait declaration and usage correctly.
Reference vs Copy
What does this print?
Vector Size vs Capacity
After push_back, what is v.size()?
Move Semantics
After std::move, what is the state of s1?
Missing endl
Output doesn't appear immediately in some terminals.
Raw Pointer Memory Leak
This code leaks memory.
Slicing Problem
Derived class data is lost during assignment.
Range-based For
Complete the range-based for loop.
Smart Pointer
Complete the smart pointer type for exclusive ownership.
Lambda Capture
Arrange a lambda that captures and modifies a variable.
RAII File Handle
Arrange the RAII file handling pattern.
Props Access
What does this component render?
Conditional Rendering
What renders when isLoggedIn is false?
useReducer Action
What is the state after dispatching this action?
State Mutation
The UI doesn't update when the array changes.
useEffect Cleanup
This component leaks a timer when unmounted.
Event Handler
Complete the click event handler.
Default Export
Complete the default export of a component.
useRef Access
Complete to access the DOM input element.
Custom Hook
Arrange a custom hook that fetches data.
Context Provider
Arrange Context API correctly.
require vs import
Which syntax is used in CommonJS modules?
Process Exit Code
What does process.exit(1) indicate?
Readable Stream
How is data read from a readable stream?
Sync in Async Context
This blocks the event loop and degrades performance.
Missing Error Handler
Express doesn't return errors to clients.
CORS Not Set
Browser blocks requests from a different origin.
Path Join
Complete to safely join file paths.
JWT Sign
Complete to sign a JSON Web Token.
Cluster Fork
Complete to spawn a worker process per CPU.
Middleware Chain
Arrange Express middleware in the correct order.
Async File Read
Arrange the async file reading pattern correctly.
Test File Naming
Which file naming convention does Jest auto-discover?
toHaveBeenCalledWith
What does this assertion check?
Coverage Metric
What does 80% branch coverage mean?
Asserting Wrong Thing
This test always passes even with a bug.
Snapshot Outdated
Tests fail after a legitimate UI change.
Integration Test Flakiness
Tests randomly fail due to timing issues.
Spy on Method
Complete to spy on the console.log method.
Async Test
Complete the async test correctly.
Custom Matcher
Complete to extend Jest with a custom matcher.
Given-When-Then
Arrange the BDD-style test structure.
E2E Test Flow
Arrange a Playwright/Cypress E2E test.
Supervised vs Unsupervised
Which is supervised learning?
Activation Function
What does ReLU return for input -3?
Confusion Matrix TP
In a confusion matrix, what is a True Positive?
Feature Not Scaled
The model performs poorly despite good data.
Missing Feature Engineering
Model ignores the date column.
Class Imbalance Ignored
Model predicts majority class for almost all inputs.
Predict Method
Complete the prediction call.
DataFrame Shape
Complete to get the number of rows and columns.
Cross Validation
Complete the k-fold cross validation call.
Data Preprocessing
Arrange the correct data preprocessing order.
Neural Network Layers
Arrange Keras model layer order for image classification.
Gradient Descent Direction
Which direction does gradient descent move?
Nullable Type
What does int? mean in C#?
String Comparison
What does this return?
Record Equality
What does this print?
Unhandled Exception
This crashes on invalid input.
LINQ Deferred Execution
The query result changes unexpectedly after modification.
Interface Not Implemented
This code won't compile.
String Interpolation
Complete the string interpolation.
Null Conditional Operator
Complete to safely access a property.
Dependency Injection
Complete the constructor injection registration.
LINQ Query Chain
Arrange the LINQ query correctly.
Entity Framework Query
Arrange the EF Core query pattern.
Pattern Matching Switch
What does this print when shape is a Circle?
Visibility Specifiers
Which visibility allows only the contract itself to call the function?
Mapping Default
What does a mapping return for a key that was never set?
msg.sender in Constructor
Who is msg.sender when a contract is deployed?
Integer Overflow (old)
In Solidity <0.8.0, what is the risk here?
Missing payable Modifier
This function can't receive ETH.
Reentrancy Vulnerability
This withdraw function is vulnerable to reentrancy.
Event Declaration
Complete the event declaration.
Require Message
Complete the require with an error message.
Custom Modifier
Complete the modifier to restrict access to the owner.
ERC-20 Transfer
Arrange the ERC-20 transfer logic correctly.
Contract Deployment Order
Arrange a proxy pattern deployment.
view vs pure
What is the difference between view and pure functions?
ORM Filter
What does this queryset return?
URL Namespace
What does this URL tag resolve to?
select_related Purpose
Why use select_related() here?
Missing CSRF Token
POST form returns 403 Forbidden.
Missing Migration
New model field doesn't appear in the database.
N+1 Query Problem
This view makes too many database queries.
Template Variable
Complete to render a variable in a Django template.
Model String Representation
Complete to give the model a human-readable name.
Class-Based View
Complete to create a list view for the Post model.
Form Processing View
Arrange the form processing logic correctly.
Custom Middleware
Arrange the middleware process_request pattern.
get_or_create Return
What does get_or_create return?
Eloquent All
What does this return?
Blade Directive
What does @auth output?
Route Model Binding
What is $post in this route?
Missing CSRF in Form
POST form returns 419 error.
Mass Assignment Blocked
Model fails to save with fillable error.
N+1 in Blade
This loads too many queries in the loop.
Route GET
Complete the basic GET route definition.
Eloquent Where
Complete the query to find active users.
Dispatch Job
Complete to dispatch a queued job.
API Resource Route
Arrange to register a full REST resource.
Service Provider Boot
Arrange the service provider structure.
firstOrFail vs find
What happens when firstOrFail() finds no record?
Keep Sharpening Your Skills
365+ challenges across 19 languages. Earn XP, build streaks, and level up.