0% found this document useful (0 votes)
21 views5 pages

(Fall08) Major

IITD paper

Uploaded by

gjluztdg3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

(Fall08) Major

IITD paper

Uploaded by

gjluztdg3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
Name: Entry: Gp: 1 Indian Tnstitnte of Tecbnology Delhi ‘Department of Computer Science and Engineering csta02 Programming Langusges Major Exam, Apel 20, 2008 15:30-17:90 Maxdinum Marks: 100 ‘Open notes. Write your namé, entry number and group at the tap af each sheet in the blanks provided. Answer all question inthe space provided, in blue o black nk (no pencils, no red pens). Budget your Sime according to ‘ho marks. Use the last page as “overfiow space”. His a set of variable names; with z a typical variable, xy is the inductively defined sex of expressions, with 2! typical expresions. Types is the collection of types with 7 # typical type. TE X mga Types is 3 typical ‘ype assignment, + e: 7 isthe typing relation "e has type r under type assumptions I’ on the variables” and T'F e oh isthe relation that says that command ¢ is fee of type ercore under type assumptions I. Qi (Gx 2mario) Run-time Data Structures, Give short one-santence answers for etch of the following: 1. What ere stars variables in C and where are they allocated? 2 With regard to lifetime and size, wbat Kinds of date structures can safely be sllocated on stack? 3. What is the differenoo betwaen garbage and dangling references? 4. Why Is garbage collection rarely spoken about in languages such as Pascal and whereas itis very important in SML and Jave? 5. Why do we need to allocate values on heap in a higher-order functional language? Is it safe to assume thal any date structure not reachable from the stack is garbage, even if tis on the heap? 6. Why does thu exccution of an infinite chsin of recursive calls in G ar Pascal lead to a “Stack overruns heap” error message? Q® (345 marks) For loops, Consider the definite iteration “lor-loop" command for {= mupton do {c} = where isa fresh integer variable, the seope of which is only the burly of the “For loop"; c is a com- ‘mand thet car look up the value of 1 but cannot change the content of f; and myn ate integer vaues. Tr can be dearribed informally as “execute command ¢ rupeatedly for different values off, taken suc- cessively from that of mr to that of m (both inchusive}.” Name: Entcy: Gp: 2 1. Write the typing rule forthe command for £== m upto w do {c}- TF far =m upto n do Te} oF 2, Write the big:stop evalution rules for this command: Di tertamuponde ta Soe BE (or sm upto a do {cho} =e Q3 (6+242 marks] Principle of Abstraction. The Prinlple of Abstraction does not merely state that Procedures and functions must exist. Rather, it suggests that any construction or 0 given syntartic tategory (eg, commands) can be edapted to a similar causiruction for another syntactic eategnry (eg, expressions), 1, What should the corresponding “definite iteration expresion abstract” ©JL,( # ) compute, if bighesordor function F : Integer —+ 7 + 7 can be considered as sepresenting a family of func: tions f, indexed hy # (Le, 2) =f? 2. What should the expression Quga( #) return ifm

You might also like