Children under the age of eight years are incapable of committing crime. Children of eight and under twelve years of age are presumed to be incapable of committing crime, but this presumption may be removed by proof that they have sufficient capacity to understand the act or neglect, and to know that it was wrong. Whenever in legal proceedings it becomes necessary to determine the age of a child, he or she may be produced for inspection, to enable the court or jury to determine the age thereby; and the court may also direct his or her examination by one or more physicians, whose opinion shall be competent evidence upon the question of his or her age.