e2.f05 - ECE 190 Exam II Fall 2005 Tuesday November 1st...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 190 Exam II Fall 2005 Tuesday, November 1 st , 2005 x Be sure your exam booklet has 12 pages. x Write your name at the top of each page. x This is a closed book exam. x You may not use a calculator. x You are allowed TWO handwritten 8.5 x 11” sheets of notes. x Absolutely no interaction between students is allowed. x Show all of your work. x Be sure to clearly indicate any assumptions that you make. x More challenging questions are marked with a ***. x Don’t panic, and good luck! “No one can know how glad I am to find On any sheet the least display of mind.” – Robert Frost Problem 1 20 points _______________________________ Problem 2 20 points _______________________________ Problem 3 20 points _______________________________ Problem 4 20 points _______________________________ Problem 5 20 points _______________________________ Total 100 points Name:
Image of page 1

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

View Full Document Right Arrow Icon
Page 2 Name: ____________________________________________ Problem 1 (20 points): Short Answer Part A (5 points): Suppose an I/O event (e.g., a keystroke) occurs infrequently, and at irregularly distributed times. Would a polled or interrupt-driven approach to processing the event be a better design choice? Give two reasons why the approach that you chose is the better one. Part B (5 points): A certain C function bar() accepts a variable number of non- negative parameters/arguments of type int . Explain two ways to design bar() so that the callee can determine the actual number of parameters passed.
Image of page 2
Page 3 Name: ____________________________________________ Problem 1, continued Part C (5 points): What is wrong with the following function? int* sum_of_int (int x, int y) { int sum = x + y; return &sum; } Part D (5 points): Complete the output from the program fragments below. int x = 0; int i = 4; for ( i = 0; 10 > i; i++ ) { i++; x++; } printf ("x: %d\ni: %d\n", x, i); Output: x: __________ i: __________ int x = 0; int i = 4; while ( 10 > i ) { if ( 3 < x ) { break; } x++; i++; } printf ("x: %d\ni: %d\n", x, i); Output: x: __________ i: __________
Image of page 3

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

View Full Document Right Arrow Icon
Page 4 Name: ____________________________________________ Problem 2 (20 points): The Assembly Process 1 .ORIG x2000 2 LD R1, COUNT 3 NOT R1, R1 4 ADD R1, R1, #1 5 AND R2, R2, #0 6 LEA R3, DATA 7 LOOP 8 STR R2, R3, #0 9 ADD R3, R3, #1 10 ADD R2, R2, #1 11 ADD R4, R2, R1 12 BRn DO_LOOP 13 LEA R0, DONE_STRING 14 JSR PRINT_STRING 15 TRAP xF025 16 PRINT_STRING 17 ST R7, SAVE_R7 18 PUTS 19 RET 20 SAVE_R7 21 .BLKW #1 22 COUNT 23 .FILL x200 24 DATA 25 .BLKW x200 26 DONE_STRING 27 .STRINGZ "Finished!" 28 CHALLENGE 29 .END All parts of this problem refer to the LC-3 assembly program shown above. The line numbers are not part of the program, but are used for reference in the problem.
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern