Yes, you need to generate your options array dynamically before the $form['selected'] array definition like this:
$myOptionsArray = myOptionsCallback($param1, $param2);
$form['selected'] = array(
'#type' => 'select',
'#title' => t('Selected'),
'#options' => $myOptionsArray,
'#default_value' => $category['selected'],
'#description' => t('Set this to <em>Yes</em> if you would like this category to be selected by default.'),
);