C++ practice
Every C++ exercise, built from a topic you can open beside it.
92 exercises runs offline
All tracks Python 139 JavaScript 184 TypeScript 76 Go 106 Rust 75 Java 81 Kotlin 66 C++ 92 C# 88 Swift 68 PHP 69 Frontend 82 Backend 139 Architecture and system design 25 DevOps and cloud 15 Data and databases 5 Data science 31 AI and LLM engineering 75 Security 26 Game development 26 Coding in the AI era 101 CS foundations 164
level
cpp Quiz new After array-to-pointer conversion, what is the type of int grid[2][3] in an ordinary expr… Built-in C++23 arrays, including bounds, initialization, pointer conversion, multidimensional layout, lifetime, and safer standard-library alternatives. cpp Quiz new What contract does void read(const int values[8]) enforce in C++23? Built-in C++23 arrays, including bounds, initialization, pointer conversion, multidimensional layout, lifetime, and safer standard-library alternatives. cpp Predict the output new What does this program print? Built-in C++23 arrays, including bounds, initialization, pointer conversion, multidimensional layout, lifetime, and safer standard-library alternatives. cpp Review AI code new Review generated reading average Built-in C++23 arrays, including bounds, initialization, pointer conversion, multidimensional layout, lifetime, and safer standard-library alternatives. cpp Spot the bug new Spot the bug in the four-element total Built-in C++23 arrays, including bounds, initialization, pointer conversion, multidimensional layout, lifetime, and safer standard-library alternatives. cpp Quiz new Which statement about sizeof(char) is portable C? Start with translation units, types, and expressions, then learn C23 control flow, functions, error boundaries, conversions, and undefined behavior. cpp Predict the output new What does this program print? Start with translation units, types, and expressions, then learn C23 control flow, functions, error boundaries, conversions, and undefined behavior. cpp Review AI code new Review generated reading average Start with translation units, types, and expressions, then learn C23 control flow, functions, error boundaries, conversions, and undefined behavior. cpp Spot the bug new Spot the bug in the balance comparison Start with translation units, types, and expressions, then learn C23 control flow, functions, error boundaries, conversions, and undefined behavior. cpp Quiz new What may portable C conclude about int next = index++ + index;? Start with translation units, types, and expressions, then learn C23 control flow, functions, error boundaries, conversions, and undefined behavior. cpp Quiz new What does fread(buffer, sizeof(uint32_t), 8, stream) return? Open, read, write, and seek files reliably with C23 stdio streams while handling EOF, short counts, buffering, and close errors. cpp Predict the output new What does this program print? Open, read, write, and seek files reliably with C23 stdio streams while handling EOF, short counts, buffering, and close errors. cpp Review AI code new Review generated file copy Open, read, write, and seek files reliably with C23 stdio streams while handling EOF, short counts, buffering, and close errors. cpp Spot the bug new Spot the bug in the byte-copy loop Open, read, write, and seek files reliably with C23 stdio streams while handling EOF, short counts, buffering, and close errors. cpp Quiz new On an r+b update stream, what must normally separate a successful read from a following w… Open, read, write, and seek files reliably with C23 stdio streams while handling EOF, short counts, buffering, and close errors. cpp Quiz new Which declaration makes handler a pointer to a function that takes int and returns int? C23 function-pointer declarations, compatible types, callback context, and dispatch tables, including the casts and lifetime bugs to avoid. cpp Predict the output new What does this program print? C23 function-pointer declarations, compatible types, callback context, and dispatch tables, including the casts and lifetime bugs to avoid. cpp Quiz new An API retains a callback and void* context until unregister returns. Which context is sa… C23 function-pointer declarations, compatible types, callback context, and dispatch tables, including the casts and lifetime bugs to avoid. cpp Review AI code new Review generated route registry C23 function-pointer declarations, compatible types, callback context, and dispatch tables, including the casts and lifetime bugs to avoid. cpp Spot the bug new Spot the bug in the qsort comparator C23 function-pointer declarations, compatible types, callback context, and dispatch tables, including the casts and lifetime bugs to avoid. cpp Quiz new Which pointer may be passed to free? Manage sizes, ownership, and lifetimes with C23 allocation functions, using verifiable cleanup paths to prevent leaks, overflows, and use-after-free. cpp Predict the output new What does this C23 program print when calloc succeeds? Manage sizes, ownership, and lifetimes with C23 allocation functions, using verifiable cleanup paths to prevent leaks, overflows, and use-after-free. cpp Quiz new What is guaranteed when realloc(owner, larger_size) returns NULL for a nonzero valid size? Manage sizes, ownership, and lifetimes with C23 allocation functions, using verifiable cleanup paths to prevent leaks, overflows, and use-after-free. cpp Review AI code new Review a generated byte buffer Manage sizes, ownership, and lifetimes with C23 allocation functions, using verifiable cleanup paths to prevent leaks, overflows, and use-after-free. cpp Spot the bug new Spot the bug in array-copy allocation Manage sizes, ownership, and lifetimes with C23 allocation functions, using verifiable cleanup paths to prevent leaks, overflows, and use-after-free. cpp Quiz new What does const int *cursor permit? C pointers store object addresses; understand types, dereferencing, array bounds, lifetimes, and qualifiers to build contracts you can verify. cpp Quiz new Inside void inspect(const int *values), what does sizeof(values) measure? C pointers store object addresses; understand types, dereferencing, array bounds, lifetimes, and qualifiers to build contracts you can verify. cpp Predict the output new What does this program print? C pointers store object addresses; understand types, dereferencing, array bounds, lifetimes, and qualifiers to build contracts you can verify. cpp Review AI code new Review a generated pointer-range search C pointers store object addresses; understand types, dereferencing, array bounds, lifetimes, and qualifiers to build contracts you can verify. cpp Spot the bug new Spot the bug in the local reading pointer C pointers store object addresses; understand types, dereferencing, array bounds, lifetimes, and qualifiers to build contracts you can verify. cpp Quiz new After #define CACHE_ENABLED 0, which condition selects the disabled branch? The C preprocessor expands macros, includes headers, and selects code before compilation; learn token replacement, configuration boundaries, and verifiable macros. cpp Quiz new What does a conventional include guard guarantee? The C preprocessor expands macros, includes headers, and selects code before compilation; learn token replacement, configuration boundaries, and verifiable macros. cpp Predict the output new What does this program print? The C preprocessor expands macros, includes headers, and selects code before compilation; learn token replacement, configuration boundaries, and verifiable macros. cpp Review AI code new Review a generated label-copy helper The C preprocessor expands macros, includes headers, and selects code before compilation; learn token replacement, configuration boundaries, and verifiable macros. cpp Spot the bug new Spot the bug in the MAX_VALUE macro The C preprocessor expands macros, includes headers, and selects code before compilation; learn token replacement, configuration boundaries, and verifiable macros. cpp Quiz new A protocol byte is converted to enum MessageKind. What should happen before using it to i… Model records with structs, reuse storage with unions, and tag states with enums while keeping layout, copying, and active-member rules explicit. cpp Predict the output new What does this program print? Model records with structs, reuse storage with unions, and tag states with enums while keeping layout, copying, and active-member rules explicit. cpp Review AI code new Review generated owned text message Model records with structs, reuse storage with unions, and tag states with enums while keeping layout, copying, and active-member rules explicit. cpp Spot the bug new Spot the bug in the tagged union Model records with structs, reuse storage with unions, and tag states with enums while keeping layout, copying, and active-member rules explicit. cpp Quiz new Which statement about sizeof(struct Record) is portable C? Model records with structs, reuse storage with unions, and tag states with enums while keeping layout, copying, and active-member rules explicit. cpp Quiz new What must a program track when a union represents several alternative payloads? Model records with structs, reuse storage with unions, and tag states with enums while keeping layout, copying, and active-member rules explicit. cpp Quiz new What language-level difference applies to otherwise identical class and struct definition… C++ classes package state and behavior into user-defined types; learn access control, construction, invariants, and compiler-generated special members. cpp Quiz new Why should a member function that only reads object state usually have a trailing const? C++ classes package state and behavior into user-defined types; learn access control, construction, invariants, and compiler-generated special members. cpp Predict the output new What does this program print? C++ classes package state and behavior into user-defined types; learn access control, construction, invariants, and compiler-generated special members. cpp Review AI code new Review generated course enrollment C++ classes package state and behavior into user-defined types; learn access control, construction, invariants, and compiler-generated special members. cpp Spot the bug new Spot the bug in Invoice initialization C++ classes package state and behavior into user-defined types; learn access control, construction, invariants, and compiler-generated special members. cpp Quiz new A constructor throws after two data members finished construction. Which destructors run? C++ exceptions separate error detection from handling; learn type matching, stack unwinding, RAII, safety guarantees, and truthful noexcept boundaries. cpp Quiz new What happens when an exception tries to leave a noexcept function? C++ exceptions separate error detection from handling; learn type matching, stack unwinding, RAII, safety guarantees, and truthful noexcept boundaries. cpp Predict the output new What does this program print? C++ exceptions separate error detection from handling; learn type matching, stack unwinding, RAII, safety guarantees, and truthful noexcept boundaries. cpp Review AI code new Review generated ledger import C++ exceptions separate error detection from handling; learn type matching, stack unwinding, RAII, safety guarantees, and truthful noexcept boundaries. cpp Spot the bug new Spot the bug in record import cleanup C++ exceptions separate error detection from handling; learn type matching, stack unwinding, RAII, safety guarantees, and truthful noexcept boundaries. cpp Predict the output new What does this program print? C++ inheritance embeds a base subobject in a derived class and creates a substitutable type relationship; learn access, slicing, and virtual bases. cpp Quiz new What does public inheritance guarantee about accessible base members? C++ inheritance embeds a base subobject in a derived class and creates a substitutable type relationship; learn access, slicing, and virtual bases. cpp Review AI code new Review generated report hierarchy C++ inheritance embeds a base subobject in a derived class and creates a substitutable type relationship; learn access, slicing, and virtual bases. cpp Spot the bug new Spot the bug in the job hierarchy C++ inheritance embeds a base subobject in a derived class and creates a substitutable type relationship; learn access, slicing, and virtual bases. cpp Quiz new In a virtual-inheritance diamond, which constructor initializes the shared virtual base f… C++ inheritance embeds a base subobject in a derived class and creates a substitutable type relationship; learn access, slicing, and virtual bases. cpp Quiz new Why does constructing T from std::move(const_value) commonly call T(const T&) instead of … C++ move semantics through rvalue references, std::move, move operations, moved-from states, and noexcept-aware container behavior. cpp Quiz new For a copyable type, when does std::move_if_noexcept return an rvalue reference? C++ move semantics through rvalue references, std::move, move operations, moved-from states, and noexcept-aware container behavior. cpp Predict the output new What does this program print? C++ move semantics through rvalue references, std::move, move operations, moved-from states, and noexcept-aware container behavior. cpp Review AI code new Review generated Packet owner C++ move semantics through rvalue references, std::move, move operations, moved-from states, and noexcept-aware container behavior. cpp Spot the bug new Spot the bug in the moved-from vector C++ move semantics through rvalue references, std::move, move operations, moved-from states, and noexcept-aware container behavior. cpp Predict the output new What does this program print? C++ namespaces organize names into scopes; understand qualified lookup, using declarations, ADL, and linkage boundaries to keep library APIs predictable. cpp Review AI code new Review generated header label helper C++ namespaces organize names into scopes; understand qualified lookup, using declarations, ADL, and linkage boundaries to keep library APIs predictable. cpp Spot the bug new Spot the bug in the render definition C++ namespaces organize names into scopes; understand qualified lookup, using declarations, ADL, and linkage boundaries to keep library APIs predictable. cpp Quiz new What happens to an unnamed-namespace variable defined in a header included by three trans… C++ namespaces organize names into scopes; understand qualified lookup, using declarations, ADL, and linkage boundaries to keep library APIs predictable. cpp Quiz new Which statement best describes using metrics::distance; inside a function? C++ namespaces organize names into scopes; understand qualified lookup, using declarations, ADL, and linkage boundaries to keep library APIs predictable. cpp Quiz new In C++23, what happens when a class defines auto operator<=>(const T&) const = default; a… Operator overloading gives user-defined types natural C++ syntax; learn lookup, return types, and comparison contracts without semantic surprises. cpp Quiz new Why can an expression a + b find operator+ defined as a friend inside the class of a and … Operator overloading gives user-defined types natural C++ syntax; learn lookup, return types, and comparison contracts without semantic surprises. cpp Predict the output new What does this program print? Operator overloading gives user-defined types natural C++ syntax; learn lookup, return types, and comparison contracts without semantic surprises. cpp Predict the output new What does this program print? Operator overloading gives user-defined types natural C++ syntax; learn lookup, return types, and comparison contracts without semantic surprises. cpp Review AI code new Review generated Polynomial class Operator overloading gives user-defined types natural C++ syntax; learn lookup, return types, and comparison contracts without semantic surprises. cpp Spot the bug new Spot the bug in Scores indexing Operator overloading gives user-defined types natural C++ syntax; learn lookup, return types, and comparison contracts without semantic surprises. cpp Quiz new A resource-owning constructor throws after two RAII members finish construction. What is … RAII binds resource ownership to C++ object lifetime; learn deterministic destruction, exception paths, move-only owners, and non-throwing cleanup. cpp Predict the output new What does this program print? RAII binds resource ownership to C++ object lifetime; learn deterministic destruction, exception paths, move-only owners, and non-throwing cleanup. cpp Quiz new A function uses vector for all temporary memory but appends to its caller’s vector before… RAII binds resource ownership to C++ object lifetime; learn deterministic destruction, exception paths, move-only owners, and non-throwing cleanup. cpp Review AI code new Repair a generated file owner RAII binds resource ownership to C++ object lifetime; learn deterministic destruction, exception paths, move-only owners, and non-throwing cleanup. cpp Spot the bug new Spot the bug in the Socket wrapper RAII binds resource ownership to C++ object lifetime; learn deterministic destruction, exception paths, move-only owners, and non-throwing cleanup. cpp Quiz new Which declaration has a forwarding reference parameter? Bind expressions to existing objects with C++ references; understand lvalue and rvalue references, lifetimes, and forwarding without dangling. cpp Predict the output new What does this program print? Bind expressions to existing objects with C++ references; understand lvalue and rvalue references, lifetimes, and forwarding without dangling. cpp Review AI code new Review a generated registry Bind expressions to existing objects with C++ references; understand lvalue and rvalue references, lifetimes, and forwarding without dangling. cpp Spot the bug new Spot the bug in the Result factory Bind expressions to existing objects with C++ references; understand lvalue and rvalue references, lifetimes, and forwarding without dangling. cpp Quiz new A function stores a const std::string& parameter that was bound to a temporary argument. … Bind expressions to existing objects with C++ references; understand lvalue and rvalue references, lifetimes, and forwarding without dangling. cpp Predict the output new What does this program print? Use unique_ptr for exclusive ownership and shared_ptr with weak_ptr for shared graphs, while avoiding control-block and lifetime bugs. cpp Review AI code new Repair generated worker callbacks Use unique_ptr for exclusive ownership and shared_ptr with weak_ptr for shared graphs, while avoiding control-block and lifetime bugs. cpp Quiz new What happens when a shared_ptr is copied? Use unique_ptr for exclusive ownership and shared_ptr with weak_ptr for shared graphs, while avoiding control-block and lifetime bugs. cpp Quiz new Which C++23 statement about shared_ptr and threads is correct? Use unique_ptr for exclusive ownership and shared_ptr with weak_ptr for shared graphs, while avoiding control-block and lifetime bugs. cpp Spot the bug new Spot the bug in the shared_ptr factory Use unique_ptr for exclusive ownership and shared_ptr with weak_ptr for shared graphs, while avoiding control-block and lifetime bugs. cpp Quiz new A Base constructor calls a virtual member on *this while constructing a Derived object. W… C++ virtual functions select an override from the dynamic type; learn pure virtual interfaces, safe destruction, and lifetime dispatch rules. cpp Quiz new After overload resolution selects a virtual member, what selects the function body for an… C++ virtual functions select an override from the dynamic type; learn pure virtual interfaces, safe destruction, and lifetime dispatch rules. cpp Predict the output new What does this program print? C++ virtual functions select an override from the dynamic type; learn pure virtual interfaces, safe destruction, and lifetime dispatch rules. cpp Review AI code new Review a generated report interface C++ virtual functions select an override from the dynamic type; learn pure virtual interfaces, safe destruction, and lifetime dispatch rules. cpp Spot the bug new Spot the bug in JsonDecoder override C++ virtual functions select an override from the dynamic type; learn pure virtual interfaces, safe destruction, and lifetime dispatch rules.
No practice items match these filters.