Sie sind auf Seite 1von 40

Seat No.: ________ Enrolment No.

___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2017
Subject Code: 2150703 Date: 05/05/2017
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.

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

Q.3 (a) Write down the characteristics of Greedy Algorithm. 03


(b) Solve following recurrence using master method 04
T(n) = 9T(n/3) +n
(c) Solve Making change problem using dynamic technique. 07
D1 = 1, d2=3, d3=5, d4=6. Calculate for making change of
Rs. 8.
OR

Q.3 (a) Solve following recurrence using master method 03


T(n) = T(2n/3) + 1

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.

Q.4 (a) Multiply 981 by 1234 by divide and conquer method. 03


(b) Find an optimal Huffman code for the following set of 04
frequency. a : 50, b: 20, c: 15, d: 30.
(c) Consider Kanpsack capacity W=50, w=(10,20,40) and 07
v=(60,80,100) find the maximum profit using greedy
approach.
OR
Q.4 (a) Expalin Dijkstra algorithm to find the shortest path. 03
(b) Explain in brief Breadth First Search method. 04
(c) For the following chain of matrices find the order of 07
parenthesization for the optimal chain multiplication
(15,5,10,20,25)
Q.5 (a) Explain: Articulation Point, Graph, Tree 03
(b) Explain 4 queen problem with one of the solution, 04
(c) What is Rabin Karp algorithm? Where it is used? Explain 07
the concept behind this algorithm and calculate its time
complexity.
OR
Q.5 (a) What is Finite Automata? Explain use of finite automata 03
for string matching with suitable example.
(b) Explain naïve string matching algorithm with example. 04
(c) Explain Traveling salesman problem with example. 07

*************

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.

(c) Write standard(conventional) algorithm and Strassen's algorithm for matrix 07


multiplication problem. What is the recurrence for Strassen's algorithm?
Solve it using master method to derive time complexity of Strassen's
algorithm.

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.

(b) Explain polynomial-time reduction algorithm. 04


(c) Working modulo q = 11. How many spurious hits does the Rabin-Karp 07
matcher encounter in the text T = 3141592653589793 when looking for the
pattern P =26?
OR

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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – SUMMER 2019
Subject Code: 2150703 Date: 06/06/2019
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.
MARKS
Q.1 (a) What is an algorithm? How it differ from flowchart? 03
(b) Give difference of dynamic programming and divide-and- 04
conquer method.
(c) Explain Asymptotic notation. Arrange the growth rate of 2n, n2, 07
1, log n, n logn, 3n and n in increasing order of growth.
Q.2 (a) Differentiate greedy and dynamic programming. 03
(b) Find out the Ө-notation for the function: f(n)=27n2+16n. 04
(c) What is recurrence? Explain recursion-tree method with suitable 07
example.
OR
(c) Write the Master theorem. Solve following recurrence using it. 07
(i) T(n)=9T(n/3) + n (ii) T(n)=3T(n/4) + nlgn
Q.3 (a) Use Iteration method to solve recurrence T(n) = T(n-1) + 1 , here 03
T(1)= Ө(1).
(b) Explain general characteristics of greedy algorithms. 04
(c) Using dynamic programming find out the optimal sequence for 07
the matrix chain multiplication of A4x10, B10x3, C3x12, D12x20 and
E20x7 matrices.
OR
Q.3 (a) Write the best and worst running time of Insertion sort 03
algorithm. Why it differ?
(b) What are the steps for dynamic programming? Explain principal 04
of optimality.
(c) Determine LCS of {1,0,0,1,0,1,0,1} and {0,1,0,1,1,0,1,1,0} 07
Q.4 (a) What is string-matching problem? Define valid shift and invalid 03
shift.
(b) Define P, NP, NP-complete and NP-hard problems. 04
(c) Explain 0/1 knapsack using suitable example. 07
OR
Q.4 (a) Write pseudo-code for Naïve-String-Matching algorithm. 03
(b) Define spanning tree and MST. How Krushkal’s algorithm is 04
different from Prim’s algorithm.
(c) Explain fractional knapsack problem with example. 07
Q.5 (a) Define graph, complete graph and connected graph. 03
(b) Differentiate BFS and DFS. 04
(c) Write and explain Dijkastra algorithm with example. 07
OR
Q.5 (a) Explain “P = NP ?” problem. 03
(b) Write just steps for Backtracking and Branch-and-Bound 04
algorithms.
(c) Explain travelling salesman problem. Prove that it is NP 07
complete problem.
*******
1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2017
Subject Code: 2150703 Date: 16/11/2017
Subject Name: Analysis and Design of Algorithms
Time: 10:30 AM TO 01: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) 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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2018
Subject Code:2150703 Date:27/11/2018
Subject Name:Analysis and Design of Algorithms
Time: 10:30 AM TO 01: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) Define Algorithm, Time Complexity and Space Complexity. 03


