Ok, do you have any USB keyboard available? As long as it will plug in a USB port it will serve.
Try it and see what happens, if it works then the keyboard circuit board is bad, if it repeats what the built in one does then something else is bad.
With it plugged in do a pram reset using the external keyboard.
To do a PRAM reset, you need to restart your machine and hold down these 4 keys all together at the same time.
‘Option’, ‘Command (Cloverleaf or Apple)’, ‘R’ and 'P' all together at the same time.
Keep them down until you hear 4 startup chimes, this is the sound that your computer makes when it starts up, it is like a boonngg. The screen should also cycle from white to black and then back to white along with the chimes.
The sound should also get louder.
This resets all of the system buses on your computer, USB, FireWire, display, ethernet and your keyboard/mouse/trackpad.
This will correct many faults but not necessarily yours.
Let me know please.