ACtE03 · Chapter 3Programming & Applications🏛️ Past Licensure QuestionID: 7651b0a6
In the C++ Standard Template Library (STL), nested collections (such as 2D dynamic arrays) are constructed by having:
In the C++ Standard Template Library (STL), nested collections (such as 2D dynamic arrays) are constructed by having:
Multiple Choice Options
- A
Functions contained within strings
- B
Strings contained within macros
- C✓ Correct Option
Containers contained within containers (e.g.,
std::vector<std::vector<int>>) - D
Iterators contained within raw pointers
Detailed Technical Solution & Explanation
In C++ STL, containers are generic template classes that store elements. Because a container type is itself a valid type, containers can be nested inside other containers (e.g., vector<list<string>> or vector<vector<int>> to represent a 2D matrix).
Option Analysis:
•
Option A (Functions contained within strings): Invalid concept.
•
Option B (Strings contained within macros): Unrelated to container hierarchy.
•
Option C (Containers contained within container...): Correct. Canonical STL composition idiom for multi-dimensional data structures.
•
Option D (Iterators contained within raw pointers): Iterators navigate containers, not contain them.
Reference: Demo2 · Set 2NEC Licensure Syllabus