Color theme
0 day streak0 XPP1
C++Quiz mode
MISSION 1 OF 3

Add a reserved seat

0 XP earned
C++ track: MasterMission: BeginnerVectorsAppending elementsContainer size
Before you start this master track

Typed functions and collections. Be ready to reason about references, aliasing, and iterators.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 6 challenges
KNOWLEDGE CHECK

Predict the result.

What final seat and vector size are printed?

mission.cpp
#include <iostream>#include <string>#include <vector>int main() {  std::vector<std::string> seats = {"A1", "B2"};  seats.push_back("C4");  std::cout << seats.back() << " / " << seats.size() << '\n';}

Each example is a complete C++17 console program with its own main function and required standard-library headers. Compile and run one mission at a time.

Review the lesson

A vector stores a sequence and can grow when another element is added. The string element type keeps each seat label as text. push_back appends a seat after the existing entries. back reads the last entry, while size reports how many entries the vector currently contains.

Choose your answer+25 XP on first completion