English
Review questions
Questions for self-check and exam preparation, grouped by course topic.
Topic 1. C++ and your first program
- Briefly describe the history of the C++ language and its standards. What are the main new features associated with C++26, and how do you check whether the installed compiler supports them?
- Explain the stages of building a C++ program: preprocessing, compilation and linking. What is a translation unit?
- How do you create, build and run a C++ console project in Microsoft Visual Studio 2026? Explain the Debug and Release configurations.
- Describe the structure of the simplest C++ program: the main function, including libraries, namespaces.
- What is the Git version control system? Explain the concepts of a repository, a commit and a branch, and the basic Git commands.
- How do you work with a Git repository in Visual Studio 2026? What is the .gitignore file for in a C++ project?
Topic 2. Types, operators, control flow
- What fundamental data types does C++ have? What do their sizes and value ranges depend on?
- Explain the ways of initializing variables in C++, including uniform initialization with braces. What are auto, const and constexpr used for?
- Explain implicit and explicit type conversions in C++. What is the static_cast operator for?
- Which C++ operators do you know? Explain operator precedence, integer division and the three-way comparison operator
<=>. - How do you output data with std::print and std::println and read data from the std::cin stream? Compare std::print with the std::cout stream.
- Describe the C++ control structures: if, switch, the for, while and do-while loops, and the range-based for loop.
Topic 3. Functions
- Explain function declaration and definition. What is a function prototype, and why is it placed in a header file?
- Compare the ways of passing parameters to a function: by value, by reference and by const reference.
- What are default parameters and function overloading? How does the compiler choose which function to call?
- What are inline functions and constexpr functions?
- What is recursion? Give an example of a recursive function and explain the risk of stack overflow.
- How do you return several values from a function using std::pair, std::tuple or a struct and structured bindings?
Topic 4. Arrays, strings, vector
- Explain how to declare, initialize and traverse built-in C++ arrays. What are their drawbacks?
- Compare built-in arrays, std::array and std::vector.
- Explain the main operations of the std::vector class: adding and removing elements, size and capacity, memory reallocation.
- Which main methods of the std::string class are used for searching, comparison, extracting a substring and concatenation?
- What is std::string_view? What are the benefits of using it, and what dangers arise from the lifetime of the string?
- How do you convert between strings and numbers (std::to_string, std::stoi, std::format)?
Topic 5. Pointers and memory
- What is a pointer? Explain the address-of and dereference operators and the null pointer nullptr.
- Compare pointers and references in C++.
- Explain pointer arithmetic and the relationship between pointers and arrays.
- Explain how a program’s memory is organized (the stack and the heap). How do you allocate and free dynamic memory with the new and delete operators?
- What are memory leaks, dangling pointers and double frees? How do you detect them?
- Explain the smart pointers std::unique_ptr and std::shared_ptr and the functions std::make_unique and std::make_shared.
- What is std::weak_ptr for? How does it solve the problem of circular references?
Topic 6. Debugging and errors
- What debugging tools does Visual Studio 2026 provide: breakpoints, stepping, and the Autos, Locals, Watch and Call Stack windows?
- How does the exception mechanism work in C++: throw, try, catch? What happens to the stack when an exception is thrown?
- Describe the hierarchy of standard exceptions rooted in std::exception. How do you create your own exception class?
- What does the noexcept specifier mean? Which levels of exception safety guarantees do you know?
- What is std::expected? Compare error handling with exceptions and with std::expected.
- What are assert, static_assert and sanitizers (AddressSanitizer) used for?
Topic 7. Classes and objects
- What are a class and an object in C++? Compare the class and struct keywords.
- Explain encapsulation and the access specifiers public, private and protected.
- What kinds of constructors exist in C++? Explain the member initializer list and delegating constructors.
- What is a destructor? In what order are the constructors and destructors of objects called?
- What are const methods and the mutable keyword? What is the this pointer used for?
- What are static fields and methods of a class? How do you split a class into a header file and an implementation file?
Topic 8. Copy, move, RAII
- What are the copy constructor and the copy assignment operator? When does the compiler call them?
- Compare shallow and deep copying of objects that own dynamic memory.
- What are lvalues and rvalues? Explain rvalue references and the std::move function.
- What are the move constructor and the move assignment operator? What are the benefits of move semantics?
- What is the RAII idiom? Give examples of standard library classes that implement it.
- Explain the rules of zero, three and five. What are the default and delete specifiers used for with special member functions?
- What are return value optimization (RVO) and guaranteed copy elision?
Topic 9. Operator overloading
- How do you overload operators for your own class? Which operators cannot be overloaded?
- Compare overloading an operator as a class method and as a free function.
- What are friend functions and friend classes? When is it appropriate to use them?
- How do you overload the stream output and stream input operators for your own class?
- How do you overload the three-way comparison operator
<=>and the equality operator? What does the compiler generate automatically? - How do you overload the subscript, function call and increment operators for your own class?
Topic 10. Inheritance and polymorphism
- What is inheritance? Explain public, protected and private inheritance.
- In what order are the constructors and destructors of the base and derived classes called? How do you call a base class constructor?
- What are virtual functions? Explain the override and final specifiers.
- Explain the typical implementation of dynamic polymorphism through a virtual function table and a pointer to it. Why is a specific object layout not required by the standard?
- Why does a base class need a virtual destructor? What is object slicing?
- Explain conversions within a class hierarchy: static_cast, dynamic_cast and RTTI.
Topic 11. Abstract classes, interfaces
- What are a pure virtual function and an abstract class?
- How do you implement an interface in C++ using an abstract class?
- What is multiple inheritance? What problems can it cause?
- What is diamond inheritance, and how does virtual inheritance solve it?
- Compare inheritance and composition. When should you prefer composition?
- Compare dynamic polymorphism through virtual functions and static polymorphism through templates.
Topic 12. Templates and concepts
- What are function templates? How do template argument deduction and instantiation work?
- What are class templates? Explain non-type template parameters and default values.
- What is template specialization? Compare full and partial specialization.
- Why are template definitions usually placed in header files?
- What are concepts? How do you constrain template parameters with requires?
- Give examples of standard concepts (std::integral, std::same_as, std::totally_ordered) and create your own concept.
- What are variadic templates?
Topic 13. Containers
- What groups of containers does the C++ standard library have? Explain their purpose.
- Compare the sequence containers vector, deque and list in terms of the performance of their main operations.
- Explain the associative containers std::set and std::map. What ordering and complexity guarantees do they provide, and which data structures does an implementation usually use?
- Explain the unordered containers std::unordered_set and std::unordered_map. What is a hash function?
- Compare the insert, emplace and
operator[]methods for adding elements to std::map. - What are the container adapters std::stack, std::queue and std::priority_queue?
Topic 14. Iterators, algorithms, ranges
- What are iterators? Explain the iterator categories.
- When do iterators become invalid? Give examples for std::vector.
- Explain the main standard library algorithms: std::sort, std::find_if, std::transform, std::accumulate.
- What are lambda expressions? Explain capture by value and by reference in the capture list.
- What is the ranges library? Compare the std::ranges algorithms with the classic algorithms.
- Explain the range views std::views::filter and std::views::transform and their lazy evaluation.
- What are std::function and function objects for?
Topic 15. Streams and files
- Describe the hierarchy of C++ input/output streams: istream, ostream, fstream, stringstream.
- How do you read and write text files with std::ifstream and std::ofstream? How do you check the state of a stream?
- How do you work with binary files: open modes, the read, write, seekg and tellg methods?
- How do you format data with std::format and stream manipulators?
- What does the std::filesystem library offer for working with paths, files and directories?
- How do you handle input/output errors and guarantee that files are closed?
Topic 16. Modules and C++26
- How do you organize a multi-file C++ project: header files, implementation files, include guards?
- Explain the one definition rule (ODR) and the role of the extern, static and inline keywords.
- What are C++ modules? Explain the export module and import declarations.
- Compare modules and header files. How do you import the standard library with import std?
- How do you create and use static and dynamic libraries in Visual Studio 2026?
- Explain the purpose of the C++26 features: reflection, contracts and the std::execution facilities. How do you distinguish the specification from support by a particular compiler and library, and check availability before use?