+91 90691 39140 | +1 253 214 3115 | info@hub4tech.com | hub4tech

C++ Containers Interview Questions and Answers

1
When should we use container classes instead of arrays?

It is advisable to use container classes of the STL so that you don’t have to go through the pain of writing the entire code for handling collisions, making sure its working well, testing it repeatedly with an overhead of time consumption.

Suppose you have some data that has values associated with strings and its fields consist of grades> in this situation you can directly use hash table instead of having it created by yourself.

2
What is Iterator class?

An iterator class is used to iterate through objects of the container class. An iterator is an entity that gives access to the contents of a container object.

3
Difference between a homogeneous and a heterogeneous container

A container is an object holding instances of another object. A container that contains or holds objects of a single type is said to be homogenous. On the other hand, A container that contains objects (derived from a common base class) of a variety of types is termed heterogeneous.

4
What is Input Iterator?

These iterators can read values in the forward movement. They can be incremented, compared and dereferenced.

5
What is a container class? What are the types of container classes?

A class is said to be a container class which is utilized for the purpose of holding objects in memory or persistent media. A generic class plays a role of generic holder. A container class is a good blend of predefined behavior and an interface that is well known. The purpose of container class is to hide the topology for the purpose of objects list maintenance in memory. A container class is known as heterogeneous container, when it contains a set of different objects. A container class is known as homogeneous container when it contains a set of similar objects.

Copyright ©2015 Hub4Tech.com, All Rights Reserved. Hub4Tech™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
All trademarks and logos appearing on this website are the property of their respective owners.
FOLLOW US