cs313-2006-t1-midterm1 - CPSC 313, 06w Term 1 Midterm 1...

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

View Full Document Right Arrow Icon
CPSC 313, 06w Term 1— Midterm 1 Date: October 4, 2006; Instructor: Norm Hutchinson This is a closed book exam; no notes; you may use calculators only if you don’t trust your own brain to perform simple arithmetic calculations. Answer in the space provided; use the backs of pages if needed. There are 6 questions on 5 pages, totaling 50 marks. You have 50 minutes to complete the exam. On the last two pages you will find summaries of the x86 instructions and address modes. You may find it profitable to (carefully) remove these pages from the exam. You should write this exam in pen - I will not consider requests to regrade solutions that are written in pencil. NAME: STUDENT NUMBER: SCORE: / 50 1. (8 marks) Short answers. 1a. Is the address of a local variable in a C function determined statically or dynamically ? Briefly explain. 1b. Is the code address to which a procedure returns when it exits determined statically or dynami- cally ? Briefly explain. 1c. Does the IA32 instruction-set architecture require that %esp be used as the stack pointer? Briefly explain. 1d. Give assembly-language code that computes %eax = %eax * 9 + 7 as efficiently as possi- ble.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2. (8 marks) Consider the following C source file. / * global variables * / int g, * gp, ** gpp; void foo (int * a1, int a2) { int l; / * consider each statement as if it were here * / } Give an assembly-code implementation of each of the following statements of function
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.

This note was uploaded on 10/09/2011 for the course CPSC 344 taught by Professor Karen during the Fall '10 term at The University of British Columbia.

Page1 / 8

cs313-2006-t1-midterm1 - CPSC 313, 06w Term 1 Midterm 1...

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