Question: Each question weights 4pt, unless specified otherwise. Stack int G 1 Int A[100]: int foo (int a,int b) ( int x, int y: return a+b
Each question weights 4pt, unless specified otherwise. Stack int G 1 Int A[100]: int foo (int a,int b) ( int x, int y: return a+b Heap Static data Text Reserved Int main (int x, int y) ( Int a, b.c Int* d new int; c foo(a,b) delete d; 1. (5pt) Consider the following C codes. Which part of the memory section will the following data be stored? Choose the memory section where the following variables would be located. A. Stack B. Heap C. Static Data D. Text The answers have to be either A,B,C or D. The argument x in the main function. Answer: Answer Answer . The array A[100]. The integer pointed by int* d in the main function Answers: The local variable x in function foo The compiled C codes Answer:A 2. Consider the following binary number in 8-bit two's complement format. 10010110 What is its equivalent value in decimal? Answer Hints: it is a negative number.) 3. Translate the following MIPS assembly codes to a C statement? Assume that variables f,g.h are are in registers to.t1, and 12. subi t0, 12,-1 add t0, t0, t1 Answer: (Use the variables f, g, and h and a constant number in the answer.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
