Skip to content
main-logo
  • +91 637-050-2482
  • santuitreturns@gmail.com
Menu
Menu
  • Home
  • Income Tax
    • Income From Salary
    • Profit or gain from Business/Profession.
    • Capital Gain
    • Income From Other Sources
    • 80C to 80U
    • TDS & TCS
    • ITR FORMS
  • International Taxation
    • Transfer Pricing
    • Non-Resident Taxation
    • Foreign Tax Credit (FTC)
    • Model Tax Convention
    • Base Erosion and Profit Shifting (BEPS)
  • GST
  • Accounting
  • MCQs
    • NEET
    • NEET QUIZ TEST
    • NEET PG MCQ’s
    • NEET PG QUIZ TEST
    • Civil Engineering
    • Mechanical Engineering MCQs
    • CHSL EXAM
      • Logical Reasoning
  • Others
    • Job Tips
  • CA Courses
    • CA Inter/IPCC

10+ TOP C++ MCQs on Templates

Posted on September 25, 2023

1. Which of the following is used for generic programming?

A. Virtual functions
B. Modules
C. Templates
D. Abstract Classes

View Answer

Answer: C

Explanation: 

 Templates are used for generic programming. They help in making generic functions and classes hence achieving the generic codes.

2. Which of the following is correct about templates?

A. It is a type of compile time polymorphism
B. It allows the programmer to write one code for all data types
C. Helps in generic programming
D. All of the mentioned

View Answer

Answer: D

Explanation:

 Templates are used for generic programming hence allowing to write a single function for all data types. It is a type of compile time polymorphism.

3. How many components STL has?

A. 1
B. 2
C. 3
D. 4

View Answer

Answer: D

Explanation:

 STL has four components namely Algorithms, Containers, Functors and Iterators.

4. What are the containers?

A. Containers store objects and data
B. Containers stores all the algorithms
C. Containers contain overloaded functions
D. Containers contain set of Iterators

View Answer

Answer: A

Explanation:

 Containers is a component of STL which stores objects and data.

5. In how many categories, containers are divided?

A. 1
B. 2
C. 3
D. 4

View Answer

Answer: D

Explanation:

 Containers are divided into 4 categories namely Sequence Containers, Associative Containers, Unordered Associative Containers and Container Adaptors.

6. What are the Sequence Containers?

A. Containers that implements data structures which can be accessed sequentially
B. Containers that implements sorted data structures for fast search in O(logn)
C. Containers that implements unsorted(hasheD. data structures for quick search in O(1)
D. Containers that implements data structures which can be accessed non-sequentially

View Answer

Answer: A

Explanation:

 Sequence Containers is the subset of Containers that implements data structures which can be accessed sequentially.

7. How many Sequence Containers are provided by C++?

A. 2
B. 3
C. 4
D. 5

View Answer

Answer: D

Explanation:

 C++ provides 5 types of Sequence Containers namely array, vector, deque, forward_list and list.

8. What are the Associative Containers?

A. Containers that implements data structures which can be accessed sequentially
B. Containers that implements sorted data structures for fast search in O(logn)
C. Containers that implements unsorted(hasheD. data structures for quick search in O(1)
D. Containers that implements data structures which can be accessed non-sequentially

View Answer

Answer: B

Explanation:

 Associative Containers is the subset of Containers that implements sorted data structures for fast search in O(logn).

9. How many Associative Containers are provided by C++?

A. 2
B. 3
C. 4
D. 5

View Answer

Answer: C

Explanation:

 C++ provides 4 types of Associative Containers namely Set, Map, multiset and multimap.

10. What are Unordered Associative Containers?

A. Containers that implements data structures which can be accessed sequentially
B. Containers that implements sorted data structures for fast search in O(logn)
C. Containers that implements unsorted(hasheD. data structures for quick search in O(1)
D. Containers that implements data structures which can be accessed non-sequentially

View Answer

Answer: C

Explanation:

 Unordered Associative Containers is the subset of Containers that implements unsorted(hasheD. data structures for quick search in O(1) amortized O(n) Worst case complexity.

11. What are Container Adaptors?

A. Containers that implements data structures which can be accessed sequentially
B. Containers that implements sorted data structures for fast search in O(logn)
C. Containers that implements unsorted(hasheD. data structures for quick search in O(1)
D. Containers that provide a different interface for sequential containers

View Answer

Answer: D

Explanation:

 Container Adaptors is the subset of Containers that provides a different interface for sequential containers.

12. How many Container Adaptors are provided by C++?

A. 2
B. 3
C. 4
D. 5

View Answer

Answer: B

Explanation:

 C++ provides 3 types of Container Adaptors namely Stack, Queue and Priority Queues.

13. What are Iterators?

A. Iterators are used to iterate over C-like arrays
B. Iterators are used to iterate over pointers
C. Iterators are used to point memory addresses of STL containers
D. Iterators are used to iterate over functions

View Answer

Answer: C

Explanation:

 In C++, Iterators are provided to iterate over the STL containers.

14. How many types of Iterators are provided by C++?

A. 2
B. 3
C. 4
D. 5

View Answer

Answer: D

Explanation:

 There are five types of Iterators provided by C++ namely Input Iterators, Output Iterators, Forward Iterators, Bi-directional Iterators and Random-access Iterators.

15. Which header file is used for Iterators?

A. <iterator>
B. <algorithm>
C. <iter>
D. <loopIter>

View Answer

Answer: A

Explanation:

 Iterators are present inside the <iterator> header file so this header file is needed to use Iterators.

    You May Also Like...

  • 10+ TOP MCQs on C++ Basic Concepts
  • 10+ TOP MCQs on C++ Types
  • 10+ TOP C++ MCQs on Booleans
  • 10+ TOP C++ MCQs on Arrays
  • 10+ TOP C++ MCQs on Pointers into Arrays
  • 10+ TOP C++ MCQs on Header Files Usage
  • 10+ TOP C++ MCQs on Classes – 2
  • 10+ TOP C++ MCQs on Large Objects

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Quick Links

  • Home
  • About Us
  • Privacy Policy
  • Terms of Use
  • Disclaimer
  • Contact Us

Categories

  • Income Tax
  • International Taxation
  • GST
  • MCQs
  • Others
  • CA Courses

Latest Posts

  • Five changes in ITR forms of FY 2024-25 (AY 2025-26)
  • Form 10-IEA: Option to Choose Old Tax Regime
  • What is Section 54EC of the Income Tax Act?
  • What is Section 54F of the Income Tax Act?
©2025 Online Solves. All rights Reserved | Developed by AlgoPage IT Solutions Pvt. Ltd.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT