“Brain fog” is not a medical condition.The term is used to certain symptoms that convey that ability to think is affected.
That is what you are trying to convey.
Yes Stress can cause such symptoms. Like you said that you are preparing for JEE which is a stressful event.
Try to take 7-8 hours for the sleep.
Go for a regular healthy food.
Do some exercises regularly.
Go for meditation or Yoga for the relaxation of the mind and body.
Have you undergone similar symptoms in the past?
What coping skills you used?
There are so many other questions are to be asked,
A detailed medical and other history is to be taken.
Next Steps
It will be better if you take the help of a mental health professional.
Health Tips
Sometimes Drug treatment may be needed in addition to the psychological interventions.
So take the help of a mental health professional.