Section Exercises

True or False

chevron-rightrax register is used for storing the return value of a subroutine. hashtag

True!

chevron-rightrdx is usually used to store the fourth argument and it is commonly used as loop counter.hashtag

False!

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

chevron-rightrdi, rsi, and rdx are caller-saved registers.hashtag

True!

chevron-rightax, di, si, and dx store 8 bits.hashtag

False!

ax, di, si, and dx store 16 bits.

chevron-rightAny register starting with letter r (e.g. rax, rbx, rdi) indicates that it stores 64 bits.hashtag

True!

chevron-rightRegisters are the fastest and smallest unit of storage available to the CPU.hashtag

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.

Multiple Choice

How many bytes can be stored in esi?

chevron-right 1 bytehashtag

Wrong!

chevron-right2 byteshashtag

Wrong!

chevron-right4 byteshashtag

Correct!

chevron-right8 byteshashtag

Wrong!

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

chevron-rightrsi, rdi, rdxhashtag

Wrong!

rdi stores the first argument while rsi stores the second.

chevron-rightrsi, rdx, rcxhashtag

Wrong!

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

chevron-rightrdi, rsi, rdxhashtag

Correct!

chevron-rightrdi, rsi, rbxhashtag

Wrong!

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.

Last updated