(b) Differentiate branch and bound and back tracking algorithm. 04
(c) Analyze Selection sort algorithm in best case and worst case. 07

Q.2 (a) Solve the recurrence T(n) = 7T(n/2) + n3 03


(b) Explain: Articulation Point, Graph, Tree 04
(c) Write Merge sort algorithm and compute its worst case and best-case 07
time complexity. Sort the List G,U,J,A,R,A,T in alphabetical order
using merge sort.
OR
(c) Consider Knapsack capacity W=9, w = (3,4,5,7) and v=(12,40,25,42) 07
find the maximum profit using dynamic method.
Q.3 (a) Differentiate the Greedy And Dynamic Algorithm. 03
(b) Demonstrate Binary Search method to search Key = 14, form the array 04
A=<2,4,7,8,10,13,14,60> .
(c) Solve Making change problem using dynamic technique. d1 = 1, d2=2, 07
d3=4, d4=6, Calculate for making change of Rs. 10.
OR
Q.3 5
(a) Find out the NCR ( )Using Dynamic Method. 03
3
(b) Find single source shortest path using Dijkstra’s algorithm form a to e. 04

(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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2017
Subject Code: 2150704 Date: 27/04/2017
Subject Name: Object Oriented 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.
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2018
Subject Code:2150704 Date:12/05/2018
Subject Name:Object Oriented Programming using JAVA
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) Differentiate between constructor and method of a class. 03


(b) Explain short circuited operator with example. 04
(c) Explain Interface in JAVA. How do interfaces support polymorphism? 07

Q.2 (a) Compare Object oriented programming with sequential programming. 03


(b) Explain use of finally in exception handling. 04
(c) Explain use of Linked List collection class with example. 07
OR
Y
(c) Write a method for computing X doing repetitive multiplication. X and y are of 07
type integer and are to be given as command line arguments. Raise and handle
exception(s) for invalid values of X and y.
Q.3 (a) Explain different Visibility modifiers. 03
(b) Describe Inheritance and its types with suitable example. 04
(c) Explain following terms with example: 07
(A) Nested Class (B) Anonymous Inner Class
OR
Q.3 (a) What is UML? How it is useful? 03
(b) Explain keywords private and protected. 04
(c) Write a program to check whether the name given from command line is file or not? 07
If it is a file then print the size of a file and if it is a directory then it should display
the name of all files in it.
Q.4 (a) State difference between String Class and StringBuffer Class. 03
(b) Differentiate the following: 04
A. Text I/O and Binary I/O
B. Checked and Unchecked exceptions
(c) Write a program using BufferedInputStream, FileInputStream, 07
BufferedOutputStream, FileOutputStream to copy content of one file Test1.txt into
another file Test2.txt.
OR
Q.4 (a) Explain ‘ordered’, ‘bags’ and ‘sequences’ in class diagram. 03
(b) Explain the keywords: 1. Wrapper class 2. finalize () method 04
3. Recursion 4. Static
(c) Write a program which shows an example of function overriding. 07

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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – SUMMER 2019
Subject Code: 2150704 Date: 20/06/2019
Subject Name: Object Oriented Programming using JAVA
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) Differentiate between protected and default access specifiers. 03
(b) Distinguish between method overloading and overriding with suitable 04
example.
(c) Justify: 07
1. Why we declare main() method as public and static member.
2. Why we generally declare constructor as public member.
3. Why there is no destructor in java.

