Free Practice Quiz Question List

5 Assembly Concepts Online Quiz Questions

Use this free practice quiz with 20 questions to review 5 Assembly Concepts, test your knowledge, and prepare for your next test or exam.

20 questions
01
True or false
1 point

In RISC-V, the register named zero always reads as 0.

  1. A

    True

  2. B

    False

02
Choose one
1 point

A RISC-V register t0 contains 8. After executing addi t0, t0, 3, what value does t0 contain?

  1. A

    8

  2. B

    11

  3. C

    3

  4. D

    0

03
Fill in the blank
1 point

A names a location in a program so a branch can refer to that destination symbolically.

04
True or false
1 point

In the RISC-V examples, li is a pseudoinstruction provided as assembler shorthand.

  1. A

    True

  2. B

    False

05
Choose one
1 point

Consider beq t0, t1, equal. If t0 and t1 contain the same value when this instruction executes, what happens next?

  1. A

    Execution always continues with the next instruction.

  2. B

    Execution transfers to equal.

  3. C

    Execution transfers to equal only when the register values differ.

  4. D

    The instruction changes t0 and t1 but does not affect control flow.

06
True or false
1 point

When a called procedure returns normally, control resumes at the instruction after the caller's call.

  1. A

    True

  2. B

    False

07
Choose all
1 point

Select all statements that describe the standard RISC-V register conventions presented for procedures.

  1. A

    a0 is used for the first argument and the return value.

  2. B

    ra holds the return address.

  3. C

    sp is the stack pointer.

  4. D

    t0–t6 are temporary registers.

  5. E

    a1 is the stack pointer.

  6. F

    x0 holds the return address.

08
Fill in the blank
1 point

A procedure that calls another procedure may need to save its own before making the call, because the new call updates ra.

09
Choose one
1 point

A program uses RISC-V registers such as a0 and the bge instruction. Which conclusion about using that program on a different processor architecture is best supported?

  1. A

    Assembly instructions use the same registers and names on every processor.

  2. B

    Assembly programs may need changes for another processor architecture, including changes to registers or instruction names.

  3. C

    An assembler automatically makes every program architecture-independent.

  4. D

    Only labels, not instructions or registers, depend on the processor architecture.

10
Written response
1 point

The sum_to_n procedure accumulates the integers from 1 through its positive input. What result does it return when n=6n=6?

11
Choose all
1 point

Consider this portion of sum_to_n. Select all statements that correctly describe its behavior.

  1. A

    t0 is initialized as the counter and t1 as the accumulator.

  2. B

    The counter is incremented before the branch decides whether to repeat.

  3. C

    The branch repeats while t1 is less than or equal to a0.

  4. D

    The branch repeats when a0 is greater than or equal to t0.

  5. E

    The accumulator is initialized with the value in a0.

12
Choose one
1 point

A procedure initializes its sum register to 0, then executes bge zero, a0, done before its loop. If a0 contains a negative input, what does this branch cause the procedure to do?

  1. A

    The loop runs once and returns 1.

  2. B

    The branch goes to done, so the procedure returns 0.

  3. C

    The procedure increments a0 until it becomes positive.

  4. D

    The branch goes to loop and repeats until a0 is zero.

13
Open ended
1 point

Describe how you could translate a loop that accumulates a running total into assembly. Explain how you would represent its changing values, repeated work, loop condition, and final result, without writing a complete program.

14
Choose one
1 point

What does the RISC-V instruction addi t0, t0, 1 do?

  1. A

    It adds the values in t0 and t1 and stores the result in t0.

  2. B

    It adds 1 to the value in t0 and stores the result in t0.

  3. C

    It copies the value in t0 into t1.

  4. D

    It loads the value 1 into t0, replacing its previous value.

15
Choose one
1 point

In assembly code, what role does a label such as equal play when used as the destination in a branch instruction?

  1. A

    A register reserved for storing branch conditions.

  2. B

    A constant that an instruction adds to a register.

  3. C

    A name for a location in the program that can be used as a branch or jump destination.

  4. D

    A directive that changes the processor architecture.

16
Choose one
1 point

In RISC-V assembly, what is the role of li in an instruction such as li t0, 1?

  1. A

    It is a pseudoinstruction that loads an immediate value.

  2. B

    It is a branch that runs only when two registers are equal.

  3. C

    It is a register name for the return address.

  4. D

    It is a label that marks the end of a procedure.

17
Choose one
1 point

What happens when the processor executes beq t0, t1, equal and the values in t0 and t1 are not equal?

  1. A

    It always transfers control to the destination.

  2. B

    It transfers control if the first register is less than the second.

  3. C

    It transfers control if the two registers are different.

  4. D

    It transfers control if the two registers are equal; otherwise, execution continues with the next instruction.

18
Written response
1 point

For the sum_to_n procedure shown, if the caller places 5 in a0, what integer result is returned in a0?

19
Written response
1 point

In RISC-V, t4 contains −7-7 and t5 contains 1212. What value does this instruction write to t3?

20
Written response
1 point

In RISC-V, t0 contains −3-3 and t1 contains 22. Is the branch taken?