Admin
===============================Q1===============================
2021_sep_mt1
Consider the following struct and global variable declarations. Assume that pointers are 8 bytes long.
When writing assembly code, use the labels to refer to static values; no comments needed.
struct A { struct B {
int aa[2]; char ba[2];
struct B ab[2]; struct A* bb;
int *ac; };
} a;
a) [2.5] How many memory reads are required to compute the value of a.ab[1].bb->ac[1]?
b) [2] Which statement best describes the difference between these two expressions?
a.ab[0].bb->aa[0] a.ab[0].bb[0].aa[0]
1. One has invalid syntax and thus does not compile
2. Both compile, but one generates a runtime error
3. One requires more memory accesses than the other
4. They do exactly the same thing
5. None of these
c) [4.5] Give assembly code that places the value of a.ab[1].bb->aa[1] into r0.
===============================Q2===============================
2021_sep_mt1
Consider declarations as in the previous question (repeated here for convenience).
struct A {
int aa[2];
struct B ab[2];
int *ac[2];
} a;
struct B {
char ba[2];
struct A* bb;
};
For each of the following expressions enter S if the values can be computed statically, D if it
must be computed dynamically or E if the expression has either a syntax or runtime error.
a) [1] The size of the array a.ab?
b) [1] The size of the array a.ac?
c) [1] The value of a.ab[1].bb?
d) [1] The value of &(a.ab[1].bb)?
e) [1] The value of a.ab[1].bb[1]?
f) [1] The value of &(a.ab[1].bb[1])?
g) [1] The value of the expression &(a.ab[1].bb[1]) - &(a.ab[1].bb[0])?
===============================Q3===============================
===============================Q4===============================
===============================Q5===============================
===============================Q6===============================
===============================Q7===============================
===============================Q8===============================
===============================Q9===============================
===============================Q10===============================
===============================Q11===============================
===============================Q12===============================