For the block-structured C code below, indicate the values assigned to w,x y, an
ID: 3878352 • Letter: F
Question
For the block-structured C code below, indicate the values assigned to w,x y, and z int w,x, y, 7 inti 4; int j-5 int j 7; i=6; int i = 8; y-ij 3. For the block-structured code of the following figure, assuming the usual static scoping of declarations, give the scope for each of the twelve declarations ( int v, x, y, z; Block B1/ I int x, z; Block B2 / ( int , xi / Block B3 ( int w, x; Block B4/ ( int y, z /Block B5 4. Consider the context-free grammar: 1 Show how the string aa a can be generated by this grammar 2 Construct a parse tree for this string 3 What language does th is grammar generate? lustify vour answer Page 1 1-+ 5. Which of the following grammars are ambigu MacBook Pro 0 F7 F8 F9 F10Explanation / Answer
If you have any problem with the answer just let me know in the comments and I'll try to solve it as soon as possible.
2. "w" is in first function body ( between parentheses) therefore value of i=6 and j=7, hence w = 6+7 = 13.
"x" is not inside any parentheses and global value of i(4) and j(5) will be used, hence x = 4 + 9 = 13.
For "y" we use i(8) and global value of j(5), hence y = 8 + 5 = 13.
Similarly z also use global I and j, hence value will be equal to x, therefore z=13.
3. For block b1
- w, x, y and z are Globally declared variables and their scope will be global.
For block b2
- x and z are locally declared variable and their scope will be local.
For block b3
- w and x are also declared inside a local block, so their scope is very local.
For block b4.
- w and x have scope of local, explanation same as b2.
For block b5
- y and z have very local scope, explanation same as before.