SP Question
SP Question
and&Technology
Subject Name: System Programming
Subject Code:2150708
Faculties : Prof. Zarana Patel
DESCRIPTIVEQUESTIONS
1 Explain language processing activities. (Dec-2015) 07
2 Explain analysis phase of language processor in detail. (Oct-2016) 07
TOPIC:3 Fundamental of Language Processing
SHORT QUESTIONS
1 Explain the static and dynamic binding. 02
2 ruleswhichgoverntheformationofvalidstatementsinthesourcelanguage. 01
CHAPTER 3 – Assemblers
TOPIC:1 Elements of Assembly Language Programming, Design of
theAssembler, Assembler DesignCriteria
SHORT QUESTIONS
1 Explain following : Assembler directives (Jan-2013) 01
2 Define: Assembler 01
3 Assembly language programs are written using [A] Hex code [B] Mnemonics [C] 01
ASCIIcode [D] None of these
Answer–[B]
4 The instruction DEC N inform the assembler to [A] Decrement the content of N [B] 01
Decrement the data addressed by N [C] Convert signed decimal number to binary [D] None
of the above
Answer –[A]
5 Instructions performing actions in assembly language are called [A] imperative 01
statements[B] declarative statements [C] directive statements [D] none of the above
Answer–[A]
6 What is the content of Stack Pointer? [A] Address of the current instruction [B] Address 01
ofthe next instruction [C] Address of the top element of the stack [D] None of the
aboveAnswer–[C]
7 Which of the following interrupt has highest Priority? [A] INTR [B] TRAP [C] RST 7.5 01
[D]RST 6.5
Answer–[B]
DESCRIPTIVEQUESTIONS
1 Which are the different assembly language statements? Explain each of them with suitable 07
example (Dec-2014)
2 Explain assembly scheme with suitable example. (May-2011) 07
3 Explain analysis and synthesis phases of an assembler by clearly stating their tasks. (Dec- 07
2011)
START 100
A DS 3
L1 MOVER AREG,B
ADD AREG,C
MOVEM AREG,D
MOVER BREG,=‟2‟
MOVER CREG,=‟4‟
D EQUA+1
L2 PRINTD
LTROG
=‟2‟
=‟4‟
ORIGIN A-1
C DC 5
ORIGIN L2+3
STOP
B DC„19‟
END L1
=‟5‟
1) Show the contents of symbol table at the end of pass I.
2) Explain the significance of EQU and ORIGIN statements in theprogram and explain how
they are processed by the assembler.
3) Show the intermediate code generated from the program (Dec-2013)
5 Given the source program: 07
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 passI.
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 (Dec-2013)
System Programming (2150708) 2019 Page 6
Vadodra Institute of Engineering Semester: V (2019)
6 and&Technology
Let us consider a two pass assembler and assume that each instruction is one word. Given 07
an assembly program and code for Mnemonics.
START101 Mnemonics CODE
READA STOP 00
READB MULT 03
STOP DS 02
ADS 1 START 01
BDS 1 END 02
END
(Jun-2013)
8 Explain the role of Mnemonic Opcode Table, Symbol Table, Literal Table and POOL Table 07
in assembling process of assembly language program. (May-2011)
9 Compare single pass assembler and two pass assembler. Explain two pass assembler in detail 07
with suitable example. (May-2011)
10 Explain and show usage by giving examples of following assembler directives: 07
ORIGIN,EQU,LTORG, START (Dec-2011)
11 Describe following data structures: OPTAB, SYMTAB, LITTAB and POOLTAB (Dec- 07,07,04,04
2011) (May-2017) (May-2018) (Jun-2019)
12 Explain two pass assembler. (May-2012) 07
13 Explain the data structure of single pass assembler. (May-2012)(Nov-2017) 07,07
15 Explain the complete working of first pass of the double pass assembler along with the data 07,07
structure used. (Dec-2013)
Explain in brief the design of a Two pass assembler. (Oct-2016)
16 Draw a flowchart of maintaining Table of Incomplete Instruction (TII) in assembler (Dec- 03,03
2013) (Nov-2017)
17 Briefly explain the tasks performed by analysis and synthesis phases of simple assembly 07
schemes (June-2013)
18 Write difference between one pass and two pass assembler. (Jun-2013) 03
19 What are advanced assembler directives? Explain any two with suitable example. (Jun- 07,07
2013) OR
Explain advanced assembler directives with suitable example. (Dec-2015)
20 What is a forward reference? Explain how to solve it. 07
21 Define forward references. How it can be solved using back-patching? Explain with 07,03
example. (Dec-2015) (Jun-2019)
22 Define relative and absolute expression. 07
23 Consider the following assembly program: 07
START 500
READ N
MOVER CREG, ZERO
BK READ A
MOVER AREG, A
COMP AREG, MAX
BC LE, NT
MOVEM AREG, MAX
NT ADD CREG, ONE
COMP CREG, N
BC LT, BK
PRINT MAX
STOP
N DS1
A DS1
ZERO DC „0‟
ONE DC „1‟
MAX DC „0‟
END
Instruction opcodes:
READ-09, MOVER-04,MOVEM-05, ADD-01,COMP-06, BC-07, PRINT-10,
STOP-00
Assembler directive codes: START 01, END-02
Register code: AREG-01, CREG-03
1. Identify task performed by aboveprogram.
2. Generate symboltable
3. Show intermediate code generated by above program (May-2014)
24 Explain use of various data structures needed in pass-I of the assembler and give details of 07
their fields (Dec-2014)
25 List out various assembler directives. Explain any three with example. (Dec-2014) 07
26 Given the following source program and code for mnemonics: 07
(Dec-2014)
27 Consider following assembly language program: 07
Show (i) Contents of Symbol Table (ii) Intermediate codes using Variant I representation.
Instruction opcode: STOP – 00, ADD – 01, MULT – 03, MOVER – 04, MOVEM – 05,
COMP – 06, BC – 07, READ – 09, PRINT – 10, LE – 02 Assembler directives: START –
01, END – 02
Declaration statements: DC – 01, DS – 02
Register code: BREG – 02, CREG – 03 (Dec-2015)
28 What are the Advanced Assembler Directives? Explain any two with example. (May- 07
2016)
29 Given the source program: 07,07
(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. (May-2016)(May-2018)
30 Given assembly program and instruction opcode. Show data structure of pass-I assembler. (Oct- 07
2016)
31 Explain Symbol table and Mnemonics table with suitable example (June-2013) 04
System Programming (2150708) 2019 Page 11
Vadodra Institute of Engineering Semester: V (2019)
32 An assembly program contains the statement
and&Technology 04
X EQU Y+25
Indicate how the EQU statement can processed if
(1) Y is a back reference
(2) Y is a forward reference (Nov-2016)
33 Write the data structure, intermediate code of following assembly program. Write the 07
assembly program output if value of N = 5.
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, RESULT
PRINT RESULT
STOP
N DS1
RESULT DS1
ONE DC„1‟
TERM DS 1
END (Nov-2016)
34 Given the following source program 07
START 300
A DS 5
L1 MOVER AREG, B
ADD AREG, C
MOVEM AREG,D
D EQU A +1
L2 PRINT D
ORIGIN A –2
C DC„52‟
ORIGIN L2 + 3
STOP
B DC„46‟
ENDL1
Show the Intermediate code generated for the program. (May-2017)
35 Explain in brief design of a two pass assembler. (May-2017) 07
36 Define forward references. How it can be solved using back-patching.(May-2018) 03
37 Explain the difference between literal and constant in assembler with its syntax. Why 03
POOLTAB is requiring? (Nov-2017)
38 Consider the assembly program fragment 07
START 200
READ A
LOOP MOVER AREG,A
SUB AREG,=‟1‟
BC GT,LOOP
STOP
A DS 1
5 Write a macro which takes B, C, and D as parameters and calculates B*C + C*D. (May- 03
2011)
6 Define a macro taking A and B as parameters to compute A = A * B + B * B + A + B (Jan- 04
2013)
7 Explain attributes of formal parameters, default specifications of parameter and semantic 07,03
expansion for macro by giving examples. (Dec-2011)
Explain attributes of formal parameters in macro with syntax. (Nov-2016)
8 Define two macros of your choice to illustrate nested calls to these macros. Also show their 07,07
corresponding expansion. (Dec-2011) (Dec-2015)
9 Write and explain the algorithm for macro expansion.(Oct-2016)(May-2017) 07,04
10 Define a macro taking A and B as parameters to compute A = A * B + B * B + A.(Oct- 03
2016)
11 Describe the use of stacks in expansion of nested macro calls with example. (Nov-2016) 07
17 Write Macro definition for adding two numbers that uses positional and keyword 03
parameters.(Nov-2018)
18 Write a macro definition for adding two numbers 10 times. Use nested macro call to 04
increment numbers by 1 every time in 10 iterations.(Nov-2018)
19 Explain attributes of formal parameter and expansion time variable in macro.(Jun-2019) 04
4 Write a macro that moves n numbers from the first operand to the second operand, where n 04
is specified as third operand of the macro. (May-2011)
5 Explain design specification tasks for macro pre-processor with suitable Example. (May- 07
2011)
6 Describe tasks and data structures considered for the design of a macro pre-processor. (Dec- 07
2011)
7 Explain Design of Macro Pre-processor. (May-2012)(May-2017) 07,07
8 What is macro in programming language? Write an algorithm for macro definition. (May- 07
2012)
9 Draw a flow chart and explain simple one pass macro processor. (May-2012) (May-2016) 07,07
4 Explain dynamic linking. Draw the flaw chart for dynamic linking. (May-2012) 03
TOPIC 7: Loaders
SHORTQUESTIONS
System Programming (2150708) 2019 Page 17
Vadodra Institute of Engineering Semester: V (2019)
and&Technology
1 Define: Absolute loader 01
2 Define: Bootstrap loader 01
3 List various types of Loaders. 01
4 Function of Loader. 01
5 Difference between Linker & Loader. 01
DESCRIPTIVEQUESTIONS
1 Explain Loader. (Jan-2013) 07
2 Explain following terms: (1) Loaders (2) Self Relocating Programs. (June-2013) 07
3 Write a brief note on MS-DOS linking and loading. (May-2011) 07,07,07
Explain linking and loading in MS DOS. (May-2012)
Write a brief note on MS-DOS Linker.(Jun-2019)
4 In brief explain relocating loader. (May-2016) 07
5 Explain following: Loader (Jan-2013) 3.5
6 Explain bootstrap loader.(Nov-2016) 03
7 Explain the term loader with its basic function.(May-2018) 03
8 Explain absolute loader in detail.(Nov-2017) 04
9 Compare Absolute Loader with Relocating Loader (BSS Loader).(Jun-2019) 04
TOPIC 8: Compile-and-Go Loaders
DESCRIPTIVEQUESTIONS
1 Compare the compile and go loader and absolute loader. 07
TOPIC 9: Absolute Loaders
DESCRIPTIVEQUESTIONS
1 Explain Absolute Loader with example. (May-2012)(Dec-2015)(May-2016) 07,03,07,07
Explain absolute loader. (Nov-2016)
2 Write a short note on absolute loader. (Dec-2014) 07
CHAPTER 6 – Scanning and Parsing
TOPIC 1: Programming Language Grammars Classification
ofGrammar,Ambiguity in Grammatic Specification
SHORTQUESTIONS
1 State whether the following statements are true or false. Justify your answer. 01
Simple precedence grammar is a superset of Operator Precedence grammar. (Dec-2013)
4 Draw a DFA for the following Regular Expression. (a/b)* abb (Dec-2013) 04
5 Convert given regular expression to DFA. The expression is (a | b)*abb#. (May-2011) 05
7 Develop Regular expression and DFA for declaring a variable in „C‟ lang. (May-2012) 07
8 Write a regular expression for the language consisting of all strings ending with 1 and does 07
not contain substring 00. Convert the resultant regular expression into Deterministic Finite
Automata. (Dec-2014)
9 Write a regular expression for a language containing a binary string which does not contain 02
two consecutive 0s or two consecutive 1s anywhere. (Dec-2015)
10 Construct NFA and DFA for following regular expression: (0 | 1)*001# (Dec-2015) 07
11 Construct DFA for- 0*1*(0/1)# (Oct-2016) (May-2017) 03,07
12 Define regular expression and DFAs for following kinds of strings: 04
1. A real number with optional integer and fraction part.
2. A comment string in the C++ language. (Nov-2016)
13 Implement DFA from : a*(b* | c*)* b*d*# (May-2017) 07
14 Show that following regular expressions are equivalent by constructing optimized DFA. 07
(0/1)*
(0*/1*)* (May-2017)
15 Construct a deterministic finite automata for (0|1)*011.(Nov-2017) 04
16 Write Regular expression for all string end with „abb‟ and Construct equivalent DFA.(Jun- 04
2019)
TOPIC 3: Parsing, Top Down Parsing, Bottom up Parsing
SHORTQUESTIONS
1 Define the Parsing (June-2013) 01
2 Write regular expressions of a given language. The language consists of all strings of a’s and 02
b’s which ends with a and does not contain bb. (May-2011)
3 State whether the following statements are true or false. Justify your answer. To make top- 01
down parsing feasible, it is necessary to eliminate left-recursion. (Dec-2013)
4 Constants and literals are two names having the same meaning. State true or false. (Dec- 01
2013)
5 Define the following term: 01
Handle(Dec-2013)
(June-2013)
11 By giving suitable example, illustrate working of operator precedence parser. (Jan-2013) 07
System Programming (2150708) 2019 Page 20
Vadodra Institute of Engineering Semester: V (2019)
and&Technology
12 Write algorithm for operator precedence parsing and explain with example. (Dec-2013) 07
13 Write operator precedence table for arithmetic operators “+”, “*”, “-”, “/” .Parse following 07,07,07
expression using the table. id * id + id * id. (June-2013)
Write operator precedence table for arithmetic operators “+”, “*”, “-”, “/” .Parse following
expression using the table. id * (id+id)/(id*id). (Nov-2016)
Implement operator precedence parsing for the string:
id +id*(id-id)/id (May-2017)
14 What is operator precedence parsing? Show operator precedence Matrix for following 07,07
operators:+, - , * , ( , ).Parse following string: |- <id> + <id> * <id> -| (Dec-2011) (May-
2018)
15 Explain recursive decent parser with suitable example. Also state its Drawbacks. (June- 07
2013)
16 Explain recursive descent parsing algorithm. (Dec-2013) (Dec-2015)(May-2016) 07,07,07
17 Explain recursive decent parser. 07
18 Write unambiguous production rules to produce arithmetic expression consisting of +, -, *, / , 07,07
^ (exponent), id. Use them for parsing id ^ id ^ id * id + id / id using shift -reduce parser
(Naïve bottom up parsing). Also lists limitation(s) of the method. (Jan-2013)(Dec-2011)
8 Explain triple and quadruple representation with example. (May-2012) (Oct-2016) (May- 07,07,04
2018)
9 Generate quadruple, triple and indirect triple for following expression: 07
ans=a+b*c/2.0 (May-2017)
10 Which data structure is used for automatic dynamic allocation and memory access? 04
Explain with suitable example. (Nov-2017)
11 Explain operand descriptor and register descriptor for a*b.(Nov-2017) 03
12 Given following expression = - (a+b) *(c+d) + (a+b+c) 07
1. Draw a Syntax tree for theexpression
2. Write a three-address code for theexpression
3. Give triple representation for the three address code of the expression (May-2014)
13 What is memory binding? Explain dynamic memory allocation using extended stack 07
model.(Nov-2018)
TOPIC 4: Code Optimization, Code Generation
SHORTQUESTIONS
1 Define the following terms. 02
1) Frequency reduction 2) triples (Dec-2013)
2 State true/false: Code optimization phase is an optional phase of compiler. (May-2017) 01
DESCRIPTIVE QUESTIONS
1 Explain various optimizing transformations of a compiler by giving suitable examples. (Jan- 07
2013)(Dec-2015)
2 What are the issues in code generation in relation to compilation of expression? Explain each 07
issue in brief. (June-2013)
3 Describe various optimizing transformations commonly used in compilers. (Dec-2011) 07
4 What is meant by optimizing transformations? Explain any three with suitable example. 07
(June-2013)
5 Explain various steps of code optimization with example. (May-2012) 07
6 Explain different code optimization techniques. (Dec-2013)(May-2017) 07,07
7 What is the need for code optimization? 07
8 What is code optimization? Explain with example various optimizing transformations. (Dec- 07
2014)
9 Given following expression: x = -a * b + -a * b 07
(1) Write three address codes for theexpression.
(2) Optimize the three address code if it is possible to doso.
(3) Give triple implementation for the three address code of the expression. (May-2016)