The number of ways to select r things out of n given things wherein r ≤ n is given by: 
Given: There are 5 subjects and for a student to pass in an examination the students has to pass in each of the 5 subjects.
Here, we have to find in how many ways a student can fail in the examination.
In order to fail in the examination the student can fail in 1 or 2 or 3 or 4 or 5 subjects out of the 5 subjects in each case.
Case 1: Student fails in any 1 subject out of the 5 subjects.
No. of ways in which student can fail in any 1 subject out of the 5 subjects = 5C1
Case 2: Student fails in any 2 subjects out of the 5 subjects.
No. of ways in which student can fail in any 2 subjects out of the 5 subjects = 5C2
Case 3 : Student fails in any 3 subjects out of the 5 subjects.
No. of ways in which student can fail in any 3 subjects out of the 5 subjects = 5C3
Case 4: Student fails in any 4 subjects out of the 5 subjects.
No. of ways in which student can fail in any 4 subjects out of the 5 subjects = 5C4
Case 5: Student fails in all 5 subjects.
No. of ways in which student can fail all 5 subjects. = 5C5
∴ Total number of ways in which a student can fail in an examination
= 5C1 + 5C2 + 5C3 + 5C4 + 5C5 = 31
Hence, the correct option is (A).