Q.2 (a) What do you understand by inner class? 03


(b) Write a program to take three numbers as command line argument. Display 04
the maximum among them?
(c) Differentiate between final, finally and finalize. What will happen if we 07
make class and method as final?
OR
(c) Write a class named Rectangle to represent a rectangle. It contains following 07
members:
Data: width (double) and height (double) that specify the width and height of the
rectangle.
Methods:
1. A no-arg constructor that creates a default rectangle.
2. A constructor that creates a rectangle with the specified width and height.
3. A method named getArea() that returns the area of this rectangle.
4. A method named getPerimeter() that returns the perimeter.
Q.3 (a) What do you understand by super keyword? Write use of super keyword. 03
(b) Differentiate between Interface and abstract class. When Interface is 04
preferred over abstract class.
(c) Write an abstract class named Person and its two subclasses named Student 07
and Employee.
A person has a name, address, phone number, and email address. A student
has enrollment, course. An employee has an office, salary, and designation.
Define constructors and methods for input and display for both classes.
Write a main program to give demonstration of all.
OR
Q.3 (a) What do you understand by package? Discuss benefits of package. 03
(b) Write a program to create two thread one display alphabet from a to z and 04
other will display numbers from 1 to 100.
(c) Explain dynamic method dispatch with example? 07
Q.4 (a) What are Wrapper classes? What is Autoboxing? 03
(b) Consider following code fragment: 04
try {
statement1;
1
statement2;
statement3;
}
catch (Exception1 ex1) {
}
finally {
statement4;
}
statement5;
1. Which Statements will execute if no exception is occurs.
2. Which Statements will execute if Exception 1 is occurs at statement
2.
(c) Differentiate the followings: 07
1. Checked and Unchecked Exceptions
2. Socket and ServerSocket
3. Text I/O and Binary I/O
4. String and StringBuffer
OR
Q.4 (a) What do you understand by Collection framework in java? List methods 03
available in iterator interface.
(b) What do you understand by thread? Describe the complete life cycle of 04
thread.
(c) Write a program that counts number of characters, words, and lines in a text 07
file.
Q.5 (a) Discuss benefits of Object Oriented Approach? 03
(b) Draw the use case diagram of Library management system. 04
(c) Define: 07
1. Association
2. Aggregation
3. Metadata
4. Constraints
5. Package
6. Multiplicity
7. Qualified Association
OR
Q.5 (a) Explain state diagram with example 03
(b) Write a sequence diagram of ATM withdrawal process. 04
(c) Explain Class Model, State model and Interaction model. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2017
Subject Code: 2150704 Date: 03/11/2017
Subject Name: Object Oriented Programming using JAVA
Time: 10:30 AM TO 01: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) Discuss public, private and protected access modifiers. 03
(b) What is constructor? Explain constructor overloading with 04
example.
(c) Discuss Following with example: 07
(i) Super Keyword
(ii) Final Keyword

Q.2 (a) Explain usage of class FileInputStream and FileOutputStream by 03


giving an example.
(b) Draw and Explain Thread Life Cycle. 04
(c) Explain Dynamic method dispatch with proper example. 07
OR
(c) Create a class called Student. Write a student manager program to 07
manipulate the student information from files by using the
BufferedReader and BufferedWriter.

Q.3 (a) List features of Java. Briefly explain any two. 03


(b) (i) Create a two dimensional array. Instantiate and Initialize it. 04
(ii) Differentiate String class and StringBuffer class.
(c) Explain the words ‘static’ and ‘this’ with the help of example. 07
OR
Q.3 (a) List and Explain Methods for Inter-thread communication 03
(cooperation).
(b) Explain package and its use with appropriate example. 04
(c) Write a program for chat application using TCP. 07

