| Title | Open | ||||
|---|---|---|---|---|---|
| 1 | Output OperatorWhich operator is used for console output in C++? | easy | Not started | Printing | Solve |
| 3 | Vector SizeWhat is the output of this code? | easy | Not started | Arrays | Solve |
| 5 | Scope ResolutionWhat is the :: operator called in C++? | easy | Not started | Functions | Solve |
| 6 | Pointer BasicsWhich operator is used to get the memory address of a variable in C++? | easy | Not started | Pointers | Solve |
| 9 | For Loop CountWhat is the output of this code? | easy | Not started | Loops | Solve |
| 10 | String LengthWhat is the output of this code? | easy | Not started | Strings | Solve |
| 12 | Ternary OperatorWhat is the output of this code? | easy | Not started | Conditionals | Solve |
| 13 | Array Index OutputWhat is the output of this code? | easy | Not started | Arrays | Solve |
| 14 | While Loop ConditionWhat is the output of this code? | easy | Not started | Loops | Solve |
| 16 | Null PointerWhat keyword is used in modern C++ (C++11 and later) to represent a null pointer? | easy | Not started | Pointers | Solve |
| 19 | String ConcatenationWhat is the output of this code? | easy | Not started | Strings | Solve |
| 21 | Unfreed Heap MemoryThis code compiles and runs, but it has a problem. | easy | Not started | Dynamic Memory | Solve |
| 22 | Delete on Stack VariableThis code has a bug that causes undefined behavior. | easy | Not started | Dynamic Memory | Solve |
| 23 | Dangling Pointer AccessThis code compiles but has a serious bug. | easy | Not started | Dynamic Memory | Solve |
| 24 | Private Member in Base ClassThis code fails to compile. | easy | Not started | Inheritance | Solve |
| 25 | Default Private InheritanceThis code fails to compile at the indicated line. | easy | Not started | Inheritance | Solve |
| 26 | Missing Base Constructor CallThis code fails to compile. | easy | Not started | Inheritance | Solve |
| 27 | Non-Virtual Method CallThe programmer expects this code to print "Dog speaks", but it prints "Animal speaks" instead. | easy | Not started | Polymorphism | Solve |
| 28 | Cannot Create Abstract ObjectThis code fails to compile. | easy | Not started | Polymorphism | Solve |
| 29 | Missing DestructorThis code compiles and runs, but it has a problem. | easy | Not started | Rule of Three | Solve |
| 30 | Default Copy Double FreeThis code compiles but crashes at runtime. | easy | Not started | Rule of Three | Solve |
| 41 | Exception Handling KeywordsWhich three keywords are used for exception handling in C++? | easy | Not started | Exceptions | Solve |
| 42 | Code After throw Is SkippedWhat is the output of this code? | easy | Not started | Exceptions | Solve |
| 43 | Exception Header FileWhich header must you include to use std::runtime_error and std::invalid_argument in C++? | easy | Not started | Exceptions | Solve |
| 44 | Catch-All HandlerWhat does catch (...) do in a C++ exception handler? | easy | Not started | Exceptions | Solve |
| 51 | Template Type Parameter MeaningWhat does T represent in the following code? | easy | Not started | Templates | Solve |
| 52 | Template Class InstantiationWhich line correctly creates a Box<int> object given this template class? | easy | Not started | Templates | Solve |
| 53 | Valid Template Function SignatureWhich of the following is a valid C++ template function that returns the larger of two values? | easy | Not started | Templates | Solve |
| 54 | Template Function OutputWhat is the output of the following program? | easy | Not started | Templates | Solve |
| 59 | What Is a Stream?Which of the following best describes a "stream" in C++? | easy | Not started | Streams | Solve |
| 60 | Input Stream ClassesWhich class should you use to read input from a file in C++? | easy | Not started | Streams | Solve |
| 61 | Output Stream ClassesWhich class is used to write output to a file in C++? | easy | Not started | Streams | Solve |
| 62 | Extraction Operator vs getlineWhat is a key difference between the extraction operator >> and getline() when reading a string from cin? | easy | Not started | Streams | Solve |
| 63 | The get() FunctionWhat makes cin.get() different from the extraction operator cin >>? | easy | Not started | Streams | Solve |
| 64 | setw ManipulatorWhat does setw(10) do when used with cout? | easy | Not started | Streams | Solve |
| 66 | setprecision with fixedWhat is the output of the following code? | easy | Not started | Streams | Solve |
| 67 | The ws ManipulatorWhat does the ws manipulator do when used with an input stream? | easy | Not started | Streams | Solve |
| 68 | Stream Condition State: eof()Which of the following stream condition functions returns true when the stream has reached the end of input? | easy | Not started | Streams | Solve |
| 71 | peek() vs unget()What does cin.peek() do? | easy | Not started | Streams | Solve |
| 72 | Testing If a File Opened SuccessfullyAfter opening a file, which code correctly checks whether the file stream opened successfully? | easy | Not started | Streams | Solve |
| 73 | Function Declaration vs DefinitionWhat is a function declaration (prototype) in C++? | easy | Not started | Functions | Solve |
| 76 | What Is a C-String?Which of the following correctly describes a C-string in C++? | easy | Not started | Strings | Solve |
| 77 | Character Classification FunctionsWhich function from <cctype> returns true if a character is a letter of the alphabet? | easy | Not started | Strings | Solve |
| 79 | find Returns nposWhat does s.find("xyz") return when "xyz" is not found in the string s? | easy | Not started | Strings | Solve |
| 81 | What Is std::string?Which description best fits std::string in C++? | easy | Not started | STL Containers | Solve |
| 82 | String Iterator Type and AccessWhich statement about std::string iteration and element access is correct? | easy | Not started | STL Containers | Solve |
| 83 | What Type Does std::string Store?What element type does std::string store, and can it store arbitrary types like std::vector can? | easy | Not started | STL Containers | Solve |
| 84 | What Is std::vector?Which description best fits std::vector<T>? | easy | Not started | STL Containers | Solve |
| 86 | Vector Iterator TypeWhat category of iterator does std::vector provide, and what operations does it support? | easy | Not started | STL Containers | Solve |
| 88 | Deque vs Vector: Key AdvantageWhat does std::deque offer that std::vector does not? | easy | Not started | STL Containers | Solve |
| 89 | Deque Subscript and Random AccessDoes std::deque support the subscript operator [] and random access iterators? | easy | Not started | STL Containers | Solve |
| 90 | How std::list Stores ElementsHow does std::list<T> store its elements in memory? | easy | Not started | STL Containers | Solve |
| 92 | Does std::list Support []?Can you use the subscript operator [] to access elements in std::list? | easy | Not started | STL Containers | Solve |
| 94 | What Makes std::set Unique?Which two properties always hold for std::set<T>? | easy | Not started | STL Containers | Solve |
| 95 | Accessing Elements in std::setHow do you check whether a value exists in a std::set, and why is the [] operator not available? | easy | Not started | STL Containers | Solve |
| 97 | Does std::set Store Pairs?Does std::set store pair objects, or does each element hold a single value? | easy | Not started | STL Containers | Solve |
| 98 | What Is std::map?Which description best fits std::map<Key, Value>? | easy | Not started | STL Containers | Solve |
| 101 | Map Sorted by KeyIn what order does iterating over a std::map visit its entries? | easy | Not started | STL Containers | Solve |
| 104 | Which Containers Auto-Sort?Which STL containers automatically maintain their elements in sorted order at all times? | easy | Not started | STL Containers | Solve |
| 106 | Read-Only IteratorsWhich iterator type provides read-only access and prevents modification of container elements at compile time? | easy | Not started | STL Containers | Solve |
| 107 | Iterator Dereference OperatorWhich operator is used to access the element that an STL iterator currently points to? | easy | Not started | STL Containers | Solve |
| 108 | Which Containers Store Unique Values?Which STL containers automatically reject duplicate values or keys? | easy | Not started | STL Containers | Solve |
| 109 | Do STL Containers Auto-Resize?Which statement about memory management in standard STL containers is correct? | easy | Not started | STL Containers | Solve |
| 112 | class or typename in the Template PrefixThis template is written with class T instead of typename T, and it is called with an int and then a char. | easy | Not started | Templates | Solve |
| 113 | Deducing T From a VectorprintFirst receives a whole vector of strings. | easy | Not started | Templates | Solve |
| 114 | Choosing the Type YourselfThe call writes the template argument explicitly: larger<double>(3, 4.5). | easy | Not started | Templates | Solve |
| 115 | Two Arguments That Disagree About TThis program does not compile. | easy | Not started | Templates | Solve |
| 116 | Pair<int, double> Versus Pair<double, int>Both objects are made from the same class template. | easy | Not started | Templates | Solve |
| 117 | What T Becomes for a String LiteralBoth calls print hi. | easy | Not started | Templates | Solve |
| 118 | decltype and Integer Divisiondecltype gives each variable the type of the expression inside the brackets. | easy | Not started | Templates | Solve |
| 132 | Why Catch by const ReferenceThe handler is written as catch (const std::exception& e). | easy | Not started | Exceptions | Solve |
| 133 | The Correct what() OverrideEmptyCartError derives from std::exception and wants its own message. | easy | Not started | Exceptions | Solve |
| 134 | Which Family invalid_argument Belongs ToA std::invalid_argument is thrown and there are two handlers. | easy | Not started | Exceptions | Solve |
| 135 | Which Call Throwsdoubled throws for a negative number. | easy | Not started | Exceptions | Solve |
| 136 | vector::at Versus operator[]scores has three elements. | easy | Not started | Exceptions | Solve |
| 137 | What stoi Throwsstd::stoi is called with a normal number, with text, and with a number far too large for an int. | easy | Not started | Exceptions | Solve |
| 138 | No finally Keyword in C++C++ has no finally keyword. | easy | Not started | Exceptions | Solve |
| 139 | The Type of a Thrown String Literalthrow "disk full"; throws a string literal. | easy | Not started | Exceptions | Solve |
| 140 | What new Throws When Memory Runs OutWhen new cannot get the memory it was asked for, which exception does it throw, and would this handler catch it? | easy | Not started | Exceptions | Solve |
| 141 | A Loop That Catches and ContinuesThe try/catch sits INSIDE the loop body. | easy | Not started | Exceptions | Solve |
| 2 | Reference vs CopyWhat is the output of this code? | medium | Not started | Variables | Solve |
| 4 | Class ConstructorWhat is the output of this code? | medium | Not started | Classes | Solve |
| 7 | Pointer Dereference OutputWhat is the output of this code? | medium | Not started | Pointers | Solve |
| 8 | Inheritance AccessWhich access specifier allows a derived class to access a member, but keeps it hidden from code outside the class hierarchy? | medium | Not started | Classes | Solve |
| 11 | Default Function ArgumentWhat is the output of this code? | medium | Not started | Functions | Solve |
| 15 | Function OverloadingWhat is the output of this code? | medium | Not started | Functions | Solve |
| 17 | Increment OperatorsWhat is the output of this code? | medium | Not started | Variables | Solve |
| 31 | Wrong Delete on ArrayThis code has a subtle bug. | medium | Not started | Dynamic Memory | Solve |
| 32 | Pointer to Local VariableThis code compiles with a warning but produces unpredictable output. | medium | Not started | Dynamic Memory | Solve |
| 33 | Missing Assignment OperatorThis class has a destructor and copy constructor, but the code still crashes. | medium | Not started | Rule of Three | Solve |
| 34 | Shallow Copy BugThis code crashes when the objects are destroyed. | medium | Not started | Rule of Three | Solve |
| 35 | Rule of Three ViolationThis class manages dynamic memory. | medium | Not started | Rule of Three | Solve |
| 36 | Object SlicingThe programmer expects this to print "Cat meows", but it prints "Animal speaks" instead. | medium | Not started | Polymorphism | Solve |
| 37 | Non-Virtual Destructor LeakThis code has a subtle bug when delete base runs. | medium | Not started | Polymorphism | Solve |
| 38 | Method Hiding in Derived ClassThis code fails to compile on the marked lines. | medium | Not started | Inheritance | Solve |
| 39 | Diamond Inheritance AmbiguityThis code fails to compile. | medium | Not started | Inheritance | Solve |
| 40 | Accidental Method Signature MismatchThe programmer expects this to print "Derived: 42", but it prints "Base: 42" instead. | medium | Not started | Polymorphism | Solve |
| 45 | The noexcept SpecifierWhat does the noexcept specifier do when added to a function declaration in C++? | medium | Not started | Exceptions | Solve |
| 46 | Catch Block OrderingThis code has a problem related to the order of catch blocks. | medium | Not started | Exceptions | Solve |
| 47 | Catch by Value Causes SlicingWhat is the output of this code? | medium | Not started | Exceptions | Solve |
| 48 | Bare throw RethrowsWhat is the output of this code? | medium | Not started | Exceptions | Solve |
| 49 | Exception Thrown in ConstructorWhat is the output of this code? | medium | Not started | Exceptions | Solve |
| 50 | Unhandled Exception BehaviorWhat happens when a C++ program throws an exception that is never caught by any catch block? | medium | Not started | Exceptions | Solve |
| 55 | Template Type DeductionWhat is the output of this code? | medium | Not started | Templates | Solve |
| 56 | Two-Type Template Class OutputWhat is the output of this code? | medium | Not started | Templates | Solve |
| 57 | Template with Two Type ArgumentsWhat is the output of the following program? | medium | Not started | Templates | Solve |
| 58 | Template Instantiation FailureThe following code fails to compile at the call site. | medium | Not started | Templates | Solve |
| 65 | setfill OutputWhat is the output of the following code? | medium | Not started | Streams | Solve |
| 69 | seekg and tellgAn ifstream has an internal get position tracking the next character to read. | medium | Not started | Streams | Solve |
| 70 | Stream Go TestWhich loop is the correct idiomatic "go test" for reading integers from a stream until it fails or reaches end-of-file? | medium | Not started | Streams | Solve |
| 74 | const Reference ParameterWhy would you declare a function parameter as const string& rather than just string? | medium | Not started | Functions | Solve |
| 75 | Base Class as Function ParameterWhat is the advantage of writing a function with a base class reference parameter, such as: | medium | Not started | Functions | Solve |
| 78 | substr ParametersWhat does s.substr(2, 4) return when s = "Hello World"? | medium | Not started | Strings | Solve |
| 80 | stoi Stops at Non-DigitWhat does stoi("42abc") return in C++? | medium | Not started | Strings | Solve |
| 85 | Vector Insertion PerformanceWhich insertion operation on std::vector runs in O(1) amortized time, and why is inserting at the front slow? | medium | Not started | STL Containers | Solve |
| 87 | How Deque Stores ElementsHow does std::deque store its elements internally, and how does this differ from std::vector? | medium | Not started | STL Containers | Solve |
| 91 | List Iterator TypeWhat type of iterator does std::list provide, and what limitation does this create? | medium | Not started | STL Containers | Solve |
| 93 | List Insertion SpeedWhat is the time complexity of inserting an element into the middle of a std::list once you have an iterator to the desired position? | medium | Not started | STL Containers | Solve |
| 96 | Set Iterator Type and Read-Only AccessWhat type of iterator does std::set provide, and can you modify elements through it? | medium | Not started | STL Containers | Solve |
| 99 | Map Subscript Operator BehaviorWhat does map[key] do if the key does not already exist in the map? | medium | Not started | STL Containers | Solve |
| 100 | Map Iterator Dereference TypeWhen you dereference a std::map<string, int> iterator, what type do you get? | medium | Not started | STL Containers | Solve |
| 102 | Inserting a Duplicate Key in std::mapWhat happens when you call map.insert({"age", 30}) and the key "age" already exists with value 25? | medium | Not started | STL Containers | Solve |
| 103 | Which Containers Use Contiguous Memory?Which standard STL containers guarantee that all elements are stored in a single contiguous block of memory? | medium | Not started | STL Containers | Solve |
| 105 | Which Containers Support Random Access Iterators?Which STL containers provide random access iterators that support +n and -n arithmetic in O(1)? | medium | Not started | STL Containers | Solve |
| 110 | Which Destructor Fits the Relationship?Both classes manage a dynamically allocated array of const Part. | medium | Not started | Pointers | Solve |
| 111 | Copying an AggregationPickList keeps the addresses of Part objects it does not own in a const Part m_parts array that it allocated with new[], together with size_t m_count. | medium | Not started | Pointers | Solve |
| 119 | Three Types in One Function CallThis function template has three type parameters and is called as describe(7, 'q', 1.5). | medium | Not started | Templates | Solve |
| 120 | Trailing Return Type With decltypeThe return type is written after the arrow: -> decltype(a + b). | medium | Not started | Templates | Solve |
| 121 | When the Compiler Cannot Deduce TT appears only in the return type of zero, and the function takes no arguments. | medium | Not started | Templates | Solve |
| 122 | A Size as a Template ParameterN is a non-type template parameter: a value instead of a type. | medium | Not started | Templates | Solve |
| 123 | A Default Template Argument Fills the GapTriple has three type parameters, but the object is created with only two: Triple<int, std::string>. | medium | Not started | Templates | Solve |
| 124 | Defining get() Outside the Class Templateget() is declared inside Box but will be defined outside the class body, where the comment is. | medium | Not started | Templates | Solve |
| 125 | Which identify Overload RunsTwo overloads of identify exist: one takes T&, the other takes T&&. | medium | Not started | Templates | Solve |
| 126 | Why swapValues(x, 5) Will Not CompileswapValues(x, y) works and prints 2 1, but the program fails to compile because of swapValues(x, 5). | medium | Not started | Templates | Solve |
| 142 | throw e Versus a Bare throwBoth functions catch a DerivedError through a const BaseError&. | medium | Not started | Exceptions | Solve |
| 143 | A try Without a catchThe try block has no handler after it. | medium | Not started | Exceptions | Solve |
| 144 | The Base Handler Comes FirstA std::runtime_error is thrown, and the handler for std::exception is written BEFORE the handler for std::runtime_error. | medium | Not started | Exceptions | Solve |
| 145 | Guards Closing During UnwindingEach function owns a Guard that prints when it is built and when it is destroyed. | medium | Not started | Exceptions | Solve |
| 146 | Destroyed Once or TwiceThe second Sensor throws from its constructor. | medium | Not started | Exceptions | Solve |
| 147 | The Member Built Before the ThrowMachine has a Part member and its constructor throws after the body starts. | medium | Not started | Exceptions | Solve |
| 148 | A return That Is Never Reachedshare has a return inside its try block and another inside its catch block. | medium | Not started | Exceptions | Solve |
| 149 | Inheriting runtime_error's ConstructorConfigError declares no constructor of its own, only a using-declaration. | medium | Not started | Exceptions | Solve |
| 150 | Why m_text.c_str() Is Safe in what()what() returns m_text.c_str(). | medium | Not started | Exceptions | Solve |
| 151 | Handler Order for Three LevelsDbError derives from AppError, which derives from std::runtime_error. | medium | Not started | Exceptions | Solve |
| 152 | Nested try With a RethrowThe inner handler prints a line and then rethrows with a bare throw;. | medium | Not started | Exceptions | Solve |
| 153 | Check First or Catch LaterBoth halves print the same words for index 7. | medium | Not started | Exceptions | Solve |
| 18 | Virtual Function ConceptWhat is the purpose of the virtual keyword when used on a method in a base class? | hard | Not started | Classes | Solve |
| 20 | Static Class MemberWhat is the output of this code? | hard | Not started | Classes | Solve |
| 127 | A Named Rvalue Reference Is Still an Lvalueinspect receives the literal 7 through an rvalue reference named value. | hard | Not started | Templates | Solve |
| 128 | One Counter per SpecializationEach Counter<T> has a static member made that its constructor increments. | hard | Not started | Templates | Solve |
| 129 | The Error That Waits for InstantiationWithout the larger(p, q) line the program compiles and prints 9. | hard | Not started | Templates | Solve |
| 130 | decltype(x) Versus decltype((x))a is declared with decltype(x) and b with decltype((x)), the same variable with an extra pair of brackets. | hard | Not started | Templates | Solve |
| 131 | Returning a Copy or a Reference From Boxget() returns T by value and peek() returns const T&. | hard | Not started | Templates | Solve |
| 154 | What a Return Code Cannot CarrydivideCode signals an error by returning -1; divideThrow throws instead. | hard | Not started | Exceptions | Solve |
| 155 | An Exception Crosses Three Functionsmain calls level1, which calls level2, which calls level3, and level3 throws. | hard | Not started | Exceptions | Solve |
| 156 | A noexcept Function That Throws Anywayreport() is marked noexcept but throws. | hard | Not started | Exceptions | Solve |
| 157 | The Variable the Failed Call Never Setx starts at -1. | hard | Not started | Exceptions | Solve |
| 158 | Where catch(...) Has to GoAs written, catch (...) is the LAST handler and the program prints runtime: disk and then something else. | hard | Not started | Exceptions | Solve |
| 159 | A what() Built From a Code and a MessageHttpError stores a code and builds its full text in the constructor. | hard | Not started | Exceptions | Solve |
| 160 | A Bare throw With Nothing to Rethrowretry() executes a bare throw; while NO exception is being handled. | hard | Not started | Exceptions | Solve |
| 161 | A Throw Inside a catch BlockThe handler inside convert prints a line and then throws a NEW std::runtime_error. | hard | Not started | Exceptions | Solve |