Generally it would be either an human error or a machine error. The information that was put into the grading system may have been incorrect, or for some reason the program itself may not have been functioning properly. Or maybe your teacher got the grades mixed up and put the grade for a test in a homework spot and put the grade for the homework in the test spot. But most of the time this mistake is caused by humans.