Yes, I understand. The keyboard is connected to the motherboard via a cable internally. Sometimes that connection can loosen. If you are comfortable opening the laptop, it should be a simple matter to check the connection.
If you want to run a simple check to give you a better idea if it is hw or sw related, you can boot to safe mode and see if the problem continues. If it does, it is almost certainly a hw issue and we're back to checking the cable connection as a first step.
With respect John, it's the most likely cause of the problem. Though I do agree that if the OP is not comfortable opening the case it's best left to someone who is. Anyway, if you prefer to jump in I'll defer and bow out. I'm new to this forum (though far from new to support forums ) and certainly don't want to cause any problems.
A forum community dedicated to tech experts and enthusiasts. Come join the discussion about articles, computer security, Mac, Microsoft, Linux, hardware, networking, gaming, reviews, accessories, and more!