Question:
Using the letters $A$ and $B$, the following two-letter code words can be formed: $AA$, $AB$, $BB$, $BA$. Using the letters $A$, $B$, and $C$, how many different three-letter code words can be formed?

Answer:
Make a tree-diagram for all three-letter code words starting with $A$. Each path from the top to the bottom contains 3 letters, which is one of the code words beginning with $A$. There are 9 such code words. Clearly, there are 9 code words starting with $B$ and 9 starting with $C$. In all, there are $\boxed{27}$ code words.

[asy]

draw((-10,-8)--(0,0)--(10,-8));
label("$A$",(0,0),N);

draw((-12,-18)--(-10,-12)--(-10,-18));
draw((-10,-12)--(-8,-18));

label("$A$",(-10,-10));
label("$A$",(-12,-18),S);
label("$B$",(-10,-18),S);
label("$C$",(-8,-18),S);

draw((0,0)--(0,-8));

draw((-2,-18)--(0,-12)--(0,-18));
draw((0,-12)--(2,-18));

label("$B$",(0,-10));
label("$A$",(-2,-18),S);
label("$B$",(0,-18),S);
label("$C$",(2,-18),S);

draw((8,-18)--(10,-12)--(10,-18));
draw((10,-12)--(12,-18));

label("$C$",(10,-10));
label("$A$",(8,-18),S);
label("$B$",(10,-18),S);
label("$C$",(12,-18),S);

[/asy]