In what situations must $1 remain unchanged by a subroutine?Question 13Select one:a.Only if the subroutine does not have a return value.b.Only if the subroutine calls other subroutines.c.Always. Conventions dictate that all registers are not modified by a subroutine.d.Never. Any subroutine is free to modify $1.
Solution
The correct answer is a. Only if the subroutine does not have a return value. In assembly language, the 1 register.
Similar Questions
Which of the following statements is false?Question 2Select one:a.The register $ra does not need to be backed up and restored if the subroutine does not call any other subroutine.b.A subroutine does not need to back up and restore the register $1 in any circumstances.c.The CPU will modify the value stored in $ra when "jal" is executed.d.Each subroutine has its own independent set of registers, much like local variables in C or Java.Clear my choice
Is it possible for a subroutine to comply with the WRAMP ABI conventions without decrementing/incrementing the stack pointer $sp at all?Question 3Select one:a.No.b.Yes, provided that it only modifies registers that are not being used elsewhere in the program.c.Yes, but it would have to return immediately without executing any instructions other than "jr $ra".d.Yes, provided that it does not modify any registers except $1, and does not call further subroutines.
Why must registers be backed up at the beginning of a subroutine, and restored before returning?Question 5Select one:a.Conventions dictate that all registers are moved onto the stack.b.Registers might spontaneously change value, therefore backing them up is advisable to prevent against data loss.c.A subroutine expects parameters to be stored on the stack.d.Saving/restoring registers creates the illusion that each subroutine has its own independent set of registers, despite the CPU only having a single set that's shared across the entire program.
n what situations must the return address $ra be backed up and restored by a subroutine?Question 9Select one:a.All situations.b.Only if the subroutine DOES NOT call any further subroutines.c.Only if the subroutine DOES call further subroutines.d.Only if the subroutine has a return value.
In terms of the physical hardware, what is special about register $1?Question 15Select one:a.It is automatically saved by the CPU when the "jal" instruction is executed.b.It is automatically set to the return value when "jr $ra" is executedc.Nothing. Subroutines use it as the return value purely by convention.d.It is write-only.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.