How many passwords of exactly $8$ upper case letters contain:(a) the letter $X$? (b) the letters $X$ and $Y$?
For the first one the answer I have written is $26^7$ as one spot is occupied by $X$ but I am still not sure of it. Help would be appreciated!
There are altogether $26^8$ passwords of $8$ letters. Of these, $25^8$ contain no X. So $26^8-25^8$ do contain X. (You might find it instructive to check that this agrees with the sum obtained by Paul Childs in his answer.)
To count the passwords that contain both X and Y, start with all $26^8$ passwords as above; subtract off $25^8$ that don't contain X and another $25^8$ that don't contain Y; realize that words that contain neither X nor Y have been subtracted off twice; so add those $24^8$ words back on. So you get $26^8-(2\times 25^8)+24^8$.