As I was digging up/down staircases straight down the Z-level, I hit upon a cavern. I'd like to seal it off now so I don't get attacked by the underground mobs. There's only one up/down staircase that I need to seal off. How do I seal it?
As Jupotter notes, a constructed wall or floor will do the trick.
If you're in a hurry, and happen to have some spare doors or hatch covers lying nearby, you may want to build one of those first and forbid it once it's done — I believe building a door or hatch is faster than building a construction. However, you should generally not rely on doors and hatches alone to seal off passages unless you like living dangerously, since many tougher enemies, including forgotten beasts, can destroy them.
However, there are two notable exceptions to that, one of which may be relevant here: building destroyers can't destroy artifact doors or hatches, and, for some reason (which might constitute a bug) they can't destroy hatches from below.
There are a number of ways to close a staircase, unless the mechanics have massively changed since I last played DF.
Your easiest way, that keeps your options open for the future, is to build a stone floor over the top of the hole. You could also craft and build a stone hatch and then lock it. If the up/down is part of a staircase shaft then you will have to go up a level to create a down that connects to an up on the level where your original staircase ran out. For a permanent block, you can mine out the staircase and plug it with stone.