The test is open-everything with the sole limitation that you neither solicit nor give help while the exam is in progress.
Submit all answers on these exam sheets. No extra sheets are allowed. If you are nervous about this, work out the problem on a separate sheet and copy your answers here. Work quickly but carefully.
| Problem | You got | Out of |
|---|---|---|
| 1 | 10 | |
| 2 | 10 | |
| 3 | 10 | |
| 4 | 10 | |
| 5 | 10 | |
| 6 | 10 | |
| 7 | 10 | |
| 8 | 10 | |
| 9 | 10 | |
| 10 | 10 | |
| TOTAL | 100 |
00032b12 ____________________________
0000fade ____________________________
00007fff ____________________________
Complement every odd-numbered bit ___________________________________
Replace it with its value mod 64 _______________________________________
Replace it with the largest multiple
of 64 less than or equal to itself ______________________________________
xor eax, ebx
xor ebx, eax
xor eax, ebx
Implement the following in NASM:
int spfft(int a, int b, int* c, int d) {
if (&b < c)
return a / b / *c % d;
else
return d * *c;
}
Write the following in assembly language (use the C calling
convention). It is supposed to compute a*log10(b).
Use the fyl2x and fldl2t instructions.
double f(double a, double b);
sub eax, ebx
cdq
and edx, eax
add ebx, edx
mystery: cdq
xor eax, edx
sub eax, edx
ret
Explain why it works.