There are 42 principles of Ma'at,
the Ancient Egyptian personification of physical and moral law, order, and truth.
In the judgement scene described in the Egyptian and
the Book of the Coming/Going Forth by Day
(the Book of the Dead (which evolved from the Coffin Texts and the Pyramid Texts)),
there are 42 gods and goddesses of Egypt,
personifying the principles of Ma'at,
who ask questions of the departed,
while Thoth records the answers,
and the deceased's heart is weighed against the feather of Truth (Ma'at).
These 42 correspond to the 42 Nomes (Governmental Units) of Egypt.
If the departed successfully answers all 42, s/he becomes an Osiris.