Q.4 (a) Discuss exception and error. 03


(b) Differentiate between Method overloading and Method overriding. 04
(c) Define the following terms: 07
Aggregation, Abstract Class, Generalization, Rectification,
Constraints, Package, Metadata.
OR
Q.4 (a) Write a note on ‘Collection in JAVA’. Also discuss List and 03
Enumeration Interface.
(b) Discuss link and association in UML with diagram. 04
(c) Explain the importance of exception handling in java. Which key 07
words are used to handle exceptions? Write a program to explain
the use of these keywords.

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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2018
Subject Code:2150704 Date:11/12/2018
Subject Name:Object Oriented Programming using JAVA
Time: 10:30 AM TO 01: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) Define following. 03
1) Byte code
2) Java Virtual Machine
3) Unicode
(b) Write a program which takes five numbers as command line 04
argument from user, store them in one dimensional array and
display count of negative numbers.
(c) What do you mean by Interface? Compare interface and abstract 07
class with suitable example.

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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2017
Subject code: 2150707 Date: 01/05/2017
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.

Q.1 Answer the following questions:


i. Differentiate between higher level language and assembly level language. 01
ii. What is the function of ALE pin? 01
iii. Name different types of machine cycles executed by the 8085 microprocessor? 01
iv. What will be done if OUT 50h instruction is executed? 01
v. Write the set of 8085 assembly language instructions to store the contents of B 01
and C registers on the stack.
vi. Draw the structure of a flag register of the 8085 microprocessor. 01
vii. How much time the 8085 microprocessor will take to execute the MOV B, A 01
instruction, if the crystal frequency is 4MHz?
viii. Explain the STA instruction of the 8085 microprocessor with example. 01
ix. What is the difference between ORA and ORI instructions? 01
x. Explain the use of BHE / S7 pin of the 8086 microprocessor. 01
xi. Enlist various segment registers available in the 8086 microprocessor. 01
xii. Draw the format of a flag register of the 8086 microprocessor. 01
xiii. State various types of registers available in programmable interrupt controller 01
(8259).
xiv. What will be the physical address (PA), if CS and IP register contents of the 8086 01
microprocessor are 2000h and 20h, respectively?

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

Q.4 (a) Draw timing diagram for an arithmetic instruction: MOVE A, B. 03


(b) Write an assembly language program to find the factorial of a number from 0 to 04
10.
(c) Draw and explain the architecture of Pentium processor. 07
OR
Q.4 (a) What are the main features of ARM processor? List down each. 03
(b) How the physical addresses are calculated from segment register in 8086 04
microprocessor?
(c) Draw and explain internal architecture diagram of 8086 microprocessor. 07

Q.5 (a) What is page table? How it works? 03


(b) Explain arithmetic instruction of SUN SPARC with example. 04
(c) Differentiate 80286 with 80386 microprocessor. 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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – SUMMER 2019
Subject Code: 2150707 Date: 31/05/2019
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. What is the use of ALE pin in 8085?
2. How much time 8085 will take to execute LDA 16bit instruction if
the crystal frequency is 4MHz.
3. List down various segment registers of 8086 microprocessor.
(b) 1. Differentiate between hardware interrupts and software interrupts of 04
8085.
2. Write 8085 instructions to store 00H in flag register.
(c) Draw and explain the internal block diagram of 8085 microprocessor. 07
mapped I/O
Q.2 (a) Draw the timing diagram of MVI A, 8bit instruction of 8085 03
microprocessor.
(b) Explain the following instructions of the 8085 microprocessor with 04
ssuitable example: LHLD, SPHL, LDAX, XTHL
(c) Write a program in 8085 to arrange the five numbers in ascending 07
order. Assume numbers are available from 9000h to 9004h.
OR
(c) An array of twenty data bytes is stored on memory locations 2000H 07
onwards. Write 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.
Q.3 (a) Enlist the sequence of steps occur when the interrupt request is placed on 03
the INTR pin of the 8085 microprocessor.
(b) Explain the functions of following instructions of 8085 – state its 04
number of bytes occupied, number of Machine cycle required and T-
states.
1. MOV A,M
2. LXI H,1000H
3. DAA
4. IN 80H
(c) A set of ten packed BCD numbers are stored in memory location starting 07
from XX50H. Write a program without subroutine to add these numbers
in BCD. If carry is generated save in register B, and adjust it for BCD.
The final sum will be less than 9999BCD.
OR
Q.3 (a) State the difference between the vectored and non-vectored interrupts. 03
Explain vectored interrupts of the 8085 microprocessor.
(b) Write a main program and interrupt service routine to count the number 04
of times the key is pressed by the user and display the count on data field
of output port at address 80H and 81H (2-7seg LED).

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

