Exam 1: MidtermSolutions and Commentary
Part of
the homework for 22C:60, Fall 2007
|
X X X X Mean = 8.18 X Median = 8.7 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
X Mean = 11.02 X X X Median = 11.5 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. 15
X X X X X X X X Mean = 4.63 X X Median = 4.9 X X X X X X X X X X X X ___X_X_____________X_X_X_ 0 . 1 . 2 . 3 . 4 . 5
X Mean = 23.31 X X Median = 24.5 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 Approximate midterm grade F? | C/D | A/B |
Bit Pattern x 110000 001001 111010 011111 111011 Unsigned decimal ___48___ ____9___ ___58___ 31 ___59___ 1's complement of x _001111_ _110110_ 000101 _100000_ _000100_ 2's complement of x _010000_ 110111 _000110+ _100001_ _000101+ x as a 1's comp num -15 ____9__* ___-5__+ ___31__* ___-4__+ x as a 2's comp num __-16___ ____9__* ___-6___ ___31__* -5
21 did this perfectly. 4 students each had difficulty with the answers marked with * above. Two student each had difficulty with the answers marked with + above. Some of these difficulties can be classified as clerical errors, but most of them appear related to misunderstandings of the signed number systems.
. = 0 || Address 3 2 1 0 W #01234567 || |----|----|----|----| ; --solved to here-- || 000000: | 01 | 23 | 45 | 67 | B A,B,C,D || |----|----|----|----| A: B 'A','B' || 000004: | 10 | 0E | 0C | 08 | ALIGN 4 || |----|----|----|----| B: B #AB || 000008: | | | 42 | 41 | ALIGN 2 || |----|----|----|----| C: H #0123 || 00000C: | 01 | 23 | | AB | ALIGN 4 || |----|----|----|----| D: B #01,#23,#45,#67 || 000010: | 67 | 45 | 23 | 01 | W #01234567 || |----|----|----|----| END || 000014: | 01 | 23 | 45 | 67 | |----|----|----|----|
14 students did perfectly here, 6 more made 5 or fewer errors. Word 4 of memory was the hardest because many students either interpreted the letters A, B, C and D as ASCII characters instead of labels, or they failed to correctly assign values to these labels. Problems with byte order and alignment were common.
|| 001000: F850 LOAD R8,PARRAY || ; --solved to here-- || 001002: ???? LAB1: || LOADSCC R3,R8 || 001004: __F3C8__ BZS LAB2 || ADDI R8,R8,12 || 001006: __0203__ BR LAB1 || LAB2: || 001008: __F868__ || || 00100A: __000C__ || || 00100C: __00FB__
6 did perfectly, about 10 had difficulties with branch displacements, and 7 failed to allocate an extra halfword for the operand of the ADDI instruction. Many made various clerical errors looking up opcodes.
b) What does this do> (The answer is very short.) (0.5 points)
_It_steps_through_an_array_of_3_word_records_until_it_finds_one_starting_with_0_
5 did well here, while 15 earned no credit at all. Explaining what a program does is difficult!
; record structure for an object TEXT = 0 X = 4 Y = 8 ; activation record structure for PUTOBJECT ; RETAD = 0 P = 4 ARSIZE = 8 PUTOBJECT: ; on entry, R1 = return address ; R3 = p, pointer to an object ; displays that object STORES R1,R2 ; save return address STORE R3,R2,P ; save parameter p LOADCC__R0,R3,TEXT___ ; if (p->text != null) BZS PUTDONE ; { LOAD R4,R3,Y ; parameter R4 = p->y LOAD____R3,R3,X______ ; parameter R3 = p->x ADDI R2,R2,ARSIZE LOAD____R1,PDSPAT____ JSRS R1,R1 ; call dspat(p->x,p->y) ADDI R2,R2,-ARSIZE LOAD R3,R2,P LOAD____R3,R3,TEXT___ ; parameter R3 = p->text ADDI R2,R2,ARSIZE LOAD R1,PDSPST JSRS____R1,R1________ ; call dspst(p->text) ADDI R2,R2,-ARSIZE PUTDONE: ; } LOADS R1,R2 ; restore return address JUMPS R1
3 did perfectly here, 20 earned 3/4 credit or more. The first blank posed the hardest problems. 15 used TESTR here, 7 more used CMPI -- in both cases, testing R3 instead of testing the memory location pointed to by R3. Note that there were good solutions submitted using LOADSCC and TESTS instruciton. It is difficult to classify the other errors students made, except to speculate that several were clerical.