rather

  1. The students who neglected to prepare for monthly test hide in the cafeteria
    rather than risk their teacher’s wrath.
  2. The students who neglected to prepare for monthly test hide in the cafeteria
    rather risk their teacher’s wrath.
    Which one of the above sentences is meaningful and grammatical?
    If both are wrong, please correct.
  1. is the better sentence but needs a small correction:

The students who neglected to prepare for the/their monthly test hide in the cafeteria rather than risk their teacher’s wrath.
This is if the action of hiding occurs in the present.
If it occured in the past, then the sentence should be:
The students who neglected to prepare for the/their monthly test hid in the cafeteria rather than risked their teacher’s wrath.
or, depending on he time scales involved:
The students who had neglected to prepare for the/their monthly test had hidden in the cafeteria rather than risked their teacher’s wrath.

What does ‘rather than’ mean in this sentence?

It means they would prefer to hide than to face their teacher.

Scroll down to the ‘Idioms’ section here:
oald8.oxfordlearnersdictionaries … n#rather_1