Yes, you can.
The long story short on cave-ins is that if something is unsupported, it will fall. Supports are great for doing this, because they can be linked to pressure plates or levers, so that you can make them not support at will.
Utilizing caveins is, in my opinion, the best way to hollow out large cavities. You just mine out the walls so you have a huge volume of floors only, then you engineer a cavein and it will punch through all those floors and stop when it hits a 'thick' floor (there's a wall under the floor, a support may also work, I've never tried it). Once you get the hang of it, you can designate the whole thing almost all at once (you have to leave what you're going to cave in supported, then build a support which you will link, then destroy the last natural support)
Cave-ins as defenses are also good, but can be difficult to engineer underground. The easiest form of cave-in defense is above ground. The basic model is thus: You build a 2zlevel tall stairway near where you want to put the trap(s). You then build a 2x1 floor 1zlevel above ground, and build a support on the farthest floor. You build a 1x1 bridge 2zlevels above the ground (make sure it's above the floor you made). Once the support is built, you build a floor above the support (it's built while standing on the bridge). Build a pressure plate under the support/floor and link it to the support.
You're done! When something sets off the pressure plate, it will deconstruct the support, causing the floor 2zlevels up to fall since the bridge doesn't provide any support. It will crash through the floor that the support was built on, and squish the thing that triggered the pressure plate (and the dust will mess up anything else nearby.
To make more than one landmine off a single stairstack, just make the 1zlevel up floor 2 tiles wide, and run the bridge parallel to one of the side. You can even make it so that you can mostly reset it before the siege is even over by making the stairstack much taller than 2zlevels and have secure access (like the stairs coming from underground and walls protecting the stairstack), and then you just build the floor/supports and bridge/floors at the top two zlevels of the stairstack. This way your dwarves can start building in safety, and you only have to wait for the gobbos to go away to do the final pressure plate construction and linkage (or you can just collapse large sections of flooring by lever and just try to time it right).
You just have to make sure you don't have any hollows 1zlevel below the surface of where you're going to be dropping those floor segments, or you'll keep punching holes in your fort and potentially kill your own dwarves (and leave them subject to archer fire)