Related Articles
UGC-NET | UGC NET CS 2015 Jun – II | Question 1
• Last Updated : 06 Sep, 2018

How many strings of 5 digits have the property that the sum of their digits is 7?
(A) 66
(B) 330
(C) 495
(D) 99

Answer: (B)

Explanation: We have to make string which have sum = 7.There are:

```2,2,1,1,1 = 5! / 2! * 3! = 10
2,2,2,1,0 = 5! / 3!      = 20
3,1,1,1,1 = 5! / 4!      = 5
3,2,1,1,0 = 5! / 2!      = 60
3,2,2,0,0 = 5! / 2! * 2! = 30
3,3,1,0,0 = 5! / 2! * 2! = 30
4,2,1,0,0 = 5! / 2!      = 60
4,3,0,0,0 = 5! / 3!      = 20
4,1,1,1,0 = 5! / 3!      = 20
5,1,1,0,0 = 5! / 2! * 2! = 30
5,2,0,0,0 = 5! / 3!      = 20
6,1,0,0,0 = 5! / 3!      = 20
7,0,0,0,0 = 5! / 4!      = 5 ```

total = 10 + 20 + 5 + 60 + 30 + 30 + 60 + 20 + 20 + 30 + 20 + 20 + 5 = 330.
So, option (B) is correct.

Alternative method –
Lets digits are a, b, c, d, and e. Therefore,

`a + b + c + d + e = 7 `

Total number of combinations are (n-1+r)C(r) = (5-1+7)C7 = 11C7 = 11C4 = 330.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up