The correct option is D 2n−2
1 can give output in 2 ways either 1 or 2
2 can give output in 2 ways either 1 or 2, and so on till n
hence we can say that 1,2,3...,n can give output in 2n ways
but in this 2 functions will be such that all input 1,2,3,...,n will give output only 1 or only 2.
Therefore, number of surjective functions is 2n−2
Hence, option 'D' is correct.