Not sure I understand your question... The key could only be one of two things based on the key signature - in your examples those are obviously C or its relative minor - A.
True, the upper voice in your 2nd example could quite easily be in A minor, but the lower voice can't really because of the implied IV-V-I progression in C major.
Not sure if that helps... I'm not 100% sure why this particularly bothers you - a lot of single line passages in tonal music suggest more than one key at any one time. That's often what makes it interesting - to eventually find out that the composer's harmonisation was not you expected but works nevertheless.
Am I making sense?