a) should end in he failed the test. However, the expression "canned him" means fired or dismissed from a job. A teacher wouldn't "fire" a student. Did you mean the teacher CANED him? (Gosh, I hope not, as I hope teachers aren't caning students in this century!)
b) Either of these are correct. To say one bought "an" ice cream means one bought either a cone or a dish of ice cream. S