Download presentation
Presentation is loading. Please wait.
Published byJob Porter Modified over 9 years ago
1
1 Answer #1, Quiz #1 Lp:slt $t0,$s1,$s2 # $t0 = a<b slt $t1,$s1,$s2 # $t1 = a<c and $t2,$t0,$t1 # $t2 = $t1 && $t0 beq $t2,$zero,End addi $s1,$s1,1 # $s1 = $s1 + 1 j Lp End: Wrong Answer!! C++ first checks the first condition, if it is false exit loop. The correct answer is:
2
2 Answer #1, Quiz #1 (cont) Lp:slt $t0,$s1,$s2 # $t0 = a<b beq $t0,$zero,End slt $t0,$s1,$s2 # $t0 = a<c beq $t0,$zero,End addi $s1,$s1,1 # $s1 = $s1 + 1 j Lp End: Correct Answer!! Exit loop if one of the conditions is false.
3
3 Answer #2, Quiz #1 -100 = -0110 0100 = 1001 1011 + 1 = 1001 1100 78 = 0100 1110 128 = 1000 000 0xff = 0000 0000 1111 1111 0xab1 = 0000 1010 1011 0001 0x8612 = 1000 0110 0001 0010 $t0 = -1<100 = 1 $t1 = 2 32 -1<-100 = 0 Answer #4, Quiz #1
4
4 Answer #3, Quiz #1 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.