full explanation and answer
Q1. True/False questions
1. T/F – Lexical analyzer takes the token as input and creates the parse tree as output in
compiling process.
2. T/F – A register stores the return address for subroutine jump.
3. T/F – In object format (Program) text record, text record length is not stored.
4. T/F – First of S grammar rule F(S) contains $ but not ε.
5. T/F – A linking loader performs all linking and relocation whereas a linking editor produces a
linked version of the program
6. T/F – Dynamic linking avoids the necessity of loading the entire library for each execution.
.
7. T/F – Linker has to load the RDREC control section to a memory address
right after where the default control section is loaded in memory.
8. T/F – All macro invocation statements are expanded during the second pass.
9. T/F – Generation of Unique labels scheme in macro could help in elimination duplication of
labels after macro expansion.
10. T/F – A grammar G which is context-free has the productions
Compute the string w = ‘acbbaabc’ is possible using the above productions.
Q2.
With the above grammar rules show if we can derive the string ‘aaaabbbb’ or not. Please show
the complete derivation in parsing tree to get the full point.
Q3.
Book (Page 58, line 225). Find the object code of the following instruction. Please show the detailing of
the operation code, format type, addressing mode etc. while deriving object code.
1068, LDCH BUFFER, X 53C003
Q4.
Calculate the first and follow functions for the below grammar rules. Show the detail work for
first and follow of each of the production rule.
S → aABDh
A→a/∈
B → eC / b / ∈
C → bC / ∈
D → EF
E→g/∈
F→f/∈
Q5.
Expand the macros 3 times with below arguments. Show the complete work line by line and rewrite the
expansions (3 sets of instructions)
RDBUFF F3,BUF,,04,2048
RDBUFF F3,,,04,5012
RDBUFF ,,BUFFER,LENGTH
Q6.
Outline all the tokens for the below program. Make sure you do the numbering lik e(1,2,3,4..)
below each token. Write a total number of tokens at the bottom.
#include
int main() {
int a, b, sum;
printf(“\nEnter two no: “);
scanf(“%d %d”, &a, &b);
sum = a + b;
d= a++;
printf(“Sum : %d”, sum);
return(0);
}