hw7 solutions - Su, Andy - Homework 7 - Due: Oct 30 2007,...

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

View Full Document Right Arrow Icon
Su, Andy -- Homework 7 -- Due: Oct 30 2007, 11:00 pm -- Inst: Valvano 1 This print-out should have 9 questions. Multiple-choice questions may continue on the next column or page – fnd all choices beFore answering. The due time is Central time. Homework 7 001 (part 1 oF 1) 10 points In the Following C program, short AA=4; const short BB=5; void function(void) { short CC; for(CC=1;CC<10;CC++) { short DD; } } which variables are local? 1. Just AA . 2. BB and CC . 3. Just CC . 4. None oF these choices is correct. 5. Just DD . 6. AA and BB . 7. Just BB . 8. CC and DD . correct Explanation: Variables defned inside a Function are local in scope. This means they can be accessed only within the Function. The C compiler will allocate local variables using registers or place them on the stack. In assembly language, we implement local variables in the same manner, by using registers or the stack. 002 (part 1 oF 1) 10 points All but one oF the Following programs violates the standard usage oF the stack. ±or these situations, you may assume the 6812 allocated stack area is $ 3F00 to $ 3FFF and the stack pointer is currently equal to $ 3F80 . Which oF the Following illustrates a proper use oF the microcomputer stack? 1. func psha save ins balance stack ldab -1,s read local rts 2. func psha save ldab 0,s read local rts 3. func
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/26/2009 for the course EE 302 taught by Professor Mccann during the Fall '06 term at University of Texas.

Page1 / 3

hw7 solutions - Su, Andy - Homework 7 - Due: Oct 30 2007,...

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

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