Q.5 (a) Discuss the features of ARM Processor. 03


(b) Differentiate between the real mode and protected mode of the 80286 04
microprocessor.
(c) Explain, in brief, various addressing modes of the 8086 microprocessor. 07
OR
Q.5 (a) Draw and explain architecture of SUN SPARC. 03
(b) What is a descriptor table? What is its use? Differentiate between GDT and 04
LDT.
(c) Explain the paging mechanism in an 80386 microprocessor. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2017
Subject Code: 2150707 Date: 08/11/2017
Subject Name: Microprocessor and Interfacing
Time: 10:30 AM TO 01: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) 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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2018
Subject Code:2150707 Date:16/11/2018
Subject Name:Microprocessor and Interfacing
Time: 10:30 AM TO 01: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) 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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – SUMMER 2019
Subject Code: 2150708 Date: 03/06/2019
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.

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.2 (a) Differentiate Application software with System software. 03


(b) Write Regular expression for all string end with ‘abb’ and Construct equivalent 04
DFA.
(c) (i) Write unambiguous production rules to produce arithmetic expression 07
consisting of +, *, ( , ), id.
(ii) Remove left recursion from that unambiguous production rules and generate
LL(1) parsing table for that grammar.
OR
(c) (i) Define Operator precedence grammar. Convert following production rules 07
of grammar into suitable Operator precedence grammar.
E → EAE | id
A→-|*
(ii) Generate operator precedence relation matrix for converted Operator
precedence grammar. Show how id - id * id will be parsed using Operator
Precedence Matrix.

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

Q.4 (a) Differentiate Linker and Loader. 03


(b) Define Macro - preprocessor. Explain steps of Macro Preprocessor Design. 04
(c) Explain use and field of following tables of a macro KPDTAB, MDT, EVTAB, 07
SSTAB
OR
Q.4 (a) Explain Nested macro call with suitable example. 03
(b) Explain attributes of formal parameter and expansion time variable in macro. 04
(c) Write a brief note on MS-DOS Linker. 07

Q.5 (a) Explain the term self-relocating program. 03


(b) Define overlay. Explain the execution of an overlay structured program. 04
(c) List out various Code Optimization techniques used in Compiler. Explain any 07
three technique with suitable example.
OR
Q.5 (a) Differentiate Compiler and Interpreter. 03
(b) Compare Absolute Loader with Relocating Loader (BSS Loader). 04
(c) Explain triple, quadruple and indirect triples representation with example. 07

************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2017
Subject Code: 2150708 Date: 03/05/2017
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 Short Questions 14
1 Define : Language Processor.
2 _________ phase performs type checking task.
[ a] Lexical Analysis [b] Syntax Analysis [c] Semantic Analysis

3 Define : Parse tree.


4 State True/False : Code optimization phase is optional phase of compiler.

5 Which phase of compiler will generate error if semicolon is missing in a c


