There is a driving test. The officer might notice if the applicant didn't understand commands. The written test is not easy. You are expected to know quite a bit. It's possible to get around almost anything, though, if someone doesn't play by the rules.
My ex drove for 20 years and he had his HazMat. But he did tell me that he knew of at least one company that had paid off people so their drivers could get the HazMat cert. They were caught and everyone involved was prosecuted. But that is still really frightening.