Macbook Pro 2011 A1278 Keyboard Diagnosis A MBP keyboard is unreliable to the point where a USB keyboard is a workaround.   

Googled the issue presents many software based remedies.  

What tests can be performed to confirm that that the problem is hardware? or software?

Is this a known defect with this particular model?
You are lucky to have a keyboard that lasted 7 Years.

Normally their life span is much less, and it depends on your eating habits (yes, eating, believe it or not). 

Best way to keep it clean and last longer in the future


use compressed air can from time to time
buy a ~$6 transparent cover foil made to fit your model keyboard
replacing individual keys is possible if you are a surgeon
no comment on eating habits


As for hardware test, use the builtin Apple Hardware test. That might show a problem or not.

Hold D key during restart and follow the instructions.