Two basic things you need to check for when shopping for a guitar (especially the cheapo type you're thinking of buying).
1) Make sure the neck is straight
Hold the Guitar at This Angle Close one eye and sight along the fretboard edge to see if there is any bow in the neck.
2) Play every note on the guitar one-by-one on each string. Listen to make sure they don't buzz. [It's no big deal if there is a little buzzing on the thick 'E' string or 'A' string down past the 17th fret since you won't be playing there much (if at all).]