@ruhul sharma 5
The mode bit is just a CPU register. It's only accessible if you're already in kernel mode.
First, see how we set the mode bit when we go from User mode to Kernel mode.
The details of how it gets set, depend on the CPU design. In most common hardware, it gets set automatically when executing a special opcode that's used to perform system calls.
See here, it is not the kernel who set mode bit for himself to go into the kernel mode. It was automatically set through hardware by CPU.
You can read about this at here also.
https://stackoverflow.com/questions/13185300/where-is-the-mode-bit (2nd answer).
Now come to the kernel to user mode.
What I think.
A privileged instruction can set the mode bit to go to User mode from Kernel mode. And start executing the user instruction. There is no harm as the kernel has the access to the mode bit.
But it is not necessary.
When we start executing a non-privileged instruction. Before its execution, the CPU detects it (as we did for system call by using opcode) and set the mode bit automatically.
As we can change mode bit with non-privileged instruction. D is the correct answer. Because we are not required to have a privileged instruction for it.