I do believe he knew what he was doing. When I was 7 I still had a lot to learn, but I had very very very very clear NO BEATING AND NO KILLING. If 7 year olds don't understand that, there would be way more killings like this.
OK, but lets say the kid is raised watching movies like "House of a 1000 Corpses" from the time he's born (I know a kid like this).
Lets say that hitting with fists, punches and slaps are a pretty common occurance.
Lets say that this kid pretty much has been left to raise himself.
With that, I can see how he could do what he did.