Test Your C++ Knowledge
3 Questions
1 Views

Test Your C++ Knowledge

Questions and Answers

Which of the following is NOT a feature of C++?

  • Object-oriented programming
  • Procedural programming
  • Generic programming
  • Functional programming (correct)
  • What is the purpose of the C++ Core Guidelines?

  • To provide a library of pre-written code for common tasks
  • To provide a set of principles for C++ programming (correct)
  • To standardize the language across different platforms
  • To provide a tool for debugging C++ code
  • Which of the following is true about C++ templates?

  • They are not supported in the latest C++ standard
  • They can decrease code size (correct)
  • They are used for memory management
  • They are only used for generic programming
  • Study Notes

    • C++ is a high-level, general-purpose programming language created by Bjarne Stroustrup.
    • It was first released in 1985 as an extension of the C programming language.
    • C++ currently has object-oriented, generic, and functional features, in addition to facilities for low-level memory manipulation.
    • C++ is almost always implemented as a compiled language.
    • C++ was designed with systems programming and resource-constrained software in mind.
    • C++ is standardized by the International Organization for Standardization (ISO), with the latest standard version ratified and published by ISO in December 2020 as ISO/IEC 14882:2020 (informally known as C++20).
    • C++ has been used in desktop applications, video games, servers, and performance-critical applications.
    • The language has evolved over time, with new features added in C++11, C++14, C++17, and C++20.
    • C++ is guided by a set of principles, including standardization, hardware access, and efficient and elegant abstractions.
    • C++ supports four types of memory management: static storage duration objects, thread storage duration objects, automatic storage duration objects, and dynamic storage duration objects.
    1. C++ has four storage duration types: static, thread, automatic, and dynamic.
    2. Static initialization initializes objects with zeros and constant expressions.
    3. Dynamic initialization involves object initialization with a constructor or function call.
    4. Thread storage duration objects are created just before thread creation and destroyed after thread joining.
    5. Automatic storage duration objects have a limited lifetime within the scope of the variable.
    6. Local variables are created and initialized at the declaration point and destroyed at the end of the block or function.
    7. Member variables are created when the parent object is created and destroyed in the reverse order of creation.
    8. Temporary variables are created as a result of expression evaluation and destroyed when the statement is fully evaluated.
    9. C++ templates enable generic programming and may increase code size.
    10. C++ offers classes that provide encapsulation, inheritance, and polymorphism, with deterministic destructors supporting RAII.
    • C++ is a programming language that supports multiple paradigms, including procedural, object-oriented, and generic programming.
    • C++ supports features such as classes, inheritance, polymorphism, templates, and operator overloading.
    • Classes are user-defined types that encapsulate data and functions.
    • Inheritance allows a class to inherit properties and behavior from another class.
    • Polymorphism enables a common interface for many implementations, and objects to act differently under different circumstances.
    • C++ supports several kinds of static and dynamic polymorphisms, including function overloading, templates, and virtual member functions.
    • Lambda expressions provide support for anonymous functions.
    • Exception handling is used to communicate the existence of a runtime problem or error from where it was detected to where the issue can be handled.
    • C++ provides more than 35 operators, covering basic arithmetic, bit manipulation, indirection, comparisons, logical operations, and others.
    • Overloadable operators are essential for making user-defined types in C++ seem like built-in types.
    • Some C++ style guides forbid the usage of exceptions.
    • Exceptions are handled in separate blocks.
    • Enumerated types are present in the C++ standard library.
    • The C++ library is based on the Standard Template Library (STL).
    • The C++ Core Guidelines are an initiative to help programmers write type and resource safe C++.
    • C++ is often considered to be a superset of C, but there are differences.
    • C++ allows for intermixing C and C++ code.
    • C++ has been criticized for its perceived complexity and feature creep.
    • C++ does not have reflection or garbage collection.
    • Long compilation times and verbose error messages are other complaints about C++.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge of the complex programming language C++ with this quiz! From its history and evolution to its memory management and polymorphism features, this quiz covers various aspects of C++. You'll also get to test your understanding of C++ templates, classes, inheritance, exception handling, and operator overloading. Whether you're a beginner or an experienced programmer, this quiz will challenge your knowledge and help you learn more about this powerful language.

    Use Quizgecko on...
    Browser
    Browser