Q&A Notes: The Standard Template Library

Table of Contents


1. Traditional arrays:

  1. How do you declare a traditional array? (Give example code)
  2. How do you assign values to elements of a traditional array? (Give example code)
  3. How do you iterate over the entire array and display each index and element value? (Give example code)
  4. How do you get the size of a traditional array?

2. STL array:

STL Array documentation: https://cplusplus.com/reference/array/array/

  1. How do you declare an array object? (Give example code)
  2. How do you assign values to elements of an array object? (Give example code)
  3. How do you iterate over the entire array and display each index and element value? (Give example code)
  4. How do you get the size of an array object? (Give example code)

3. STL vector:

STL Vector documentation: https://cplusplus.com/reference/vector/vector/

  1. Behind the scenes, a vector is what kind of structure? (Is it a dynamic array or node-based?)
  2. How do you declare a vector? (Give example code)
  3. How do you push a new item to the vector? (Give example code)
  4. How do you iterate over all items in a vector and display each one? (Give example code)
  5. How do you get the size of a vector? (Give example code)

4. STL list:

STL List documentation: https://cplusplus.com/reference/list/list/

  1. Behind the scenes, a list is what kind of structure? (Is it a dynamic array or node-based?)
  2. How do you push a new item to the front of the list? (Give example code)
  3. How do you push a new item to the back of the list? (Give example code)
  4. How do you iterate over the entire list and display each element value? (Give example code)
  5. How do you get the size of a list? (Give example code)

5. STL map:

STL Map documentation: https://cplusplus.com/reference/map/map/

  1. How do you declare a map? (Give example code)
  2. How do you add a new item to the map? (Give example code)
  3. How do you iterate over all items in a map and display each one's KEY and VALUE? (Give example code)
  4. How do you access a specific element of a map, given a key provided? (Give example code)

6. STL stack:

STL Stack documentation: https://cplusplus.com/reference/stack/stack/

  1. How do you declare a stack? (Give example code)
  2. How do you push an item onto a stack? (Give example code)
  3. How do you pop an item from a stack? (Give example code)
  4. How do you access an item at the top of a stack? (Give example code)
  5. The Stack structure is Last In, __ Out.

7. STL queue:

STL Queue documentation: https://cplusplus.com/reference/queue/queue/

  1. How do you declare a queue? (Give example code)
  2. How do you push an item onto a queue? (Give example code)
  3. How do you pop an item from a queue? (Give example code)
  4. How do you access an item at the front of a queue? (Give example code)
  5. The Queue structure is First In, __ Out.

Author: Rachel Wil Sha Singh

Created: 2023-09-10 Sun 17:13

Validate