A first, second, third or subsequent year resident has yet to be 'Board Certified' in the particular specialty which may be handling whatever malady which may have afflicted you. As such they are participating members of the team of physicians in training who are collectively responsible for your diagnosis, care, and treatment which is supervised by the "attending" physician/surgeon.
There is never a question regarding the hierarchy, as this is a subject repetitively emphasized on a daily basis during residency. The attending physician utilizes residents as an extension of his/her reach in the care of patients admitted to his/her particular service.
While there may be errors in evaluating data or clinical impression these are corrected by the more senior resident or attending physician during daily patient "rounds" which may take place in the patient's presence or elsewhere, but it is daily, and it is patient-specific.
One will only find residents in teaching hospitals and very infrequently in community hospitals. Community hospitals are staffed primarily by residency trained and board-certified physicians who have passed the hospital's credentialing process and given privileges to practice there. Consequently, it is unlikely you will find, or be treated by a resident.
The only caveat I would offer is that if you or your primary care doctor believes you have a straight-forward medical or surgical issue then don't go to a teaching hospital, go to a good community hospital where common things happen commonly and are treated efficiently.
Conversely, if you happen to have symptoms that baffle your primary care doctor and he or she doesn't recommend evaluation at a teaching hospital then find one. The more minds considering your dilemma the better. Dercum's disease is best treated at a teaching hospital while appendicitis has a better outcome at a community hospital.
Keep in mind that the best diagnostician started out as a resident.