Why do some resolutions show black bars while others are stretched?

When in fullscreen and using

UKismetSystemLibrary::GetSupportedFullscreenResolutions(SupportedResolutions);

to get supported fullscreen resolutions and then

UGameUserSettings::GetGameUserSettings()->SetScreenResolution(Resolution);

to set to one of the resolutions, sometimes the content is stretched across the screen and other times the content is shown with black bars on the left and right.

What controls this? The camera has been set to not have black bars but not all resolutions seem to behave the same.

Examples:

1280 x 1440 - Stretched
1280 x 1024 - Stretched

1280 x 960 - Bars
1344 x 1008 - Bars
1600 x 1200 - Bars

Looking more into it, the physical screen itself has a Wide Screen mode and a 4:3 mode which shows with black bars. The bars show up on 4:3 aspect ratios so it seems that the issue is with the screen only showing those resolutions with bars.