It's a beginner question but I am definately a beginner

so here goes....
Does mame (I'm using mame ui) automatically detect the closest resoltion of your monitor (be it arcade/pc/television) and play the closest resolution based on the information already in the mame rom?