html5-img
1 / 9

Sample exam questions

Sample exam questions. ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides4-1Quiz.ppt Modification date: March 20, 2014. 1. Write a suitable assembly language/machine instruction sequence to implement the high level code sequence: do { a = a + b; b++;

Download Presentation

Sample exam questions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sample exam questions ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides4-1Quiz.ppt Modification date: March 20, 2014

  2. 1. Write a suitable assembly language/machine instruction sequence to implement the high level code sequence: do { a = a + b; b++; } while (b < 100); assuming a load/store architecture. Variables aand bare declared as integers and are held in processor registers R1, andR2, respectively. Use any hypothetical but reasonable assembly language. Provide comments.

  3. Answer

  4. 2. A processor uses a condition code register approach for branch instructions. Write an assembly language sequence for the C/Java code: do { a = a - 2; } while ((a < b) || (a > 0)); assuming that the variables aandbare assigned to registersR1and R2respectively. Provide comments. Use any reasonable hypothetical instructions. (Note || is the symbol for the logical OR operation.)

  5. Answer

  6. 3. Write a suitable assembly language sequence to implement the high level code sequence: if (x > 10) a[x] = a[x + 1]; assuming a load/store architecture with only two instructions to access memory, load a register from memory (LD) and store a register into memory (ST) and both using register indirect addressing plus offset. There are 32 registers R0 - R31. Register R0 holds zero permanently. The array a is declared as a character array and stored in memory starting at location 100, and x is held in register R2. Make any necessary assumptions but state them. Use any reasonable assembly language and provide comments.

  7. Answer

  8. 4. Write a suitable assembly language sequence to implement the C/Java code sequence: for (i = 0; i < 10; i++) a[x] = b[x]; assuming a load/store architecture -- Load (LD, LB), and store (ST, SB) to access memory using register indirect addressing plus offset. There are 32 registers R0 - R31. Register R0 holds zero permanently. Arrays a and b are declared as character arrays and stored in memory starting at memory addresses 100 and 200 respectively. The variable i is held in register R1, and the variable x is held in register R2. Make any necessary assumptions but state them. Use any reasonable assembly language and provide comments.

  9. Answer

More Related