S10_test2_practice

S10_test2_practice - Boise State University Department of...

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

View Full Document Right Arrow Icon
ECE 332 Spring 2010 Test 2 Practice Page 1 of 7 Boise State University Department of Electrical and Computer Engineering ECE 332 Microprocessors, Practice Test 2 – S Name: ______________________________ Reference during test: Nios II Processor Reference Handbook NO CALCULATORS! If you finish early, go back and check your work. You do not receive extra credit for finishing early. For all problems utilize proper register conventions. 1. (15 points) Using the following code to complete the memory snapshot when execution reaches the return 0 statement. Assume that execution is currently at the highlighted instruction. // file: structures.c struct abc { unsigned int a; unsigned char b; unsigned short c; }; int main( void ) { unsigned int a; struct abc x; unsigned int b; struct abc y; unsigned int c; a = 0xaaaaaaaa; b = 0xbbbbbbbb; c = 0xcccccccc; x.a = 0x11111111; x.b = 0x22; x.c = 0x3333; y = x; return 0; } Registers snapshot Current Memory Snapshot In the blank snapshot below show the memory values after the program runs to completion. Memory Snapshot at end of program (word format)
Image of page 1

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

View Full Document Right Arrow Icon
ECE 332 Spring 2010 Test 2 Practice Page 2 of 7 2. (10 points) For the following code show the resulting output when program runs to completion. #include <stdio.h> typedef unsigned short ui16; int main( void ) { ui16 nbrs[] = {111, 222, 333, 444, 555 }; ui16 *pnbrs; pnbrs = nbrs; printf( "size of nbrs: %d\n" , sizeof (nbrs)); printf( "size of pnbrs: %d\n" , sizeof (pnbrs)); printf( "%d\n" , *pnbrs); pnbrs += 2; printf( "%d\n" , *pnbrs); pnbrs++; printf( "%d\n" , *pnbrs); pnbrs -= 2; printf( "%d\n"
Image of page 2
Image of page 3
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