QUESTION BANK CHAPTER 1 : OVERVIEW OF SYSTEM SOFTWARE 1) Explain Analysis-synthesis model/fron end backend model of compiler 2) Explain various phases of compiler and symbol table. Consider the statement a=b+c*10.where a, b, c are of type float. Show the translation of the given statement by different phases of compiler to produce assembly language statement 3) Explain in brief syntax analysis phase Compare user-centric view and system-centric view of system software. 4) Perform lexical, syntax and semantic analysis on below C statement a=b+c*d*100+e/f Where data type of b, c & e are integers and remaining all variables are float. 5) Define following terms: (i) Assembler (ii) Macro (iii) Parsing CHAPTER 2: Overview of Language Processors 1) Define Following terms: 1. System Software 2. Semantic Gap 3. Specification Gap 4. Execution Gap 5. Language Migrator 2) Compare Problem oriented and Procedure oriented languages. 3) Explain the various stages of the life cycle of a source program with a neat diagram 4) Explain language processing activities A bridges an execution gap to the machine language of a computer system. 1) Detranslator, (2) Preprocessor, (3) Language translator (ii) A bridges the specification gap between two programming languages. (1) Interpreter (2) Language Migrator (3) Compiler (iii) is designed to hold the value of formal parameters during expansion of macro call. 1) Actual Parameter Table (2) Macro Name Table (3) Expansion time variable table (iv) Syntax analysis processes the string of tokens built by to determine the statement class. (1) Semantic Analysis (2) Lexical Analysis (3) Itself CHAPTER 3: Assemblers 1) Explain and compare two variants of the intermediate code generated from multi pass assembler.
2) List out the tasks performed by the analysis and synthesis phase of a Simple Assembly Language 3) Differentiate one pass and two pass assembler. Explain how forward references are handled in two pass assembler. 4) Explain in brief design of a Single Pass Assembler. 5) Explain various data structures (tables) needed in PASS I of the assembler with their fields. Also explain various data structures used for symbol table. 6) Explain and show usage by giving examples of advanced assembler Directives 7) Define following terms : 1) Handle 2) Program Relocation 3) literals 4) Forward Reference 5) pass 6) Frequency reduction 7) triples 8) Define forward references. How it can be solved using back-patching? Explain with example 9) Given the source program: START 200 X DS 4 L1 MOVER AREG,Y SUB AREG,Z MOVEM AREG,W W EQU X+2 L2 PRINT W ORIGIN X-5 Z DC 9 ORIGIN L2+1 STOP Y DC 7 END 1) Show the contents of symbol table at the end of pass I. 2) Explain the significance of EQU and ORIGIN statements in the program and explain how they are processed by the assembler. 3) Show the intermediate code generated from the program in variant 1 and variant 2 form. 10) Given the source program: START 100 A DS 3 L1 MOVER AREG, B ADD AREG, C MOVEM AREG, D D EQU A+1 L2 PRINT D ORIGIN A-1 C DC 5 ORIGIN L2+1 STOP B DC 19 END L1 (a) Show the contents of the symbol table at the end of Pass I.
(b) Explain the significance of EQU and ORIGIN statement in the program and explain how they are processed by the assembler. (c) Show the intermediate code generated for the program 11) Explain the role of Mnemonic Opcode Table, Symbol Table, Literal Table and POOL Table in assembling process of assembly language program 12) Consider following assembly language program: Show (i) Contents of Symbol Table (ii) Intermediate codes using Variant I representation. START 101 READ N MOVER BREG, ONE MOVEM BREG, TERM AGAIN MULT BREG, TERM MOVER CREG, TERM ADD CREG, ONE MOVEM CREG, TERM COMP CREG, N BC LE, AGAIN MOVEM BREG, AGAIN PRINT RESULT STOP N DS 1 RESULT DS 1 ONE DC 1 TERM DS 1 END CHAPTER 4: Macro and Macro Processors 1) Explain following terms with suitable example. (1) Expansion time variable (3) Semantic expansion (2) Positional parameter (4) Macro Pre-processor 2) Illustrate nested calls for any two macros of your choice with its corresponding expansion.. 3) Compare and Contrast the following (i) macro call and function call (ii) macro preprocessor and macro assembler. 4) Explain macro expansion process with example.. 5) Define Lexical and Semantic Expansion. Write a macro which takes A, B, C and D as parameters and calculates A*B+C*D in AREG. 6) Explain various data structures of Macro definition processing with example 7) Explain with example expansion time sequencing symbols and expansion time variable. 8) Explain advanced macro facilities using appropriate example. 9) Explain in brief the design of a macro preprocessor. 10) Do as directed (i) A macro is a unit of specification for through expansion. (Fill in the blank)
(ii) Macro definition is enclosed between a statement and a statement. (Fill in the blank) (iii) A is designed to hold the names of all macro defined in a program. (Fill in the blank) (iv) An counter is maintained to count the number of nested macro calls. (Fill in the blank) (v) A lexical expansion is typically employed to replace occurrence of formal parameters by corresponding actual parameters. (State True/False) (vi) Default specification of parameters is useful in situations where a parameter has the different value in most calls. (State True/False) (vii) Macro definition table is maintained to hold value of sequencing symbols. (State True/False) 11) Explain attributes of formal parameters, default specifications of parameter and semantic expansion for macro by giving examples. 12) Write general purpose macro to move the contents of one area of memory into another area of memory. Assume that destination area is larger in size, remaining part of it should be padded with zeroes at the end of the area CHAPTER 6 : Scanning and Parsing 1) Explain types of grammer. 2) Write a regular expression for a language containing a binary string which does not contain two consecutive 0s or two consecutive 1s anywhere 3) Construct operator precedence parser for following grammar : E E+E E*E (E) E^E id. 4) Given the grammer, perform the top-down parsing for the string +*35*45 E = +TE E T = *VT V V= 0 1 2 3 9 5) Construct LL(1) parsing table for following grammar. E TE E +TE Є T FT T *FT Є F (E) id 6) Write regular expressions of a given language. The language consists of all strings of a s and b s which ends with a and does not contain bb. 7) Draw Optimized DFA for following regular expression. (1*)*0(0/1)*# 8) Define the following with example: (i) Left recursive grammar (ii) Symbol Table 9) Explain Left recursion and Left factoring by stating its general production rules & suitable grammar examples.
10) Write unambiguous production rules to produce arithmetic expression consisting of +, -, *, / and ^ (exponent). Construct parse tree and abstract syntax tree for : id * id + id ^ id - id / id 11) Construct DFA for following regular expression: (a b)* abb (a b)* # 12) Given a grammar, E TX X +TX ε T FY Y *FY ε F id (E) Develop LL(1) parsing table and parse a string (id + id) * id 13) Explain working of operator precedence parser by giving suitable example. 14) Explain recursive descent parsing algorithm with example. 15) Perform left-fectoring on the following grammar S = i E t S e S i E t S a E = b 16) Define Handle. Using Handle and Simple Phrase trace the bottom up parsing algorithm(shift reduce parser). Grammar is : E T+ E T E T T T *V T / V V V a b c d String is : a - b * c + d 17) When Left- factoring on a grammar is applied? Apply left- factoring on the below given grammar and perform Predictive Parsing. Grammar is S i E t S i E t S e S a E b String is : i b t a e i b t a CHAPTER 7: Compilers 1) What is need and importance of intermediate code? Create quadruple and Triple for following statement. a= (a+b)*(c-d) 2) Explain various optimizing transformations of a compiler using appropriate examples. 3) Discuss parameters for activation records. 1) Explain Memory allocation models 2) Explain methods for accessing non local variables. 4) Show quadruple table for local optimization using value numbers Stmt. No. Stmt 14 g=25.2 15 x=z+2 16 h=x*y+d :..
34 w=x*y 5) Explain different code optimization techniques. 6) Given following expression: x = -a * b + -a * b (1) Write three address codes for the expression. (2) Optimize the three address code if it is possible to do so. (3) Give triple implementation for the three address code of the expression 7) Given following expression = - (a+b) *(c+d) + (a+b+c) 1. Draw a Syntax tree for the expression 2. Write a three-address code for the expression 3. Give triple representation for the three address code of the expression 8) Define static pointer. Find Register Requirement (RR) for the below given expression f + ( x + y ) * ( ( a + b) / (c - d) ) 9) Explain memory allocation in block structured language.