Programmatically change the weight of a form element
You can do this directly inside hook_form_alter, like this:

function security_question_form_user_register_form_alter(&amp;$form, &amp;$form_state) {
  $form['questions']['#weight'] = -47;
}


Then there is no need to create a custom function to do it.

Another thing, you can't implement hook_form_FORM_ID_alter and then use $form_id inside that. You must implement either hook_form_alter, and check if the form id is the one you want, or implement hook_form_FORM_ID_alter and write the form id in the function name.