pcd unit3

5
KARAIKUDI INSTITUTE OF TECHNOLOGY & KARAIKUDI INSTITUTE OF MANAGEMENT UNIT TEST III FEBRUARY 2014 Roll No: Year/Dept: III/ CSE Date: 26 Wednesday 2014 CS2352- PRINCIPLES OF COMPILER DESIGN Time: 09:15 A.M. – 11:00 A.M. 50 Mark s (Answer All the Questions) PART A - 2 Mark Qs (5x2=10) 1. List out the benefits of machine independent intermediate forms. 2. Write the properties of intermediate language? 3. List various forms of intermediate code. 4. What are the different ways of implementing the three address code? 5. What is backpatching? 2 PART B 1. Define three address code.Describe the various mathods of implementing the three address statement with an example. 2. (i)Give the translation scheme for converting the assignments into three address code for the following grammar S->id:=E E->E1+E2 E->E1*E2 E->-E1 E->(E1) E->id (ii)Give the syntax directed translation for the case statement Switch E { Case V1:S1 ……… Case Vn-1:Sn-1 Default:Sn 8 10 6 Prepared by, K.NANDHINI, LT/CSE

Upload: rathiramsha7

Post on 21-Jul-2016

214 views

Category:

Documents


3 download

DESCRIPTION

g

TRANSCRIPT

Page 1: pcd unit3

KARAIKUDI INSTITUTE OF TECHNOLOGY&

KARAIKUDI INSTITUTE OF MANAGEMENT

UNIT TEST III FEBRUARY 2014

Roll No: Year/Dept: III/ CSE Date: 26 Wednesday 2014

CS2352- PRINCIPLES OF COMPILER DESIGNTime: 09:15 A.M. – 11:00 A.M.

50 Mark

s(Answer All the Questions)

PART A - 2 Mark Qs (5x2=10)

1. List out the benefits of machine independent intermediate forms.2. Write the properties of intermediate language?3. List various forms of intermediate code.4. What are the different ways of implementing the three address code?5. What is backpatching?

2

PART B

1. Define three address code.Describe the various mathods of implementing the three address statement with an example.2. (i)Give the translation scheme for converting the assignments into three address code for the following grammarS->id:=E E->E1+E2 E->E1*E2E->-E1 E->(E1) E->id (ii)Give the syntax directed translation for the case statement Switch E{Case V1:S1………Case Vn-1:Sn-1Default:Sn}

(or)3. Discuss the various methods for translating the Boolean expression

4. (i)Give the syntax directed translation scheme for the statement (call p1(int a,int b)) (ii)Explain the process of generating the code for a Boolean expression in a single pass using backpatching. (or)5. Translate (a or b)and(c<d)and(d<e) into three address statement using backpatching.

8

10

6

16

88

16

Prepared by, K.NANDHINI, LT/CSE

Page 2: pcd unit3

KARAIKUDI INSTITUTE OF TECHNOLOGY&

KARAIKUDI INSTITUTE OF MANAGEMENT

UNIT TEST III FEBRUARY 2014

Roll No: Year/Dept: III/ CSE Date: 26 Wednesday 2014

*********************ALL THE BEST*********************

6

(ii) Consider the following snapshot of a system :

Allocation Max AvailableA B CD A B C D A B C D

PO 0 0 1 2 0 0 1 2 1 5 2 0 PI 1 0 0 0 1 7 5 0P2 1 3 5 4 2 3 5 6

Prepared by, K.NANDHINI, LT/CSE

Page 3: pcd unit3

KARAIKUDI INSTITUTE OF TECHNOLOGY&

KARAIKUDI INSTITUTE OF MANAGEMENT

UNIT TEST III FEBRUARY 2014

Roll No: Year/Dept: III/ CSE Date: 26 Wednesday 2014

P3 0 6 3 2 0 6 5 2P4 0 0 1 4 0 6 5 6

Answer the following questions using banker's algorithm :(1) What is the content of the matrix Need?(2) Is the system in a safe state?

(3) If a request from process PI arrives for (0,4,2,0) can therequest be granted immediately?

(OR)

325

13. b. Explain in detail segmentation with paging.14. a (i) Distinguish Demand paging and anticipatory paging.

(ii) Comment on inverted page tables and their use in paging andsegmentation.

(OR)

b. Explain the advantages and shortcomings of LRU approximation page replacement

15. a Consider a typical situation in a multiprogramming environment, in which the operating system maintains a queue of requests for each I/O device. Assume the disk has 200 tracks and that the disk request queue has random requests in it. The requested tracks are received in the following order: 55, 58, 39, 18, 90, 160, 150, 38, 184, 27, 129, 110, 186,147, 41, 10, 64, 120. Assume that the head disk is initially positioned over track 100 and is moving in the direction of decreasing track number. Perform the analysis for FIFO, SSTF, SCAN, C-SCAN, LOOK and C-LOOK. Compare the results and give recommendations.

(OR)

15. b . Given memory partitions of 100K, 500K, 200K, 300K, and 600K in order), how would each of the First-fit, Best-fit, and Worst-fit algorithms place processes of 412K, 317K, 112K, and 326K (in order)? Which algorithm makes the most efficient use of memory?

168

8

16

16

16

Prepared by

Prepared by, K.NANDHINI, LT/CSE