Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

Technical Interview Questions and Answers :: C++

  • 1. Define sequence container?
  • Answer:

    Sequence container stores elements in a linear sequence like a line .Each elements are related to other by its position along the line. They all expand themselves to allow insertion to the elements and all of them support a number of operations on them.


    Element0 -> Element1 -> Element2 -> …….. -> Last element…


    /\
    |

    Begin() end()

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 2. What is meant by associative container?
  • Answer:

    Associative containers are designed to support direct access to elements using keys. They are not sequential. There are 4 types of container:
    • set
    • multiset
    • multimap
    • map

    All these containers stores data in a structure called tree which facilities fast searching, deletion and insertion.

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 3. Define derived container?
  • Answer:

    The STL provides three derived containers namely:
    Stack, queue and priority queue. These are known as Container adaptors.
    These can be created for different sequence container and it does not support the Iterators and therefore we cannot use them for data manipulation.
    However, they support two member functions pop() and push() fro implementing deleting and inserting operation.,

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 4. What is meant by algorithm?
  • Answer:

    Algorithms are a function that can be used generally across a variety of containers for processing their contents.

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 5. What is meant by STL algorithm?
  • Answer:

    STL algorithm reinforce the philosophy of reusability. By using these algorithms, programmers can save a lot of time and effort.
    To access STL Algorithm we must be included in our program.

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 6. What are the categories of STL algorithm?
  • Answer:

    STL algorithm based on the nature of operations it may be categorized s follows:
    • retrieve or non-mutating algorithm
    • Mutating algorithm
    • Sorting algorithm
    • Set algorithm
    • Relational algorithm

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 7. What is meant by list?
  • Answer:

    The list is another container that is popularly used. It supports bidirectional, linear list and provides an efficient implementation for deletion and insertion operation. Unlike a vector, which supports random access, a list can be accessed sequentially only.
    Write some important member functions of the list class?

    Function Task
    Back() Gives a reference to the last element
    Begin() Gives a reference to the first element
    Clear() Deletes all the elements
    Empty() Decides if the list is empty or not
    End() Gives refernce to the end of the list
    Erase() Deletes elements as specified
    merge() Merge two ordered list
    Insert() Insert elemements as specified
    Pop_back() Deletes the last element
    Pop_front() Deletes the first element
    Push_back() Adds an element at the end
    Push_front() Adds an element at the front

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 8. What is meant by map?
  • Answer:

    A map is a sequence of key value pairs that provides for fast retrieval based on the flag. Almost one value is held for each key; in other words, each key in a map is unique.

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 9. What is a multimap?
  • Answer:

    A multimap is a map, except that it allows duplicate keys. Naturally several values can exist for a single key. A multimap is preferred over a map. In some ways, a multimap is even cleaner and more elegant than a map.

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 10. How is an iteration over a map is carried out?
  • Answer:

    Iteration over a map is simply iteration over a sequence of pair < const key, mapped_type >. For e.g. We might print out the entries of a phone book like this
    Void f(map& phone_book) {
    Typedef map(string, number)::const_iteration CI;
    For(CI =phone_book.begin( ); p!=phone_book.end( );++p)
    cout<first<<’\t’<second<<’\n’;
    }
    A map iterator presents the elements in ascending order of its keys.

    Please Login First :
    Tags:

    No Tags on this question yet!

You can check latest and updated Infosys C++ Interview Questions and Answers on this page. You can filter the question set by the company's name. Looking for the right answer? Don't worry! You can click on view answer section and check the answer with the explanation. You can discuss the answer in the forum with other users easily. Login with Facebook and save the answer To Reading List right now!

Our site contains top IT companies placement paper and mock test to help the freshers and experienced candidate to get hands on experience on the pattern and type of questions. We have curated all the C++ technical interview questions and answers from previous candidates.