Thanks for the question, and welcome to Apple Support Communities.
The following article provides isolation steps for the symptoms you mentioned:
Use the Keyboard Viewer to test whether the keyboard keys are responding correctly when they are pressed.
1. Choose System Preferences from the Apple () menu, then choose Language & Text from the View menu (or International from the View menu in Mac OS X v10.5 or earlier).
2. Select Input Sources.
3. Select the Keyboard & Character Viewer checkbox.
4. Enable the input source for the keyboard layout you are testing by selecting the checkbox next to it.
5. Make sure that "Show Input menu in menu bar" is enabled.
6. Choose Show Keyboard Viewer from the Input menu in the menu bar, as shown.
7. The Keyboard Viewer shows the keyboard layout.
8. Type the key on the keyboard that doesn’t respond and observe whether the corresponding key highlights on the Keyboard Viewer. If it does, that particular key is functioning correctly. In the sample shown above the shift and command keys are being pressed.
9. If the mouse keys feature in the Universal Access System Preferences pane is enabled, many of the keyboard keys may not respond as expected.
10. Try starting up into single user mode to determine whether a software issue is causing the issue.