C++ Containers & Iterators Aptitude Questions and Answers

C++ Containers & Iterators Aptitude: This section contains C++ Containers & Iterators Aptitude Questions and Answers with explanations.
Submitted by Nidhi, on February 20, 2021

1) There are the following statements that are given below, which of them are correct about containers in C++?

  1. Containers are objects that are used to hold the same type of data.
  2. We can implement different data structures using containers in C++.
  3. Both of the above
  4. None of the above

Options:

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

2) Which of the following are correct types of containers in C++?

  1. Associative containers
  2. Sequence containers
  3. Derived containers
  4. Logical containers

Options:

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

3) Which of the following are correct sequence containers used in C++?

  1. vector
  2. set
  3. stack
  4. list

Options:

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

4) Which of the following are correct associative containers used in C++?

  1. deque
  2. set
  3. map
  4. queue

Options:

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

5) The stack is a sequence container?

  1. Yes
  2. No

6) There are the following statements that are given below, which of them are correct about iterators in C++?

  1. Iterators are just like pointers that are used to access elements from containers.
  2. We can move from one element to another element sequentially.
  3. Iterators are predefined structures.
  4. All of the above

Options:

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

7) Which of the following function are used by iterators in C++?

  1. begin()
  2. end()
  3. random()
  4. movebyindex()

Options:

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

8) Which of the following are correct types of iterators used in C++?

  1. Input iterator
  2. Output iterator
  3. Forward iterator
  4. Random Access iterator

Options:

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

9) Which of the following statements are correct about output iterators?

  1. Output iterators are used to modify the value of elements in a container.
  2. Output iterators are write-only iterators. We cannot read the value of containers.
  3. Output iterators are one-way iterators.
  4. None of the above

Options:

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

10) Which of the following are two-way iterators?

  1. Input iterator
  2. Output iterator
  3. Bidirectional iterator
  4. Random access iterator

Options:

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

11) Which of the following are correct operations are supported by iterators in C++?

  1. Read operations
  2. Write operations
  3. Increment operations
  4. Comparison operations

Options:

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

12) Which of the following algorithms are used for containers in C++?

  1. Sorting algorithms
  2. Relational algorithms
  3. Mutating algorithms
  4. Exception based algorithms

Options:

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

13) Which of the following algorithm does not alter the container objects?

  1. Mutating algorithm
  2. Non-Mutating algorithm
  3. Both
  4. None

14) Which of the following statements are correct about function objects in C++?

  1. A function object is a function that wrapped in class then it looks like objects.
  2. Function objects are faster than normal functions.
  3. Function objects contain attributes and member functions.
  4. Function objects are slower than normal functions.

Options:

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

15) A function object is also known as functor?

  1. Yes
  2. No






Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.