Beruflich Dokumente
Kultur Dokumente
___________
MARKS
Q.1 Short Questions 14
1 What is an algorithm?
2 What is worst case time complexity ?
3 Define space complexity.
4 Define Big Omega Asymptotic Notation.
5 Define Feasible Solution.
6 What is vector? Which operations are performed on
vector?
7 Define P-type Problem.
8 Write Principal of Optimality.
9 Define Directed Acyclic Graph.
10 List types of algorithms.
11 Write down the Best case, Worst Case and Average case
Complexity for merge sort.
12 Define Minimum Spanning Tree.
13 Write down the Best case, Worst Case and Average case
Complexity for selection sort.
14 Write down the Best case, Worst Case and Average case
Complexity for Heap sort.
Q.2 (a) Explain the difference between Greedy and Dynamic 03
Algorithm.
(b) Apply the bubble sort algorithm for sorting 04
{U,N,I,V,E,R,S}
(c) Analyze Selection sort algorithm in best case and worst 07
case.
OR
(c) Analyze Quick sort algorithm in best case and worst case. 07
1
(b) 04
4
Compute MST using PRIM’s Algorithm.
(c) Given two sequence of characters, X={G,U,J,A,R,A,T}, Y 07
= {J,R,A,T} obtain the longest common subsequence.
*************
2
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2018
Subject Code:2150703 Date:04/05/2018
Subject Name:Analysis and Design of Algorithms
Time:02:30 PM to 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
Q.1 (a) Define Algorithm. Discuss key characteristics of algorithm. 03
(b) Prove or disprove that f(n) = 1 + 2 + 3 + .... + n ∈ Θ(n^2). 04
(c) Which are the basic steps of counting sort? Write counting sort algorithm. 07
Derive its time complexity in worst case.
Q.2 (a) What are the advantages of dynamic programming method over devide-&- 03
conquer method?
(b) Solve following recurrence using recursion tree method: T(n) = 3T(n/3) + 04
n^3.
OR
(c) Discuss best case, average case and worst case time complexity of quick sort. 07
Q.3 (a) Justify with example that shortest path problem satisfies the principle of 03
optimality.
(b) Which are the three basic steps of the development of the dynamic 04
programming algorithm? Mention any two examples of dynamic
programming that we are using in real life.
(c) Solve the following making change problem using dynamic programming 07
method: Amount = Rs. 7 and Denominations: (Rs. 1, Rs. 2 and Rs. 4)
OR
Q.3 (a) Justify with example that longest path problem does not satisfy the principle 03
of optimality.
(b) Discuss general characteristics of greedy method. Mention any two examples 04
of greedy method that we are using in real life.
(c) Solve all pair shortest path problem for the following graph using Floyd's 07
algorithm.
Q.4 (a) What are the disadvantages of greedy method over dynamic programming 03
method?
(b) What is DFS? Explain with example. Show the ordering of vertices produced 04
by Topological-sort for the following graph.
(c) Solve the following Knapsack Problem using greedy method. Number of 07
items = 5, knapsack capacity W = 100, weight vector = {50, 40, 30, 20, 10}
and profit vector = {1, 2, 3, 4, 5}.
OR
Q.4 (a) Write an algorithm for Huffman code. 03
(b) What is an approximation algorithm? Explain performance ratio for 04
approximation algorithm.
(c) Explain use of branch and bound technique for solving assignment problem. 07
Q.5 (a) Write Naive string-matching algorithm. Explain notations used in the 03
algorithm.
Q.5 (a) Which are the three major concepts used to show that a problem is an NP- 03
Complete problem?
(b) Explain breadth first search with example. 04
(c) Find minimum spanning tree for the following undirected weighted graph 07
using Kruskal’s algorithm.
*************
Seat No.: ________ Enrolment No.___________
MARKS
Q.1 (a) Define an algorithm. List various criteria used for analyzing an algorithm. 03
(b) What is the smallest value of n such that an algorithm whose running time is 04
100n2 runs faster than an algorithm whose running time is 2n on the same
machine?
(c) What do you mean by asymptotic notation? Describe in brief any three 07
asymptotic notations used for algorithm analysis.
Q.2 (a) What do you mean by Divide & Conquer approach? List advantages and 03
disadvantages of it.
(b) Let f(n) and g(n) be asymptotically nonnegative functions. Using the basic 04
definition of Θ-notation, prove that max(f(n), g(n)) = Θ (f(n) + g(n)).
(c) Solve the following recurrence relation using iteration method. T(n) = 8T(n/2) 07
+ n2. Here T(1) = 1.
OR
(c) Solve the following recurrence relation using substitution method. T(n) = 07
2T(n/2) + n. Here T(1) = 1.
Q.3 (a) Differentiate between greedy method and dynamic programming. 03
(b) Prove that the fractional knapsack problem has the greedy-choice property. 04
(c) Find optimal sequence of multiplication using dynamic programming of 07
following matrices: A1[10x100], A2[100x5], A3[5x50] and A4[50x1]. List
optimal number of multiplication and parenthesization of matrices.
OR
Q.3 (a) Briefly describe greedy choice property and optimal substructure. 03
(b) Suppose that we have a set of activities to schedule among a large number of 04
lecture halls, where any activity can take place in any lecture hall. We wish to
schedule all the activities using as few lecture halls as possible. Give an
efficient greedy algorithm to determine which activity should use which
lecture hall.
(c) Describe longest common subsequence problem. Find longest common 07
subsequence of following two strings X and Y using dynamic programming.
X=abbacdcba, Y=bcdbbcaac.
Q.4 (a) Differentiate between depth first search and breadth first search. 03
(b) Discuss and derive an equation for solving the 0/1 Knapsack problem using 04
dynamic programming method.
(c) List applications of a minimum spanning tree. Find minimum spanning tree 07
using Krushkal’s algorithm of the following graph.
1
OR
Q.4 (a) Define graph. Describe strongly connected graph with example. 03
(b) Given an adjacency-list representation of a directed graph, how long does it 04
take to compute the out-degree of every vertex? How long does it take to
compute the in-degrees?
(c) Define minimum spanning tree. Find minimum spanning tree using Prim’s 07
algorithm of the following graph.
Q.5 (a) Define amortized analysis. Briefly explain its two techniques. 03
(b) Show the comparisons the naive string matcher makes for the pattern P=0001 04
in the text T=000010001010001.
(c) State whether travelling salesman problem is a NP-Complete problem? 07
Justify your answer.
OR
Q.5 (a) Define backtracking. State types of constraints used in backtracking. 03
(b) Working modulo q=11, how many spurious hits does the Rabin-Karp matcher 04
encounter in the text T=3141592653589793 when looking for the pattern
P=26?
(c) Prove that if G is an undirected bipartite graph with an odd number of 07
vertices, then G is nonhamiltonian.
*************
2
Seat No.: ________ Enrolment No.___________
MARKS
(c) For the following chain of matrices find the order of parenthesization 07
for the optimal chain multiplication (13,5,89,3,34).
Q.4 (a) Explain Tower of Hanoi Problem, Derive its recursion equation and 03
computer it’s time complexity.
(b) Explain finite automata algorithm for string matching. 04
(c) Find out LCS of A={K,A,N,D,L,A,P} and B = {A,N,D,L} 07
OR
Q.4 (a) Explain Principle of Optimality with example. 03
(b) Define BFS. How it is differ from DFS. 04
(c) Solve the following instance of knapsack problem using Backtracking 07
Technique. The Capacity of the Knapsack W = 8 and w = (2,3,4,5) and
value v = (3,5,6,10)
Q.5 (a) Draw the state space tree Diagram for 4 Queen problem. 03
(b) Define P, NP, NP-Hard and NP-Complete Problem. 04
1
(c) Find out the Minimum Spanning Tree using Kruskal Algorithm for 07
given Graph.
OR
Q.5 (a) Explain naïve string matching algorithm with example. 03
(b) Explain DFS algorithm in brief. 04
(c) Find all pair of shortest path using Floyd’s Algorithm for given graph 07
*************
2
Seat No.: ________ Enrolment No.___________
Page 1 of 2
Q.5 (a) Explain the following terms: 03
1. Generalization
2. Transition
3. Metadata
(b) Prepare an activity diagram for Online Bus ticket booking system. 04
(c) What is Interaction modeling? Explain briefly usage of Use case model. Prepare a 07
Use case model for Telephone Line system.
OR
Q.5 (a) State difference between DatagramSocket and DatagramPacket. 03
(b) Draw a state model for Telephone Line system. 04
(c) Write a program to create two threads, one thread will check whether given number 07
is prime or not and second thread will print prime numbers between 0 to 100.
**********
Page 2 of 2
Seat No.: ________ Enrolment No.___________
*************
2
Seat No.: ________ Enrolment No.___________
Q.5 (a) Write a program to find whether the given string is palindrome or 03
not.
(b) Draw sequence diagram for book issue process of library. 04
(c) Explain activity diagram with the help of an example. 07
1
OR
Q.5 (a) Explain interface and its usage. 03
(b) Draw use case diagram for Library Management System. 04
(c) Explain Nested States. Draw the Nested states diagram for the 07
phone line.
*************
2
Seat No.: ________ Enrolment No.___________
Q.2 (a) When will you declare a method as a static? Explain static method 03
with suitable example.
(b) Explain inner class with example. 04
(c) Explain following keywords of java with example. 07
1) final
2) finally
OR
(c) Explain following keywords of java with example. 07
1) super
2) this
Q.3 (a) What is java collection framework? What are the benefits of the 03
java collection framework?
(b) What is Exception? Demonstrate how you can handle different 04
types of exception separately.
(c) What is dynamic method dispatch? Explain with suitable 07
example.
OR
Q.3 (a) What is wrapper class? What is the use of wrapper class in Java? 03
(b) What do you mean by Overloading? Explain constructor 04
overloading with suitable example.
(c) Explain following keywords with example 07
1) throw
2) throws
Q.4 (a) Write a program that reads file name from user, through command 03
line argument and displays/reads content of the text file on
console.
(b) What is package? What are the requirements of it? What we can 04
achieve using package?
(c) What is multithreading? What are the ways in which you can 07
create a thread? Explain with Example
1
OR
Q.4 (a) Write a program that accepts name of website from user, and 03
displays IP address of it on console.
(b) What will be the output of following code snippet? 04
(1)
class evaluate {
public static void main(String args[])
{
int arr[] = new int[] {0 , 1, 2, 3, 4, 5, 6, 7, 8, 9};
int n = 6;
n = arr[arr[n] / 2];
System.out.println(arr[n] / 2);
}
}
(2)
class equality {
int x;
int y;
boolean isequal()
{
return(x == y);
}
}
class Output {
public static void main(String args[])
{
equality obj = new equality();
obj.x = 5;
obj.y = 5;
System.out.println(obj.isequal());
}
}
(c) Explain use of following methods with suitable example 07
isAlive(), join(), setPriority().
Q.5 (a) What is use of fork and join in activity diagram? Explain with 03
suitable example.
(b) What is UML? Explain Class Model, State Model and Interaction 04
Model in brief.
(c) Draw class diagram of bank management system. 07
OR
Q.5 (a) What is usefulness of sequence diagram? List components of it. 03
(b) Explain generalization in class diagram with example. 04
(c) Draw use case diagram for hotel management system. 07
*************
2
Seat No.: ________ Enrolment No.___________
Q.2 (a) Explain DAA and LDA instructions of the 8085 microprocessor with examples. 03
(b) Draw the timing diagram of MVI A, 32H instruction of an 8085 microprocessor. 04
(c) An array of ten data bytes is stored on memory locations 2100H onwards. Write an 07
8085 assembly language program to find the largest number and store it on memory
location 2200H.
OR
(c) An array of twenty data bytes is stored on memory locations 2000H onwards. Write 07
an 8085 assembly language program to count the number of zeros, odd numbers and
even numbers and store them on memory locations 3000H, 3001H and 3002H,
respectively.
1/2
Q.3 (a) Draw the interfacing of a 4K EPROM having a starting address 2000HH with 8085 03
microprocessor. Use demultiplexed address/data lines and 3-to-8 decoder (74LS138).
(b) Write a set of 8085 assembly language instructions to generate a 0.5 second delay, if 04
the crystal frequency is 4 MHz.
(c) Write an 8085 assembly language program to count the number of bytes that are 07
greater than 2010 and lesser than 4010 from an array of ten bytes stored on memory
locations 2000H onwards. Store such numbers on memory locations 3000H onwards.
OR
Q.3 (a) Describe various addressing modes of 8085 microprocessor with examples. 03
(b) Show all the necessary connections to interface eight LEDs using an output port with 04
address 39H with 8085 microprocessor. Assume demultiplexed address/data lines.
(c) Write an 8085 assembly language program sort an array of twenty bytes stored on 07
memory locations 2000H onwards in descending order.
Q.4 (a) Enlist the sequence of steps occur when the interrupt request is placed on the INTR 03
pin of the 8085 microprocessor.
(b) Define the concept of subroutine. Explain the CALL and RET instructions of the 04
8085 microprocessor with example.
(c) State the difference between the vectored and non-vectored interrupts. Explain 07
vectored interrupts of the 8085 microprocessor.
OR
Q.4 (a) What is the need of the programmable interrupt controller (8259A)? Draw and 03
explain the block diagram of 8259A.
(b) Explain the SIM and RIM instructions of the 8085 microprocessor. 04
(c) Draw and explain the block diagram of the programmable peripheral interface 07
(8255A).
Q.5 (a) Describe the importance of bus interface unit (BIU) and execution unit (EU) the 8086 03
microprocessor.
(b) Differentiate between the real mode and protected mode of the 80286 microprocessor. 04
(c) Explain, in brief, various addressing modes of the 80286 microprocessor. 07
OR
Q.5 (a) Explain the following pins of the 8086 microprocessor: TEST , LOCK 03
(b) Briefly explain the virtual 8086 mode of the 80386 microprocessor. 04
(c) What is a descriptor table? What is its use? Dedifferentiate between GDT and LDT. 07
*************
2/2
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2018
Subject Code:2150707 Date:30/04/2018
Subject Name:Microprocessor and Interfacing
Time:02:30 PM to 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
MARKS
Q.1 (a) Answer the following questions: 03
(1) How many machine cycles are executed by 8085 microprocessor? List down it.
(2) How many flags are available in 8085 microprocessor? List down each.
(3) List down various segment registers of 8086 microprocessor.
(b) Differentiate: (1) higher level language and low level language 04
(2) hardware and software interrupt
(c) Draw and explain the internal block diagram of 8085 microprocessor. 07
Q.2 (a) What are the addressing capacity of 8085 microprocessor and 8086 03
microprocessor?
(b) Write an 8085 program to add two 16-bit nos stored in memory locations 04
2100H and 2200H respectively.
(c) Explain 8085 data transfer instructions with suitable examples. 07
OR
(c) Explain 8085 branch instructions with suitable examples. 07
Q.3 (a) How many flags are available in an 8086 microprocessor? How the parity flag 03
(PF) is used by 8086 microprocessor?
(b) Explain stack and subroutine with suitable example. 04
(c) Explain various addressing modes of 8085 microprocessor. 07
OR
Q.3 (a) How many I/O modes are available in 8255A programmable peripheral 03
interface? List and explain them in short.
(b) Differentiate 8085 microprocessor with 8086 microprocessor. 04
(c) Explain programmable interrupt controller 8259A in detail. 07
1
OR
Q.5 (a) What is a descriptor table? What is it’s main usage? 03
(b) Explain branch instruction of SUN SPARC with example. 04
(c) Draw and explain SUN SPARC microprocessor architecture in detail. 07
*************
2
Seat No.: ________ Enrolment No.___________
1
(c) A BCD number between 0 and 99 is stored in a memory location named 07
INBUF. Write a main program and a subroutine to convert the BCD
number into its equivalent binary number. Store the result in a memory
location called OUTBUF.
Q.4 (a) Define the concepts of stack and subroutine. Explain the PUSH and POP 03
instructions of an 8085 microprocessor with example.
(b) Draw the interfacing of a 4KB EPROM having a starting address 04
2000h and two 4KB static RAMs having starting addresses 4000h and
8000h, respectively, with 8085 microprocessor. Use demultiplexed
address/data lines and use 3-to-8 decoder (74LS138)
(c) Draw and explain the block diagram of the programmable peripheral 07
interface (8255A).
OR
Q.4 (a) Explain the SIM and RIM instructions of the 8085 microprocessor. 03
(b) Design an 8085 microprocessor system with 74LS138 to interface eight 04
number of push button switches at the port address 38H and common
anode seven segment LED display at 3AH.
(c) Draw and explain programmable interrupt controller 8259A. 07
*************
2
Seat No.: ________ Enrolment No.___________
Q.1 (a) Explain the following pins of the 8085 microprocessor: IO / M , INTR, RESETIN 03
(b) How will the multiplexed address/data bus (AD0-AD7) of the 8085 microprocessor 04
be demultiplexed?
(c) Explain the following instructions of the 8085 microprocessor with suitable example: 07
STA, LDAX, XTHL
Q.2 (a) Explain the flag register of the 8085 microprocessor with examples. 03
(b) Draw the timing diagram of OUT 50h instruction of the 8085 microprocessor. 04
(c) An array of ten data bytes is stored on memory locations 2100H onwards. Write an 07
8085 assembly language program to arrange them in ascending order.
OR
(c) Write an 8085 assembly language program to count the number of bytes that are 07
greater than 2010 and lesser than 4010 from an array of ten bytes stored on memory
locations 2000H onwards. Store such numbers on memory locations 3000H onwards.
Q.3 (a) Differentiate between memory-mapped I/O and peripheral-mapped I/O. 03
(b) Write a set of 8085 assembly language instructions to generate a 0.5 second delay, if 04
the crystal frequency is 4 MHz.
(c) Draw the interfacing of a 4KB EPROM having a starting address 2000h and two 2KB 07
static RAMs having starting addresses 4000h and 8000h, respectively, with 8085
microprocessor. Use demultiplexed address/data lines and use 3-to-8 decoder
(74LS138).
OR
Q.3 (a) Draw and explain the format of a flag register of the 8086 microprocessor. 03
(b) Write an 8085 assembly language program to convert a two-digit BCD number into 04
its equivalent hexadecimal number.
(c) Show all the necessary connections to interface eight LEDs using an output port with 07
address 35h and eight DIP switches using an input port with address 45h with 8085
microprocessor. Assume demultiplexed address/data lines and use 3-to-8 decoder
(74LS138).
Q.4 (a) What is an interrupt? Explain various interrupts of the 8085 microprocessor. 03
(b) Explain the PUSH and POP instructions of the 8085 microprocessor with example. 04
1/2
(c) Draw and explain the block diagram of the programmable interrupt controller 07
(8259A).
OR
Q.4 (a) What is an ISR? Differentiate between a Subroutine and an ISR. 03
(b) Enlist and explain various conditional CALL instructions of the 8085 microprocessor. 04
(c) Draw and explain the block diagram of the programmable peripheral interface 07
(8255A).
Q.5 (a) Explain the concept of segmented memory. What are its advantages? 03
(b) Briefly explain the architecture of the 80386 microprocessor. 04
(c) Explain the real mode and protected mode of the 80286 microprocessor. 07
OR
Q.5 (a) Explain the following pins of the 8086 microprocessor: TEST , LOCK , MN / MX 03
(b) Briefly explain the architecture of the SUN SPARC microprocessor. 04
(c) Draw and explain the block diagram of an ARM 7 processor. 07
*************
2/2
Seat No.: ________ Enrolment No.___________
MARKS
Q.1 (a) Explain the difference between a microprocessor and a microcomputer. 03
(b) List the four operations commonly performed by the MPU. 04
(c) Draw and Explain the functional Block diagram of 8085 microprocessor. 07
Q.2 (a) Specify the number of registers and memory cells in a 128 × 4 memory chip. 03
(b) List the sequence of events that occurs when the 8085 MPU reads from 04
memory
(c) Identify the machine cycles in the following instructions 07
1. SUB B
2. ADI 47H
3. STA 2050H
4. PUSH B
OR
(c) Describe basic Machine Cycle used in 8085. Draw Timing Diagram for OUT 07
instruction
Q.3 (a) Define opcode and operand, and specify the opcode and the operand in the 03
instruction MOV H, L
(b) Define addressing mode? State the addressing modes of the following 04
instructions
1. MOV A, B
2. LDA 2500H
3. ANA M
(c) Explain 8085 Programming Model and Flag Register. 07
OR
Q.3 (a) List the four categories of 8085 instruction that manipulate data. 03
(b) Explain the functions of following instructions of 8085 – state the bytes 04
occupied, number of Machine cycle required and T-States
1. LXI H, 2050H
2. MOV B,A
3. STA 5050H
4. ADD C
(c) Explain 8085 Programming model and classify instruction set on the basis of 07
different addressing modes.
Q.4 (a) Specify the contents of the registers and flag status as the following instruction 03
are executed.
A B C D S Z CY
MVI A,00H
MVI D, F8H
MOV B, A
ADD D
HLT
(b) Write an 8085 Assembly language program to evaluate the Boolean equation 04
D = (B+C) * E, where B, C, E represents data in various registers of 8085.
(c) The following block of data is stored in the memory locations from 2050H to 07
2055H. Write an 8085 Assembly language program to Transfer the data to the
locations 2080H to 2085H in the reverse order
DATA(H) 25, A5, 4F, E3, AF, F1
OR
Q.4 (a) Specify the output at PORT 7 if the following program is executed. 03
MVI B, 82H
MOV A, B
MOV C, A
MVI D, 37H
OUT PORT 7
HLT
(b) Write an 8085 Assembly language program to interchange 16-bit data stored 04
in memory locations 2050, 2051, 2052, and 2053. WITHOUT XCHG
INSTRUCTION.
(c) Write an 8085 Assembly language program to add the following data bytes 07
stored in memory locations starting at 4050H and display the sum at the output
port if the sum does not generate a carry, stop the addition, and display 01H at
the output port.
DATA(H) 1A, 32, 4F, 12, 27
Q.5 (a) Draw Block Diagram and Pin Diagram of 8259 Microcontroller. 03
(b) Design an up-down counter to count from 0 to 7 and 7 to 0 continuously with 04
a 1-second delay between each count, and display the count at one of the output
ports. Show the delay calculation
(c) Discuss the features of ARM processor. 07
OR
Q.5 (a) List and explain the interrupt available in microprocessor 8085. 03
(b) A Railway crossing signal has two flashing lights run by a microcomputer. 04
One light is connected to data bit D7 and the second light is connected to data
bit D6. Write a program to turn each signal light alternately ON and OFF at an
interval of 2 second.
(c) Draw and explain architecture of SUN SPARK. 07
*************
Seat No.: ________ Enrolment No.___________
Q.1 (a) Draw neat sketch diagram of Life cycle of a source program. 03
(b) Define following: Language Migrator, Execution gap, Token, Handle 04
(c) Explain Analysis and Synthesis phase of Compiler. 07
Perform lexical, syntax and semantic analysis on below C statement:
int i;
float a, b;
a = b + i;
Q.3 (a) Define Assembler. List out tasks performed during different phase of assembler. 03
(b) Given the Grammar, evaluate the string id - id * id using shift reduce parser. 04
E-> E – E
E -> E * E
E -> id
(c) Compare Variant I and Variant II of intermediate code generation for assembler. 07
Write intermediate code for Variant I and Variant II of below program fragment.
START 200
READ A
LOOP MOVER AREG, A
.
.
.
SUB AREG,=’1’
BC GT,LOOP
STOP
A DS 1
LTORG
…
1
OR
Q.3 (a) Define forward references. How it can be solved using back-patching. 03
(b) Describe following data structures: OPTAB, SYMTAB, LITTAB and 04
POOLTAB.
(c) List out assembler directives and explain any two advance assembler directives. 07
************
2
Seat No.: ________ Enrolment No.___________
MARKS
Q.1 Short Questions 14
1 Define : Language Processor.
2 _________ phase performs type checking task.
[ a] Lexical Analysis [b] Syntax Analysis [c] Semantic Analysis
1 1
(c) Show that following regular expressions are equivalent by constructing 07
optimized DFA.
(0/1)*
(0*/1*)*
Q.3 (a) What is Peephole optimization? Explain any two optimization 03
transformations in detail.
(b) Define and explain different intermediate code representations. 04
(c) What is main task of semantic analysis phase? Explain inherited and 07
synthesized attributes in detail with example.
OR
Q.3 (a) Define: L-Attributed definition in detail. 03
(b) State different storage allocation strategies. Explain static allocation and 04
stack allocation in detail.
(c) Generate Quadruple, Triple, Indirect Triple for following expression: 07
ans=a+b*c/2.0
Q.4 (a) What is program relocation? How relocation is performed by linker? 03
(b) Write and explain the algorithm for macro expansion. 04
(c) Explain in brief design of a Two Pass Assembler. 07
OR
Q.4 (a) What is overlay? Explain the execution of an overlay structure program. 03
(b) Explain in brief self relocating programs. 04
(c) Explain in detail any two advanced assembler directives. 07
*************
2 2
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2018
Subject Code:2150708 Date:02/05/2018
Subject Name:System Programming
Time:02:30 PM to 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
MARKS
Q.1 (a) What is the difference between System Software and Application software? 03
(b) Define following terms: 1) Assembler 2) Macro 3) Parsing 4)Interpreter 04
(c) Explain Life cycle of source program with neat sketch. 07
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.
1
OR
Q.3 (a) Explain following terms with suitable example. 03
1. Expansion time variable 2. Positional parameter
(b) Explain Left recursion, Left factoring in top down parsing 04
(c) What is operator precedence parsing? Show operator precedence matrix for 07
following operators: +, - , *, (,). Parse following string:
|- <id> + <id> * <id> -|
Q.4 (a) Define forward references. How it can be solved using back-patching. 03
(b) Explain triple and quadruple representation with example. 04
(c) What is program relocation? How relocation is performed by linker? Explain 07
with example.
OR
Q.4 (a) Explain the term loader with its basic function. 03
(b) Explain types of grammar. 04
(c) Explain with examples - expansion time variables, expansion time Statements - 07
AIF and AGO for macro programming. Show their usage for expansion time
loop by giving example.
*************
2
Seat No.: ________ Enrolment No.___________
MARKS
Q.1* (a) Explain different kinds of system software. 03
(b) Define the following terms: 04
1)Backpatching 2)Simple phrase grammar 3)Left recursion 4)Top-
down parsing
(c) Which activity reduce specification gap? Explain with suitable example. 07
Who will reduce execution gap?
(c) Draw the expression tree for the string f+(x+y)*((a+b)/(c-d)) by their 07
evaluation order and mention register required label in each node.
1
Q.5 (a) Explain working of triple, quadruples and indirect triples with example. 03
(b) Explain attributes of formal parameter and expansion time variable in 04
macro.
(c) Define the following terms 07
1) Translation time address: 2) Linked time address 3) Load time
address: 4) Translated origin: 5) Linked origin: 6) Load origin: 7)
Interpreter
OR
Q.5 (a) Explain operand descriptor and register descriptor for a*b. 03
(b) Explain absolute loader in detail. 04
(c) Explain Naïve Bottom up parsing algorithm with example and also 07
mention which problem occurs during parsing.
*************
2
Seat No.: ________ Enrolment No.___________
Q.2 (a) If the string a9b had been identified as identifier, but if in the 03
further use 9ab is written, which phase of compiler would
identify as an error? How?
(b) How a lexical analyzer recognizes unsigned numbers such as 04
12,12.3,12.3E4?
(c) Consider the assembly program fragment 07
START 200
READ A
LOOP MOVER AREG,A
SUB AREG,=’1’
BC GT,LOOP
STOP
A DS 1
What will be the intermediate code for the above program
fragment? What does START directive do? What will be the
difference if ORIGIN directive is used in place of START?
OR
(c) Consider the assembly program fragment, 07
MOVER CREG, B
ADD CREG, =’1’
BC ANY,NEXT
LTORG
=’5’
=’1’
SUB AREG,=’1’
END
=’1’
(i) Explain LTORG directive.
1
(ii)Explain the entries in mnemonic opcodes table as per
above code fragement.
(iii) How table of literals will be manipulated?
Q.3 (a) Which type of gap makes the software buggy or unreliable? 03
Which methods can be used to overcome this situation?
(b) How the use of programming language can help in making the 04
software reliable?
(c) Write Macro definition with following and explain. 07
(i) Macro using expansion time loop
(ii) Macro with REPT statment
OR
Q.3 (a) Write Macro definition for adding two numbers that uses 03
positional and keyword parameters.
(b) Write a macro definition for adding two numbers 10 times. Use 04
nested macro call to increment numbers by 1 every time in 10
iterations.
(c) Consider the following grammar for expressions 07
E → EAE | (E) | -E | id
A → + | - | * | / | ^ where ^ represents exponent. Generate operator
precedence relation matrix and show how id * id ^ id will be
parsed?
Q.4 (a) Justify “Postfix string is a popular intermediate code in non 03
optimizing compilers”
(b) Which are the methods used for identifying free memory area? 04
(c) Define program relocation. How address is corrected in address 07
sensitive instructions in case of program relocation.
OR
Q.4 (a) A program computes i*5 for 10 times. What type of optimization 03
can be applied?
(b) What is the structure of LEX program? 04
(c) Explain common sub expression elimination using value 07
numbers.
Q.5 (a) What is ambiguity in grammatic specification? 03
(b) Describe the facilities for dynamic debugging. 04
(c) Write a code fragment to find out whether number is odd or even. 07
Draw control flow graph. Perform control flow analysis.
OR
Q.5 (a) Describe three components of the interpreter. 03
(b) Define linking. How external reference is resolved in linking? 04
(c) What is memory binding? Explain dynamic memory allocation 07
using extended stack model.
*************