V4Questions - Questions, Projects, and Laboratory Exercises...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Questions, Projects, and Laboratory Exercises Beta Draft - Do not distribute © 2001, By Randall Hyde Page 1195 Questions, Projects, and Labs Chapter Thirteen 13.1 Questions 1) What is the purpose of the UNPROTECTED section in a TRY. .ENDTRY statement? 2) Once a TRY. .ENDTRY statement has handled an exception, how can it tell the system to let a nesting TRY. .ENDTRY statement also handle that (same) exception? 3) What is the difference between static and dynamic nesting (e.g., with respect to the TRY. .ENDTRY state- ment)? 4) How you can you handle any exception that occurs without having to write an explicit EXCEPTION han- dler for each possible exception? 5) What HLA high level statement could you use immediately return from a procedure without jumping to the end of the procedure’s body? 6) What is the difference between the CONTINUE and BREAK statements? 7) Explain how you could use the EXIT statement to break out of two nested loops (from inside the inner- most loop). Provide an example. 8) The EXIT statement translates into a single 80x86 machine instruction. What is that instruction? 9) What is the algorithm for converting a conditional jump instruction to its opposite form? 10) Discuss how you could use the JF instruction and a label to simulate an HLA IF. .ENDIF statement and a WHILE loop. 11) Which form requires the most instructions: complete boolean evaluation or short circuit evaluation? 12) Translate the following C/C++ statements into “pure” assembly language and complete boolean evalua- tion: a) if( (eax >= 0) && (ebx < eax ) || (ebx < 0 )) ebx = ebx + 2; b) while( (ebx != 0) && ( *ebx != 0)) { *ebx = ‘a’; ++ebx; } c) if( al == ‘c’ || al == ‘d’ || bl == al ) al = ‘a’; d) if( al >= ‘a’ && al <= ‘z’ ) al = al & 0x5f; 13) Repeat question (12) using short circuit boolean evaluation. 14) Convert the following Pascal CASE statement to assembly language: CASE I OF 0: I := 5; 1: J := J+1; 2: K := I+J; 3: K := I-J; Otherwise I := 0; END; 15) Which implementation method for the CASE statement (jump table or IF form) produces the least amount of code (including the jump table, if used) for the following Pascal CASE statements? a) CASE I OF 0:stmt; 100:stmt; 1000:stmt;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter Thirteen Volume Four Page 1196 © 2001, By Randall Hyde Beta Draft - Do not distribute b) CASE I OF 0:stmt; 1:stmt; 2:stmt; 3:stmt; 4:stmt; END; 16) For question (15), which form produces the fastest code? 17) Implement the CASE statements in problem three using 80x86 assembly language. 18) What three components compose a loop? 19) What is the major difference between the WHILE, REPEAT. .UNTIL, and FOREVER. .ENDFOR loops? 20) What is a loop control variable? 21) Convert the following C/C++ WHILE loops to pure assembly language: (Note: don’t optimize these loops, stick exactly to the WHILE loop format) a) I = 0; while (I < 100) I = I + 1; b) CH = ‘ ‘; while (CH <> ‘.’) { CH := getch(); putch(CH); } 22) Convert the following Pascal REPEAT. .UNTIL loops into pure assembly language: (Stick exactly to the REPEAT.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 82

V4Questions - Questions, Projects, and Laboratory Exercises...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online