This is Heinlein's Tunnel in the Sky unless he got seriously copied. The incident with a kid who owns the dog and big gun and gets killed is right out of that novel.
From the Wikipedia summary
Rod Walker is a high school student who dreams of becoming a
professional colonist. The final test of his Advanced Survival class
is to stay alive on an unfamiliar planet for between two and ten days.
Students may team up and equip themselves with whatever gear they can
carry, but are otherwise completely on their own. They are told only
that the challenges are neither insurmountable nor unreasonable. On
test day, each student walks through the Ramsbotham portal and finds
him or herself alone on a strange planet, though reasonably close to
the pickup point. Rod, acting on his older sister's advice, takes
hunting knives and basic survival gear rather than high-tech weaponry,
on the grounds that the latter could make him over-confident. The last
advice the students receive is to "watch out for stobor."
Here's the part where Rod finds the dead guy:
It looked mightily like a man on the ground and a child near him. Rod
reached, fumbled in his vest pack, got out a tiny 8-power monocular,
took a better look. The man was Johann Braun, the "child" was his
boxer dog. There was no doubt but that they were dead, for Braun was
lying like a tossed rag doll, with his head twisted around and one leg
bent under. His throat and the side of his head were a dark red
The only thing that doesn't match your recollection is the part about them not really being on another planet. That doesn't happen in Tunnel in the Sky, but at one point Rod is convinced that this is the case. Another kid points out the error in his theory. This discussion takes place in Chapter 5 "The Nova".