To toggle the questions to optional, the button would query the DB, find all questions in the current survey with mandatory=Y and change them to mandatory=M.
We need to use "M" so we can find them to toggle them back later.
The system would see "M" as non-mandatory so all of these questions could now be skipped in a Q/A process.
This way only the questions that the survey author had set to mandatory would be affected.
To toggle the questions back to mandatory, the button would query the DB, find all questions in the current survey with mandatory=M and change them to mandatory=Y.
I've put together a little php script to demonstrate the concept that you can grab at
http://partnersinc.biz/testsites/misc_images/mandatory_toggle.txt (can't seem to attach anything here!).