Skip to main content
🧠 Interactive Practice

Coding Challenges

Solve 83+ interactive puzzles — predict outputs, hunt bugs, complete code & reorder logic across 6 languages.

0

Total XP

🏆

Lv 1

Level

🏆
🔥

0

Day Streak

🔥

0/83

Solved

Language

Type

Difficulty

Status

83 challenges available

🔮 Output PredictionJS JavaScript
Easy

String Concatenation

What does this code print?

console.log("Hello" + " " + "World");
⚡ +10 XPSolve
🔮 Output PredictionJS JavaScript
Easy

Type Coercion

What is the output?

console.log(5 + "3");
⚡ +10 XPSolve
🔮 Output PredictionJS JavaScript
Medium

Array Destructuring

What gets logged?

const [a, , b] = [1, 2, 3, 4]; console.log(a, b);
⚡ +20 XPSolve
🔮 Output PredictionJS JavaScript
Medium

Spread Operator

What is the result?

const a = [1, 2]; const b = [0, ...a, 3]; console.log(b.length);
⚡ +20 XPSolve
🔮 Output PredictionJS JavaScript
Hard

Closure Trap

What does this log?

for (var i = 0; i < 3; i++) { setTimeout(() => console.log(i), 0); } // Output after all
⚡ +35 XPSolve
🐛 Bug HuntJS JavaScript
Easy

Off-by-One Error

This function should return the last element of an array, but it has a bug.

function lastElement(arr) { return arr[arr.length]; }
⚡ +10 XPSolve
🐛 Bug HuntJS JavaScript
Medium

Equality Check Bug

This comparison always returns false even for matching values.

function isEqual(a, b) { if (a = b) { return true; } return false; }
⚡ +20 XPSolve
🐛 Bug HuntJS JavaScript
Hard

Async Await Missing

This function should wait for data but returns a Promise instead.

