Exam 3: FinalSolutions and Commentary
Part of
the homework for CS:2630, Fall 2023
|
These distributions exclude students who did not take the final exam at the appointed time.
Mean = 5.22 X Median = 4.3 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X _____X_X___X_X_X_X_X_X_X_X_X_X_X_X_X_____X___X_X_X_____X_____ 0 . 1 . 2 . 3 . 4 . 5 . 6 . 7 . 8 . 9 . 10. 11. 12. 13. 14
Mean = 13.61 X Median = 12.3 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ___________X_X_X_X_X_X_X_X_X_X_X_X_X_X_X_X_X_X___X_X_X_____X_____ 0 . 2 . 4 . 6 . 8 . 10. 12. 14. 16. 18. 20. 22. 24. 26. 28. 30
Note that MP4 and MP7 were second chances to finish MP3 and MP6 because so few turned in working solutions to MP3 and MP6. In offering a second chance, grading on MP3 and MP6 was done quickly and carelessly in order to offer rapid feedback. Because of this, the following rule was applied: Only one score was used for MP3 and MP4 and only one score for MP6 and MP7; if only one of the pair was submitted, that one was counted, but if both were submitted, only the final (more carefully graded) submission was counted.
Mean = 15.36 X Median = 15.1 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X _____________X_X_X_X_X_X_X_X_X_X_X_X_X_X_X_X_X_X___X___X___X_____ 0 . 2 . 4 . 6 . 8 . 10. 12. 14. 16. 18. 20. 22. 24. 26. 28. 30 incompetent | some degree of competence
Note that those with machine problem scores below 10 never demonstrated significant competence on nontrivial programming assignments (MP3 and up).
Several students attempted to use ChatGPT for help, giving it appropriate
credit. In general, it was a terrible helper; Chat GPT hallucinations
generally made the code it "helped with" completely unusable.
Many students never collected their graded assignments from their teaching assistants. They would almost certainly have done better on later assignments if they saw the feedback offered by the graders for their previous work.
As stated at the start of the semester, only the top 10 out of 12 scores were used. These were all multiple-choice problem sets administered on-line by ICON, with students allowed 4 attempts with unlimited time per attempt.
Mean = 27.31 XXX Median = 28.6 XXX XX X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X _______________________________________X_X_X___X_X_X_X_X_X_X_X_X_ 0 . 2 . 4 . 6 . 8 . 10. 12. 14. 16. 18. 20. 22. 24. 26. 28. 30
Mean = 56.27 X Median = 57.3 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X _____________X_X_X_X_X_X_X_X_X_X_X_X_X_X_X_X___X_X_X_X___X_______ 28. 32. 36. 40. 44. 48. 52. 56. 60. 64. 68. 72. 76. 80. 84. 88 F |- - D + -|- - C + +|- - B + +|- - A + +
The grade scale was largely determined by the extent to which student
programming assignments demonstrated any degree of competence;
Those earning grades in the D range or lower never demonstrated
significant competence on nontrivial programming assignments (MP3 and up).
Please write legibly in the space provided. Illegible and verbose answers will be penalized! The expected answers are short. This exam is open book, open-notes, closed neighbor, no phones, no internet!
This exam is worth 20 points. Each question is worth 0.5 points, so allocate about 2.5 minutes of your time per question.
bool testit( void * p ) { return (3 & (intptr_t)p) != 0; } TESTIT:___________________________ TRUNC R3,2 __________________________________ BZS DONE __________________________________ LIS R3,1 __________________________________ DONE: __________________________________ JUMPS R1 __________________________________ |
8 got this, 5 left it blank; the remainder gave answers indistinguishable from nonsense.
1 got this, 4 forgot to limit the return value to true or false, 4 others forgot to return from the function. 15 left it blank; the remainder gave answers indistinguishable from nonsense.
40 got this, 2 left it blank; the remainder gave answers indistinguishable from nonsense.
8 got this, 5 were vague but probably correct, 2 were more confused. 5 left it blank; the remainder gave answers indistinguishable from nonsense.
__________________________________ MOVE R5,R6 __________________________________ SR R5,5 __________________________________ |
4 got this, 6 used SRU instead of SR, 17 used left shifts instead of right shifts, one invented MOVESR (the Hawk only has MOVESL) and a few made various misspellings. 3 left it blank; the remainder gave answers indistinguishable from nonsense.
6 got this, 15 omitted R2, 2 used LOAD instead of LEA, 2 used STORE. 3 left it blank; the rest gave answers indistinguishable from nonsense. The number of students who missed this elementary problem makes it clear that many in the class never took the programming assignments seriously.
6 got this, 3 solved it for an array of bytes (with just one instruction, ADD), 3 more made small clerical errors. 3 left it blank; the remainder gave answers indistinguishable from nonsense. (The exam should have contained an extra blank line for the answer.)
3 clearly noted the long-short difference, 7 noted it vaguely. 3 othrs noted the condition code difference. 4 left it blank; the remainder gave answers indistinguishable from nonsense.
11 got this, 8 only mentioned the return sequence, 2 only mentioned the receiving sequence. 4 left it blank; the remainder gave answers indistinguishable from nonsense.
__________________________________ LIL R5,X __________________________________ LOADS R5,R5 __________________________________ |
10 got this, 11 only mentioned the first line (loading the address of the variable. 12 only gave R5,X without giving the opcode. 3 left it blank; the remainder gave answers indistinguishable from nonsense. Again, this is the kind of elementary problem that any student who took the programming assignments seriously should have been able to answer with no difficulty.
16 got this, 1 was vague but not wrong. 4 left it blank; the remainder gave answers indistinguishable from nonsense.
LOAD R3,R2,A __________________________________ LIS R4,5 __________________________________ STORE R4,R3,B __________________________________ |
2 got this, 20 got partial credit; many messed up the final store by imagining that there was a way to push a constant into memory without first loading a register. Another common error was to assume that the address of a was already in a register. 11 left it blank; the remainder gave answers indistinguishable from nonsense.
7 got this, 18 forgot the final + 1. 6 left it blank; the remainder gave answers indistinguishable from nonsense.
An easy way to work this out is to work three little examples:
1 - 0 = 1 + ~0 + 1 = 0001 + 1111 + 1 which definitely sets C
0 - 0 = 0 + ~0 + 1 = 0000 + 1111 + 1 which definitely sets C
0 - 1 = 0 + ~1 + 1 = 0000 + 1110 + 1 which does not set C
6 got this, 5 said R3 = R4, 3 said R3 > R4. 3 left it blank; the remainder gave answers indistinguishable from nonsense.
MOVESL R5,R4,12 SL R5,12 SRU R3,8 SR R4,8 OR R3,R5 |
5 got this, 2 suggested rotate, 2 suggested left shift, 1 suggested an unsigned shift, 2 said it shrinks v to 48 bits, 3 only focused on the effect on the least significant halfword. 5 left it blank; the remainder gave (frequently very long) answers indistinguishable from nonsense.
6 got this, one said by exception. 7 left it blank; the remainder gave answers that suggested that they might not have put much effort into MP8.
OTHER LCSAVE = . . = LOCATION SOME CODE . = LCSAVE STUFF |
18 got this. 2 left it blank; the remainder gave answers indistinguishable from nonsense. This suggests that many students saw this construction as boilerplate that they could use without understanding.
8 got this. 2 left it blank; the remainder gave answers indistinguishable from nonsense; in many cases, they gave explicit and totally unjustified numbers such as 8, 10 or 12.
14 got this. 4 left it blanik, while the remainder said, with great confidence, that exception handlers are faster.
Note that those who put effort into MP8 would have noticed that exception handlers include blocks of code to save and restore the processor state and to decode the opcode the user tried to use, obviously slowing down execution considerably as part of the rpice of virtualization.
3 got this. 3 thought LIS was long despite the fact that the trailing S stands for short. 37 thought CMPI was short. 23 thought JSR was short. 38 thought MOVESL was long. 25 thought COSET was long.
Difficulties on this problem are evidence that many students forget about
instruction encoding and learn assembly language as if it were a (wretched)
higher level language with no connection to underlying hardware.
a | b | c | d |
---|---|---|---|
0 | 0 | 1 | 0 |
____ | ____ | ____ | ____ |
0 | 1 | 0 | 0 |
____ | ____ | ____ | ____ |
1 | 0 | 1 | 0 |
____ | ____ | ____ | ____ |
1 | 0 | 1 | 1 |
____ | ____ | ____ | ____ |
20 got each of the above. 15 lost credit for giving nonstandard order for the table rows (as indicated by the contents of the a and b columns. Only 3 earned no credit, and nobody left the truth table blank.
6 got this, 4 got partial credit for identifying input b. 5 left it blank; the remainder gave answers indistinguishable from nonsense.
2 got this, 6 got partial credit for identifying it as some kind of flipflop.
4 left it blank; the remainder gave answers indistinguishable from nonsense.
GETCHAR: LIW R4,KEYBOARD GETCLP: LOAD R3,R4,KBSTAT BITTST R3,KBREADY BBR GETCLP LOAD R3,R4,KBDATA JUMPS R1 |
3 got this. 18 said it was a while loop, for partial credit.
4 left it blank; most of the remainder gave answers indistinguishable from
nonsense. Some said it was a for loop, but that is nonsense because
there is nothing in the code resembling incrementing or testing a loop control
variable.
1 got this; for partial credit, 4 said registers, 1 said I/O. Only 1 left it blank; the remainder gave answers indistinguishable from nonsense.
__________________________________ LOAD R5,R3,NEXT __________________________________ STORE R5,R4,NEXT __________________________________ STORE R4,R3,NEXT __________________________________ |
5 got this. There was very little partial credit. 14 left it blank; the remainder gave answers indistinguishable from nonsense. Many gave answers using only LOAD instructions, therefore making no changes at all to the data structure, or even more bizarrely, using arithmetic or logic operations.
14 got this, 2 said vaguely that something was too big, 2 implied a range from 0 to 255 instead of -128 to +127. 3 left it blank; the remainder gave answers indistinguishable from nonsense.
12 got this. 4 used JSR, 2 added an index register,
1 omitted the label THERE.
6 left it blank; the remainder gave answers indistinguishable from nonsense.
Among the nonsense, a number offered the idea of replacing BR with
BGT or some other conditional branch.
BEQ SKIP __________________________________ JUMP THERE __________________________________ SKIP: |
2 got this, 3 used BNE instead of BEQ,
2 put the label before the JUMP,.
15 left it blank; the remainder gave answers indistinguishable from nonsense.
Again, many replaced BNE with random conditional branches that tested
other condition codes.
3 got this, 13 gave 0000 (wrong displacement), 8 gave 00XX (byte order),
7 gave 00 (just the opcode without displacement).
11 left it blank; the remainder gave answers indistinguishable from nonsense.
F0 __________________________________ 30 __________________________________ FC __________________________________ FF __________________________________ |
None got this fully. 11 earned partial credit; common errors included
6 forgot to give a displacement halfword and
3 who used an index register other than PC (R0).
15 left it blank; the remainder gave answers indistinguishable from nonsense;
for example, giving assembly code or a single hex digit per byte.
9 got this, 5 earned partial credit where it was possible to identify a connection between their answer and the problem given. 13 left it blank; the remainder gave answers indistinguishable from nonsense.
C120000016 = 110000010010 ...
sign = 1 meaning negative
exponent = 100000010 meaning +3 (recall that 01111111 = 0)
mantissa = (1).010 ... (the hidden bit is in parentheses)
so the absolute value is 1.010 ... * 23 = 1010.02
= 10.010
6 got this, 4 earned partial credit for vague hints at the answer. 4 left it blank; the remainder gave answers indistinguishable from nonsense. Many wrong answers referenced Hawk calling conventions, which do not apply to trap service routine entry.
The optimization suggested here would actually
be quite appropriate for speeding up any interrupt or trap handler that did not
need to access user registers the way a virtualized instruction trap handler
does.
TBIT R4,0 BBR BIT0 SL R3,1 BIT0: TBIT R4,1 BBR BIT1 SL R3,2 BIT1: TBIT R4,2 BBR BIT2 SL R3,4 BIT2: TBIT R4,3 BBR BIT3 SL R3,8 BIT3: TBIT R4,4 BBR BIT4 SL R3,16 BIT4: |
2 got this. 11 identified my mistake, saying BITTST R5,1, but did not notice that BITTST is a derived instruction. 5 forgot to give the operands, just giving the opcode. 9 left it blank; the remainder gave answers indistinguishable from nonsense.
This code was on midterm II, and a debugged version of it was incorporated
into the solutions to MP6 and MP7.
10 got this, 4 left off the operand, 2 gave BCS.
8 left it blank; the remainder gave answers indistinguishable from nonsense.
14 got this, 2 earned partial credit. 3 left it blank; the remainder gave answers indistinguishable from nonsense. The nonsense was truly odd, including many mathematical expressions that did not relate n to i or that gave relationships that had no connection to the trivial relationship in the given code.
Again, it is worth emphasizing that this code was on midterm II, and a debugged version of it was incorporated into the solutions to MP6 and MP7.
8 had good solutions, 12 earned partial credit with errors such as using OR instead of and, using SR instead of SRU, switching the order of the shifts (to zero out the low bit instead of the high bit), or worse, trying to use integer NEG on a floating value. 15 left it blank; the remainder gave answers indistinguishable from nonsense.