Home / CSE MCQs / C++ - MCQs :: Templates - C++

CSE MCQs :: C++ - MCQs

  1. Pick out the correct statement.
  2. A.
    you only need to write one function, and it will work with many different
    B.
    it will take a long time to execute
    C.
    duplicate code is increased
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What can be passed by non-type template parameters during compile time?
  4. A.
    int
    B.
    float
    C.
    constant expression
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. From where does the template class derived?
  6. A.
    regular non-templated C++ class
    B.
    templated class
    C.
    a or b
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is meant by template parameter?
  8. A.
    It can be used to pass a type as argument
    B.
    It can be used to evaluate a type.
    C.
    It can of no return type
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Which keyword can be used in template?
  10. A.
    class
    B.
    typename
    C.
    both a & b
    D.
    function

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What is the validity of template parameters?
  12. A.
    inside that block only
    B.
    inside the class
    C.
    whole program
    D.
    any of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Why we use :: template-template parameter?
  14. A.
    binding
    B.
    rebinding
    C.
    both a & b
    D.
    none of these

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Which parameter is legal for non-type template?
  16. A.
    pointer to member
    B.
    object
    C.
    class
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Which of the things does not require instantiation?
  18. A.
    functions
    B.
    non virtual member function
    C.
    member class
    D.
    all of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What is meant by template specialization?
  20. A.
    It will have certain data types to be fixed.
    B.
    It will make certain data types to be dynamic.
    C.
    Certain data types are invalid
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum