A trap is a type of synchronous interrupt, often caused by attempting to divide a number by zero, a segmentation fault (if using C programming code) or encountering an internal, programmed gap or 'pause' in the code allowing the system to check whether the user's instruction should be interrupted.
If you need help with synchronous interrupts, there's plenty of guidance online. A good place to start is Chapter 17 of Randall Hyde's guide The Art of Assembly Language Programming, available to read for free at:
oopweb.com/Assembly/Documents/ArtOfAssembly. This is also available as a PDF at flint.cs.yale.edu/cs422/doc/art-of-asm.
Other sites where you can learn more about the exceptions in the user programs cause traps at mfparacuelles.blogspot.com, osfunctions.blogspot.com or slac.stanford.edu/comp/unix/package/rtem.
For other Blurtit answers to similar questions, read What are the differences between a trap and an interrupt? What is the use of each function? or What Is Meant By Interrupt? or perhaps What Is TRAP Interrupt?