async function getData(url) { const response = fetch(url); const data = response.json(
⚡ +35 XPSolve
✏️ Code CompletionJS JavaScript
Easy

Arrow Function

Complete the arrow function that doubles a number.

const double = (n) ___ n * 2;
⚡ +10 XPSolve
✏️ Code CompletionJS JavaScript
Medium

Array Method Chain

Complete the chain to get names of adults.

const adults = people .filter(p => p.age >= 18) .___((p) => p.name);
⚡ +20 XPSolve
✏️ Code CompletionJS JavaScript
Hard

Promise.all Pattern

Complete the code to fetch multiple URLs concurrently.

const results = await Promise.___([ fetch("/api/users"), fetch("/api/posts"), fetch(
⚡ +35 XPSolve
🧩 Code ReorderJS JavaScript
Easy

Function Declaration

Arrange these lines to create a working function.

return a + b; function add(a, b) { }
⚡ +10 XPSolve
🧩 Code ReorderJS JavaScript
Medium

Fetch API Pattern

Reorder to make a proper fetch call.

const data = await response.json(); const response = await fetch(url); return data; async
⚡ +20 XPSolve
🧩 Code ReorderJS JavaScript
Hard

Event Listener Setup

Reorder to properly set up a click counter.

button.addEventListener("click", handleClick); let count = 0; const button = document.getE
⚡ +35 XPSolve
🔮 Output PredictionPY Python
Easy

List Slicing

What does this print?

nums = [10, 20, 30, 40, 50] print(nums[1:3])
⚡ +10 XPSolve
🔮 Output PredictionPY Python
Easy

String Multiply

What is the output?

print("ab" * 3)
⚡ +10 XPSolve
🔮 Output PredictionPY Python
Medium

Dictionary Comprehension

What does this produce?

result = {x: x**2 for x in range(4)} print(result)
⚡ +20 XPSolve
🔮 Output PredictionPY Python
Medium

Unpacking Values

What gets printed?

a, *b, c = [1, 2, 3, 4, 5] print(b)
⚡ +20 XPSolve
🔮 Output PredictionPY Python
Hard

Mutable Default Argument

What happens when we call this twice?

def add_item(item, lst=[]): lst.append(item) return lst print(add_item("a")) prin
⚡ +35 XPSolve
🐛 Bug HuntPY Python
Easy

Indentation Error

This function has a bug preventing it from running.

def greet(name): return f"Hello, {name}"
⚡ +10 XPSolve
🐛 Bug HuntPY Python
Medium

Integer Division Bug

This should return a float average but returns an integer.

def average(numbers): total = sum(numbers) return total // len(numbers)
⚡ +20 XPSolve
🐛 Bug HuntPY Python
Hard

Scope Error in Loop

This should create 3 functions that print 0, 1, 2 but all print 2.

functions = [] for i in range(3): functions.append(lambda: print(i)) for f in functio
⚡ +35 XPSolve
✏️ Code CompletionPY Python
Easy

List Comprehension

Complete the list comprehension for squares.

squares = [x**2 ___ x in range(5)]
⚡ +10 XPSolve
✏️ Code CompletionPY Python
Medium

Exception Handling

Complete the error handling pattern.

try: result = 10 / 0 ___ ZeroDivisionError: print("Cannot divide by zero")
⚡ +20 XPSolve
✏️ Code CompletionPY Python
Hard

Decorator Syntax

Complete the decorator pattern.

def timer(func): def wrapper(*args, **kwargs): start = time.time() res
⚡ +35 XPSolve
🧩 Code ReorderPY Python
Easy

Class Definition

Arrange to create a proper Python class.

self.name = name def __init__(self, name): class Dog: return f"{self.name} says Wo
⚡ +10 XPSolve
🧩 Code ReorderPY Python
Medium

File Reading Pattern

Reorder to read a file properly.

for line in file: with open("data.txt", "r") as file: print(line.strip())
⚡ +20 XPSolve
🔮 Output PredictionJV Java
Easy

String Comparison

What does this print?

String a = "hello"; String b = "hello"; System.out.println(a == b);
⚡ +10 XPSolve
🔮 Output PredictionJV Java
Medium

Array Length

What is the output?

int[] arr = {10, 20, 30}; System.out.println(arr.length);
⚡ +20 XPSolve
🔮 Output PredictionJV Java
Hard

Integer Caching

What does this comparison return?

Integer a = 127; Integer b = 127; Integer c = 128; Integer d = 128; System.out.println(a =
⚡ +35 XPSolve
🐛 Bug HuntJV Java
Easy

Missing Semicolon

This code won't compile. Find the fix.

int sum = 0; for (int i = 0; i < 10; i++) { sum += i } System.out.println(sum);
⚡ +10 XPSolve
🐛 Bug HuntJV Java
Medium

String Equality Bug

This always returns false for matching strings.

public boolean isMatch(String input) { String target = new String("hello"); return
⚡ +20 XPSolve
✏️ Code CompletionJV Java
Easy

Main Method Signature

Complete the Java main method.

public static void ___(String[] args) { System.out.println("Hello!"); }
⚡ +10 XPSolve
✏️ Code CompletionJV Java
Medium

Enhanced For Loop

Complete the enhanced for loop.

List<String> names = Arrays.asList("Alice", "Bob"); ___ (String name : names) { System
⚡ +20 XPSolve
🧩 Code ReorderJV Java
Easy

Simple Class

Arrange to create a valid Java class.

} public void greet() { public class Person { System.out.println("Hello!")
⚡ +10 XPSolve
🔮 Output PredictionC+ C++
Easy

Vector Size

What does this output?

vector<int> v = {1, 2, 3, 4}; cout << v.size();
⚡ +10 XPSolve
🔮 Output PredictionC+ C++
Medium

Reference vs Copy

What is the output?

int a = 5; int& b = a; b = 10; cout << a;
⚡ +20 XPSolve
🔮 Output PredictionC+ C++
Hard

Pointer Arithmetic

What is printed?

int arr[] = {10, 20, 30, 40}; int* ptr = arr; ptr += 2; cout << *ptr;
⚡ +35 XPSolve
🐛 Bug HuntC+ C++
Easy

Missing Include

This code won't compile. What's missing?

int main() { cout << "Hello" << endl; return 0; }
⚡ +10 XPSolve
✏️ Code CompletionC+ C++
Easy

Auto Keyword

Complete using the auto keyword.

___ result = 3.14 * 2;
⚡ +10 XPSolve
✏️ Code CompletionC+ C++
Medium

Range-Based For

Complete the range-based for loop.

vector<int> nums = {1, 2, 3}; for (int n ___ nums) { cout << n << " "; }
⚡ +20 XPSolve
🔮 Output PredictionTS TypeScript
Easy

Type Assertion

What does this output?

const value: any = "hello"; const len = (value as string).length; console.log(len);
⚡ +10 XPSolve
🔮 Output PredictionTS TypeScript
Medium

Optional Chaining

What is the output?

const user = { name: "Alice", address: undefined }; console.log(user.address?.city ?? "Unk
⚡ +20 XPSolve
🔮 Output PredictionTS TypeScript
Hard

Enum Values

What does this output?

enum Color { Red, Green, Blue } console.log(Color.Green); console.log(Color[1]);
⚡ +35 XPSolve
🐛 Bug HuntTS TypeScript
Easy

Missing Type Annotation

This function has a type error.

function add(a, b) { return a + b; }
⚡ +10 XPSolve
✏️ Code CompletionTS TypeScript
Easy

Interface Definition

Complete the interface.

___ User { name: string; age: number; }
⚡ +10 XPSolve
✏️ Code CompletionTS TypeScript
Medium

Generic Function

Complete the generic function.

function identity<___>(arg: T): T { return arg; }
⚡ +20 XPSolve
🧩 Code ReorderTS TypeScript
Medium

Type Guard Pattern

Arrange to create a proper type guard.

return typeof value === "string"; function isString(value: unknown): value is string {
⚡ +20 XPSolve
🔮 Output PredictionSQ SQL
Easy

COUNT Function

What does this query return?

SELECT COUNT(*) FROM employees WHERE department = 'Sales';
⚡ +10 XPSolve
🔮 Output PredictionSQ SQL
Medium

NULL Comparison

How many rows does this return if 3 users have NULL email?

SELECT * FROM users WHERE email = NULL;
⚡ +20 XPSolve
🔮 Output PredictionSQ SQL
Hard

GROUP BY with HAVING

What does this query do?

SELECT department, AVG(salary) AS avg_sal FROM employees GROUP BY department HAVING AVG(sa
⚡ +35 XPSolve
🐛 Bug HuntSQ SQL
Easy

Wrong Wildcard

This LIKE query finds no matches.

SELECT * FROM products WHERE name LIKE 'Phone*';
⚡ +10 XPSolve
✏️ Code CompletionSQ SQL
Easy

JOIN Clause

Complete the JOIN query.

SELECT users.name, orders.total FROM users ___ JOIN orders ON users.id = orders.user_id;
⚡ +10 XPSolve
✏️ Code CompletionSQ SQL
Medium

Subquery Pattern

Complete the subquery.

SELECT name FROM employees WHERE salary > ( SELECT ___(salary) FROM employees );
⚡ +20 XPSolve
🧩 Code ReorderSQ SQL
Medium

Complete SELECT Query

Arrange the SQL clauses in correct order.

ORDER BY total DESC SELECT customer, SUM(amount) AS total HAVING SUM(amount) > 100 GROUP B
⚡ +20 XPSolve
🔮 Output PredictionJS JavaScript
Easy

Boolean Conversion

What is the output?

console.log(Boolean("")); console.log(Boolean("0"));
⚡ +10 XPSolve
🔮 Output PredictionJS JavaScript
Medium

Object Keys

What does this log?

const obj = { 1: "a", 2: "b", 3: "c" }; console.log(Object.keys(obj));
⚡ +20 XPSolve
🔮 Output PredictionJS JavaScript
Hard

Promise.race

What gets logged?

const p1 = new Promise(r => setTimeout(() => r("slow"), 200)); const p2 = new Promise(r =>
⚡ +35 XPSolve
🔮 Output PredictionPY Python
Easy

String Methods

What is the output?

text = "hello world" print(text.title())
⚡ +10 XPSolve
🔮 Output PredictionPY Python
Medium

Zip Function

What does this produce?

names = ["Alice", "Bob"] ages = [25, 30] print(list(zip(names, ages)))
⚡ +20 XPSolve
🔮 Output PredictionTS TypeScript
Easy

Const Assertion

What is the type of colors?

const colors = ["red", "blue"] as const; // What is typeof colors?
⚡ +10 XPSolve
🐛 Bug HuntTS TypeScript
Medium

Null Check Missing

This crashes when user is null.

function getNameLength(user: { name: string } | null) { return user.name.length; }
⚡ +20 XPSolve
🔮 Output PredictionJV Java
Easy

Ternary Operator

What does this print?

int x = 7; String result = (x > 5) ? "big" : "small"; System.out.println(result);
⚡ +10 XPSolve
🔮 Output PredictionJV Java
Medium

StringBuilder

What is the output?

StringBuilder sb = new StringBuilder("Hello"); sb.append(" World").reverse(); System.out.p
⚡ +20 XPSolve
🔮 Output PredictionC+ C++
Easy

String Length

What does this output?

string s = "Hello"; cout << s.length();
⚡ +10 XPSolve
🔮 Output PredictionC+ C++
Medium

Map Insertion

What is printed?

map<string, int> m; m["a"] = 1; m["b"] = 2; m["a"] = 3; cout << m["a"] << " " << m.size();
⚡ +20 XPSolve
🔮 Output PredictionSQ SQL
Easy

DISTINCT Keyword

What does DISTINCT do?

SELECT DISTINCT department FROM employees;
⚡ +10 XPSolve
🐛 Bug HuntSQ SQL
Medium

GROUP BY Error

This query fails. What's wrong?

SELECT department, name, COUNT(*) FROM employees GROUP BY department;
⚡ +20 XPSolve
🔮 Output PredictionJS JavaScript
Easy

Template Literals

What is the output?

const name = "World"; console.log(`Hello ${name}!`);
⚡ +10 XPSolve
🔮 Output PredictionJS JavaScript
Medium

NaN Comparison

What does this log?

console.log(NaN === NaN); console.log(typeof NaN);
⚡ +20 XPSolve
🔮 Output PredictionPY Python
Hard

Generator Expression

What is the output?

gen = (x**2 for x in range(3)) print(next(gen)) print(next(gen))
⚡ +35 XPSolve
✏️ Code CompletionPY Python
Easy

F-String Format

Complete the f-string.

name = "Alice" age = 30 print(___"My name is {name} and I am {age}")
⚡ +10 XPSolve
✏️ Code CompletionJV Java
Hard

Stream API

Complete the stream operation.

List<Integer> nums = Arrays.asList(1, 2, 3, 4, 5); int sum = nums.stream() .filter(n -
⚡ +35 XPSolve
🐛 Bug HuntC+ C++
Medium

Dangling Reference

This function returns a dangerous reference.

int& getRef() { int x = 42; return x; }
⚡ +20 XPSolve
✏️ Code CompletionSQ SQL
Hard

Window Function

Complete the window function.

SELECT name, salary, RANK() ___ (ORDER BY salary DESC) AS rank FROM employees;
⚡ +35 XPSolve
✏️ Code CompletionTS TypeScript
Hard

Mapped Type

Complete the mapped type.

type Readonly<T> = { ___[P in keyof T]: T[P]; };
⚡ +35 XPSolve
🐛 Bug HuntJS JavaScript
Easy

Const Reassignment

This code throws an error.

const count = 0; count = count + 1; console.log(count);
⚡ +10 XPSolve
🐛 Bug HuntPY Python
Easy

Wrong Comparison

This always returns True for None checks.

def is_valid(value): if value == None: return False return True
⚡ +10 XPSolve
🐛 Bug HuntJV Java
Hard

ConcurrentModificationException

This crashes when removing items while iterating.

List<String> items = new ArrayList<>(Arrays.asList("a", "b", "c")); for (String item : ite
⚡ +35 XPSolve
🧩 Code ReorderPY Python
Hard

Context Manager

Arrange the custom context manager.

yield self.resource class ManagedResource: def __enter__(self): def __exit
⚡ +35 XPSolve
🧩 Code ReorderC+ C++
Medium

Class with Constructor

Arrange the C++ class properly.

public: int getArea() { return width * height; } class Rectangle { private: int wi
⚡ +20 XPSolve
🧩 Code ReorderTS TypeScript
Hard

Generic Class

Arrange the generic stack class.

pop(): T | undefined { return this.items.pop(); } push(item: T): void { this.items
⚡ +35 XPSolve
🧩 Code ReorderSQ SQL
Hard

Complex Query

Arrange this analytics query.

GROUP BY c.name SELECT c.name, COUNT(o.id) AS total_orders, SUM(o.amount) AS revenue HAVIN
⚡ +35 XPSolve
🚀

Sharpen Your Coding Skills

83+ interactive challenges across 6 languages. Earn XP, track your streak, and master every concept.