20.4k views
1 vote
suppose variable names in a programming language can be either a single uppercase letter or an uppercase letter followed by a digit. find the number of possible variable names.

1 Answer

6 votes

Answer: 286

Step-by-step explanation

We have 2 cases which are:

  1. We have a single uppercase letter and nothing else.
  2. An uppercase letter followed by a digit.

Let's explore each case separately.

  1. There are 26 letters in the English alphabet, so we have 26 choices here for case 1.
  2. There are 26 letters and 10 single digits in the set {0,1,2,3,4,5,6,7,8,9}. That gives 26*10 = 260 different possibilities for case 2.

Combine the results of each case. We get 26+260 = 286 different variable names possible.

User Tony Eastwood
by
7.9k points