This may be the most useless advice you'll read on here, but keep in mind that you need to later call those $q4's in the HTML form. What might help is if you just did shorthand ifs for each check, and did this:
<?php
$row['degree_id'] == 1 ? $q4[0] = 'checked'; : $q4[0] == '';
?>
That says to set $q4[0] to be the string 'checked' if degree_id is 1, and nothing if it isn't. What you can then do in the html is:
<input type="checkbox" name="degree_1" <?=$q4[0];?> />
That will spit out a "checked" into the <input /> element if degree_id is 1, which would check the box.
Again, that probably was no help at all and not what you were asking for help with, but I hope it helps in some way.