# Section Exercises

### True or False

<details>

<summary><strong><code>rax</code></strong> register is used for storing the return value of a subroutine. </summary>

**True!**

</details>

<details>

<summary><code>rdx</code> is usually used to store the fourth argument and it is commonly used as loop counter.</summary>

**False!**

`rdx` is storing the third argument, while `rcx` is storing the fourth argument and is commonly used as a loop counter.

</details>

<details>

<summary><code>rdi</code>, <code>rsi</code>, and <code>rdx</code> are caller-saved registers.</summary>

**True!**

</details>

<details>

<summary><code>ax</code>, <code>di</code>, <code>si</code>, and <code>dx</code> store 8 bits.</summary>

**False!**

`ax`, `di`, `si`, and `dx` store 16 bits.&#x20;

</details>

<details>

<summary>Any register starting with letter r (e.g. <code>rax</code>, <code>rbx</code>, <code>rdi</code>) indicates that it stores 64 bits.</summary>

**True!**

</details>

<details>

<summary>Registers are the fastest and smallest unit of storage available to the CPU.</summary>

**True!**

Although they are the fastest, they are the most expensive. Because of this, the CPU has a limited number of registers, some of which are designed for specific functionality. To review the memory hierarchy, see the Memory section.

</details>

### Multiple Choice

How many bytes can be stored in `esi`?

<details>

<summary> 1 byte</summary>

**Wrong!**

</details>

<details>

<summary>2 bytes</summary>

**Wrong!**

</details>

<details>

<summary>4 bytes</summary>

**Correct!**

</details>

<details>

<summary>8 bytes</summary>

**Wrong!**

</details>



Which registers are used to store the first three arguments of a function? (Specify in order)

<details>

<summary><code>rsi, rdi, rdx</code></summary>

Wrong!&#x20;

`rdi` stores the first argument while `rsi` stores the second.

</details>

<details>

<summary><code>rsi, rdx, rcx</code></summary>

**Wrong!**&#x20;

`rsi` stores the second argument, `rdx` the third and `rcx` the fourth.

</details>

<details>

<summary><code>rdi, rsi, rdx</code></summary>

**Correct!**

</details>

<details>

<summary><code>rdi, rsi, rbx</code></summary>

**Wrong!**&#x20;

The third argument is stored in `rdx`. `rbx` can optionally be used as base pointer, but not to store the third argument of a function.

</details>