program?
6 Define : intermediate code.
7 Define : Pattern.
8 State True/False : Top Down parsers can never work with left recursive
grammar.
9 Define: symbol Table.
10 Define: Semantic Gap.
11 Define : Backpatching.
12 State True/False : “Single pass assemblers cannot handle forward
references.”
13 Define : Macro Assembler.
14 State True/False : Symbol table is used to store mnemonics and opcodes.
Q.2 (a) Eliminate left recursion from following grammar. 03
S A
A  Ad | Ae | aB | aC
B  bBC | f
Cg
(b) Construct LL(1) parsing table for following grammar. 04
S  iCtSeS | iCtS | a
Cb
(c) Construct an optimized DFA : 07
0*1*(0/1)#
OR

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

Q.5 (a) Explain Types of grammar in detail. 03


(b) Compare and Contrast macro preprocessor and macro assembler. 04
(c) Explain in brief design the linker. 07
OR
Q.5 (a) Define: Ambiguous grammar. Also state example of same. 03
(b) Explain and compare two variants of intermediate code. 04
(c) Explain in brief the design of a macro assembler. 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

Q.2 (a) Explain memory allocation in block structured language. 03


(b) Explain in detail any two advanced assembler directives. 04
(c) Given a grammar, 07
E →TA,
A → +TA | ε
T →VB
B →*VB | ε
V →id | (E)
Develop an LL (1) parser table and parse following string using the parsing table.
id * ( id + id)
OR
(c) Given the source program: 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.

Q.3 (a) Compare various intermediate code forms for an assembler. 03


(b) Describe following data structures: OPTAB, SYMTAB, LITTAB and 04
POOLTAB.
(c) Explain use and field of following tables of a macro 07
KPDTAB, MDT, EVTAB, SSTAB

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.

Q.5 (a) Explain any three Code Optimization Techniques. 03


(b) Define: L-Attributed definition in detail. 04
(c) By taking the example of factorial program explain how activation record will 07
look like for every recursive in case of factorial (3).
OR
Q.5 (a) Explain lexical analysis of language processor 03
(b) Explain the terms Binding and Binding Times. 04
(c) Explain the drawbacks and benefits of Interpretation 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE – SEMESTER (SYLLABUS) EXAMINATION- WINTER 2017

Subject Code: 2150708 Date: 13/11/2017


Subject Name: System Programing
Time: 10.30AM to 01.00PM 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) 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?

Q.2 (a) Draw a flowchart of maintaining Table of Incomplete Instruction (TII) in 03


assembler.
(b) Construct a deterministic finite automata for (0|1)*011 04
(c) Write algorithm for practical approach of top down parsing. 07
OR
(c) Construct predictive parsing table for following grammar: 07
E->BA
A-> &BA|€
B->true|false
Q.3 (a) Explain the data structure of single pass assembler. 03
(b) Explain the use of intermediate code with example in assembler and 04
also mention field of it.
(c) Construct an operator precedence matrix for the operators of a grammar 07
for expressions containing arithmetic, relational and Boolean operator.
OR
Q.3 (a) Explain the difference between literal and constant in assembler with its 03
syntax. Why POOLTAB is requiring?
(b) Which data structure is used for automatic dynamic allocation and 04
memory access? Explain with suitable example.
(c) Give suitable example for nested macro call with its data structure. 07
Q.4 (a) Explain use of value number in local optimization. 03
(b) Give suitable example for macro by using conditional expansion or 04
expansion time loops.
(c) Explain Self relocating program and overlay structure program. 07
OR
Q.4 (a) Explain pure and impure interpreter. 03
(b) Explain the front end of toy compiler with suitable example. 04

(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.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2018
Subject Code:2150708 Date:20/11/2018
Subject Name:System Programming
Time: 10:30 AM TO 01: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) Remove left recursion from following grammar 03
A → Ac | Aad | bd | ε
(b) Consider a grammar S → aa | aSa, How a top down backtracking 04
parser can generate six occurrences of a?
(c) Construct an LL(1) parsing table for the following grammar. 07
S → aBDh
B → cC
C → bC | ε
D → EF
E→g|ε
F→f|ε

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.

*************

Das könnte Ihnen auch gefallen