I read this sentence 'The exam was an accident waiting to happen'
Is that some sort of an idiom - why didn't they say 'a disaster waiting to happen' for instance and what is meant by the idiom anyway- that they expect the exam's going to be hard?
Thank you in advance.
They could have said "disaster" -- but either way, yes, it's an idiom.
An accident waiting to happen is a dangerous situation that is almost certain to end in an accident: for example, a banana skin on a footpath might be described as an accident waiting to happen.
In this context, I think the idiom doesn't quite fit, and "disaster" might make more sense; but it is obviously intended to mean that the exam was expected to be extremely hard, most likely because the students hadn't prepared for it properly.