This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CPSC 313, 06w Term 2— Midterm 1 Date: February 9, 2007; Instructor: Norm Hutchinson This is a closed book exam; no notes; no calculators. Answer in the space provided; use the backs of pages if needed. There are 6 questions on 4 pages, totaling 42 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 must write your name and student number on the exam and sign the exam in pen. You should write this exam in pen - I will not consider requests to regrade solutions that are written in pencil. NAME: STUDENT NUMBER: SIGNATURE: SCORE: / 42 1. (8 marks) Short answers. 1a. (2 marks) Is the address of a global variable in a C program determined statically (before the program runs) or dynamically (while the program is executing)? Briefly explain. 1b. (2 marks) Is the content of the jump table used in the execution of a switch statement determined statically or dynamically ? Briefly explain. 1c. (2 marks) Does the IA32 instruction-set architecture require that %eax be used to hold the value returned from a C function call? Briefly explain. 1d. (2 marks) If %ecx holds the address of an integer array a , and %edx holds the integer i , give a single assembly-language statement that computes &a[i] and places it in the register %eax . 2.2....
View Full Document
This note was uploaded on 10/09/2011 for the course CPSC 344 taught by Professor Karen during the Fall '10 term at UBC.
- Fall '10