So basically here we have two set of arrangements:
One is straight line: photograph
Another is circular : dining
For straight line configuration:
number of possible arrangements is n!
or in simple words the first person will have n options, the next in line will have n-1 and so on
so total arrangements = n*n-1*n-2....3.2.1 = n!
Looking at the options:
6 = 3!
120 = 5!
5040= 7!
20160 = 4*7!
40320 = 8!
80640 = 2*8!
Since the number we are looking at is a perfect factorial. Hence, except D and F all are not possible
For circular configuration:
the total possible arrangements = n-1!
or the first person will have n options to sit, the second will have n-1 options to sit and so on.
Total ways = n*n-1*n-2*.....4.3.2.1 = n!
The only difference here from straight configuration is that we do not have a starting and ending positions. Every place is similar. Hence, every scenario will be repeated n times
so total possible arrangements = n!/n = n-1!
So combining both the solutions we get
n! = 40320 and n-1! = 5040
hence n = 8