These are both combination questions which is written as C(n,r), where n is the number of objects and r is the number of the sample.
1. 7 total books, 3 on the shelf:
n = 7, r = 3
The formula would be: 7! / (3!(7-3)!)
= 7*6*5*4*3*2 / (3*2(4*3*2)
=5040 / (6*24)
= 5040 / 144
= 35 different ways.
2. n = 12, r = 10
12! / (10!(12-10)!)
= 66 different ways.