Dig one's own grave : Dig one's own grave is an idiom. Dig one's own grave means to bring misfortune or making difficulties for oneself. For example: If you are a businessman and making a good profit because of your trade secret. If you reveal the secret to your contemporary , then you are digging your own grave . The person to whom you had let out the secret will use the same and may even profit more than you. Therefore,don't dig your own grave by revealing business secrets even to your closest friends.
The student was sent out of the examination hall because he allowed his friend to copy from his answer sheet. He has dug his own grave by trying to favor his friend.
The course is not cut out for you. If you take it up, you will dig your own grave.