a. This is an example of a situation making use of the concept of Fundamental Principles of Counting. On the first spot, Sam may choose from the five available flags. On the next spot, he can only choose from four flags. This goes on until no more flag is left. For short, there are 5! ways. This is equal to 120.
b. Since only 3 out of the five flags can be used and the arrangement is important, make use of Permutation. The answer is 5P3 = 60. There are 60 ways.