How many ways are there to place 7 balls in 14 boxes. Balls are numbered from 1 to 7. One box can contain only one ball. And out of 14 boxes atleast 6 boxes must contain first 6 balls. 7th ball is optional either you may put it in boxes or not.
Please explain how to solve these types of question and what approach should I use. Also if the number of boxes was 1 or 2 or 100 what approach should I use?
Assuming the order in which the balls are placed in their respective boxes doesn't matter, you can just use the combinations formula $C_{(n,k)}$,
$$C_{(n,k)}={n! \over k!(n-k)!}$$
In your case $k$ would be the number of balls being placed in the boxes, and $n$ would be the number of boxes.
The restriction that only one ball can be placed in each box simplifies the problem considerably. As for the option of keeping the $k^{th}$ ball and not placing it in any box, the formula could be modified as follows:
$${(n+1)! \over k!((n+1)-k)!}$$
$n$ becomes $n+1$ because the effect of the option of withholding the $k^{th}$ ball is essentially that of adding another box.
This will work for any number of boxes $n \geq 1$ and any number of balls $0 \leq k \leq n+1$.