Correct Answer - D
Given that, A = { 1, 2, 3, …, n} and B = {a, b}.
We know that, if A and B are two non-empty finite sets containing m and n elements respectively, then the number of surjection from A into B is
`""^(n)C_(m)xxm!, if n ge m`
0, if `n lt m`
Here, m = 2
` :. ` Number of surjection from A into B is
`""^(n)C_(2)xx2! =(n!)/(2!(n-2)!)xx2!`
` " " =(n(n-1)(n-2)!)/(2xx1(n-2))xx2! =n^(2)-n`