It's always a good idea to practice void meditation to quiet your mind during trance. It will help you in your meditations too. Also meditation is a good way to reflect on yourself and what needs to change.
I would like to add further on to what Samkara said
As was stated negative thoughts aren't always enemy attacks but a manifestation of your own fears or issues you've internalized.
It may have been bothering you but you've put it in the back of your mind and ignored it so now it's coming to the surface as a distraction until it's dealt with. You can void it out, but if may continue to be a problem until it's worked on.
It's sort of how you'll have dreams sometimes that seem chaotic when you're going through stress. Sometimes dreams are your minds way of revealing something you need to focus on or change. No different than intrusive thoughts during meditation or trance state, it's just in a lesser form than that of a dream.
Always be mindful and pay attention to what your mind is trying to tell you. be aware of the difference between enemy attack and subconscious fears or worries.
Enemy attack would be something disturbing or something telling you that you are worthless and will never amount to anything good and other vile negative things.
Subconscious fear may be as you said, worried you are going to fail a test and that you aren't prepared.
Or thoughts about worrying about money, your health, your living situation, whatever it is that's been stressing you out.
Enemy attacks can aggravate your subconscious fears and use them against you as well. If you don't work on yourself and try to overcome them.
It's an opening for them to mess with you through. But as long as you properly protect yourself and also once you tackle the issue at hand and fix it, and learn to overcome your worries and fears, they'll have nothing they can use against you and no way in.
It all comes with progress and advancement the more you heal your soul and start taking care of yourself and getting your life in gear the less these things will bother you. If you think you're not prepared for a test think about why. Did you grow up in a household where failure is highly frowned upon with a lot of pressure, or have you been slacking off not really studying? And you feel guilty.
There can be many reasons that lead to a fear or worry. It's always good to reflect inwards and get to the root of the issue and confide in Father Satan and the Gods about it. They will help steer you in the direction you need to go to heal yourself and overcome the issue.
Pretend you are a car, it's like the light has come on indicating you need to get gas asap because you're almost empty. If you keep ignoring it, it'll eventually run out. But if you see the warning sign and stop to fill it up and solve the issue it'll go away.
Just keep working on yourself and things will come together as they are meant to in time.