Sei sulla pagina 1di 8

To get more 'n' more just vist : www.examsadda.

com

Code No: R22056 R10 SET - 1

II B.Tech II Semester, Regular Examinations, April – 2012


PRINCIPLES OF PROGRAMMING LANGUAGE
(Com. to CSE, IT)
Time: 3 hours Max. Marks: 75
Answer any FIVE Questions
All Questions carry Equal Marks
~~~~~~~~~~~~~~~~~~~~~~

1. a) Give the derivation and parse tree for expressions to generate the string “slope * x +

m
intercept”

co
b) List the principal phases of compilation, and describe the work performed by each.
(7M+8M)

a.
2. a) Why does the use of dynamic scoping imply the need for run-time type checking?
b) Consider the following pseudo code.
Procedure P (A, B: real)
X: real
dd
Procedure Q (B, C: real)
sa
Y: real
...
m

Procedure R (A, C: real)


Z: real
xa

. . . –– (*)
...
Assuming static scope, what is the referencing environment at the location marked by (*)?
.e

(7M+8M)
w

3. a) Describe in detail about evaluating attributes for the expression(1 + 3)*2


b) Describe the similarities and differences between context-free grammars and tree grammars.
w

(7M+8M)
w

4. a) Why is it generally expensive to catch all uses of uninitialized variables at run time? Why is
it impossible to catch all uses of uninitialized variables at compile time?
b) Describe the jump code implementation of short-circuit Boolean evaluation. (7M+8M)

1 of 2

To get more 'n' more just vist : www.creativeworld9.com


To get more 'n' more just vist : www.examsadda.com

Code No: R22056 R10 SET - 1

5. a) Explain the difference between type conversion, type coercion, and non-converting type
casts.
b) Discuss the significance of “holes” in records. Why do they arise? What problems do they
cause? (7M+8M)

m
6. a) What is the principal purpose of generics? In what sense do generics serve a broader purpose
in C++ and Ada than they do in Java and C#?

co
b) Describe in detail about implementing synchronization. (7M+8M)

a.
7. a) Summarize visibility rules of C++. How do the rules for member name visibility in
Smalltalk and Objective-C differ from the rules of most other object-oriented languages?

dd
b) Explain in detail about Shared and Replicated Inheritance with examples. (7M+8M)

8. a) Define Functional Programming Language. List the properties of Functional Programming


sa
languages and describe each of them briefly.
b) Summarize Prolog’s facilities for database manipulation. Explain the usage of assert,
retract, and clause. (7M+8M)
m
xa
.e
w
w
w

2 of 2

To get more 'n' more just vist : www.creativeworld9.com


To get more 'n' more just vist : www.examsadda.com

Code No: R22056 R10 SET - 2

II B.Tech II Semester, Regular Examinations, April – 2012


PRINCIPLES OF PROGRAMMING LANGUAGE
(Com. to CSE, IT)
Time: 3 hours Max. Marks: 75
Answer any FIVE Questions
All Questions carry Equal Marks
~~~~~~~~~~~~~~~~~~~~~~

1. a) Describe the form in which a program is passed from the scanner to the parser; from the

m
parser to the semantic analyzer; from the semantic analyzer to the intermediate code generator.

co
b) Summarize the difference between LL and LR parsing. Which one of them is also called
“bottom-up”? “Top-down”? Which one is also called “predictive”? “Shift reduce”? What do
“LL” and “LR” stands for? (7M+8M)

a.
2. a) What do we mean by the scope of a name-to-object binding? Explain about the closest
nested scope rule. dd
b) Explain the distinction between decisions that are bound statically and those that are bound
dynamically. What is the advantage of binding things as early as possible? What is the
sa
advantage of delaying bindings? (7M+8M)
m

3. a) Why can’t action routines be placed at arbitrary locations within the right hand side of
productions in an LR CFG?
xa

b) Give the Attribute grammar to decorate an abstract syntax tree for the calculator language
with types. (7M+8M)
.e

4. a) Explain the difference between prefix, infix, and postfix notation. What is Cambridge Polish
w

notation? Name two programming languages that use postfix notation.


b) Describe three different search strategies that might be employed in the implementation of a
w

case statement, and the circumstances in which each would be desirable. (7M+8M)
w

1 of 2

To get more 'n' more just vist : www.creativeworld9.com


To get more 'n' more just vist : www.examsadda.com

Code No: R22056 R10 SET - 2

5. a) Summarize the ways in which one dereferences a pointer in various programming


languages.
b) In what ways may an enumeration type be preferable to a collection of named constants? In
what ways may a sub range type be preferable to its base type? It what ways may a string be
preferable to an array of characters? (7M+8M)

m
6. a) Describe different parameter Modes in Ada .How do they differ from the modes of most

co
other Algol-family languages?
b) Describe the algorithm used to identify an appropriate handler when an exception is raised in

a.
a language like Ada or C++. (7M+8M)

7.
dd
a) Compare Java final methods with C++ non-virtual methods. How are they the same? How
are they different?
b) What is a metaclass in Smalltalk? Explain the difference between initialization and
sa
assignment in C++ with suitable examples. (7M+8M)

8. a) Why is the order of evaluation is essential in evaluating expressions? Explain in detail about
m

Strictness and Lazy Evaluation and I/O Streams.


xa

b) Define Horn Clause with an example. What sorts of logical statements cannot be captured in
Horn clauses? Also describe the generate-and-test programming idiom. (7M+8M)
.e
w
w
w

2 of 2

To get more 'n' more just vist : www.creativeworld9.com


To get more 'n' more just vist : www.examsadda.com

Code No: R22056 R10 SET - 3

II B.Tech II Semester, Regular Examinations, April – 2012


PRINCIPLES OF PROGRAMMING LANGUAGE
(Com. to CSE, IT)
Time: 3 hours Max. Marks: 75
Answer any FIVE Questions
All Questions carry Equal Marks
~~~~~~~~~~~~~~~~~~~~~~

1. a) Explain the distinction between interpretation and compilation. What are the comparative

m
advantages and disadvantages of the two approaches?

co
b) What does it mean for a context-free grammar to be ambiguous? (7M+8M)

2. a) Explain the distinction between the lifetime of a name-to-object binding and its visibility.

a.
b) Why are binding rules particularly important for languages with dynamic scoping?(7M+8M)

3. dd
a) What does it mean for an attribute grammar to be S-attributed? L-attributed? Noncircular?
What is the significance of these grammar classes?
b) Describe in detail about the role of semantic analyzer. (7M+8M)
sa

4. a) What is a tail-recursive function? Why is tail recursion important? Write a tail-recursive


・ ・ ・×n). (Hint:
m

function in Scheme or ML to compute n factorial n! = _1≤i≤n i = 1 × 2×


You will probably want to define a “helper” function)
xa

b) Discuss in detail about problems with the Fortran IV do loop. (7M+8M)


.e

5. a) Discuss the comparative advantages of structural and name equivalence for types. Name
three languages that use each approach.
w

b) Discuss the differences between the denotational, constructive, and abstraction-based views
of types. (7M+8M)
w
w

1 of 2

To get more 'n' more just vist : www.creativeworld9.com


To get more 'n' more just vist : www.examsadda.com

Code No: R22056 R10 SET - 3

6. a) What does it mean for a generic parameter to be constrained? Explain the difference between
explicit and implicit constraints. Why will C# accept int as a generic argument, but Java won’t?
b) What is an exception? Explain how to implement exceptions in a way that incurs no cost in
the common case (when exceptions don’t arise). (7M+8M)

m
7. a) Explain the difference between dynamic and static method binding (i.e., between virtual and
non-virtual methods). (7M+8M)

co
b) Explain why in-line subroutines are particularly important in object-oriented languages.

a.
8. a) What is a higher-order function? Give three examples of higher order functions. Also
explain the concept of Currying in detail.

dd
b) What mathematical formalism underlies logic programming? Briefly describe the process of
unification and resolution in logic programming. (7M+8M)
sa
m
xa
.e
w
w
w

2 of 2

To get more 'n' more just vist : www.creativeworld9.com


To get more 'n' more just vist : www.examsadda.com

Code No: R22056 R10 SET - 4

II B.Tech II Semester, Regular Examinations, April – 2012


PRINCIPLES OF PROGRAMMING LANGUAGE
(Com. to CSE, IT)
Time: 3 hours Max. Marks: 75
Answer any FIVE Questions
All Questions carry Equal Marks
~~~~~~~~~~~~~~~~~~~~~~

m
1. a) What is the difference between a phase and a pass of compilation? Under what
circumstances does it make sense for a compiler to have multiple passes?

co
b) What is P-code and also discuss in detail about bootstrapping? (7M+8M)

2. a) Consider the following pseudo code, assuming nested subroutines and static scope.

a.
Procedure main
g: integer
Procedure B(a : integer)
x: integer
Procedure A(n : integer)
dd
g := n
sa
Procedure R(m : integer)
write integer(x)
x /:= 2 –– integer division
m

if x > 1
R(m + 1)
else
xa

A(m)
body of B
x := a × a
.e

R(1)
body of main
B(3)
w

write integer(g)
b) What does this program print?
w

Show the frames on the stack when A has just been called. For each frame, show the static and
dynamic links.
w

c) Explain how A finds g. (5M+5M+5M)

1 of 2

To get more 'n' more just vist : www.creativeworld9.com


To get more 'n' more just vist : www.examsadda.com

Code No: R22056 R10 SET - 4

3. a) What is an attribute grammar? What is the difference between synthesized and inherited
attributes?
b) What sort of information do action routines typically keep in global variables, rather than in
attributes? (7M+8M)

m
4. a) Explain about Structured Alternatives to goto in detail.
b) Describe three subtleties in the implementation of enumeration-controlled loops. Why do

co
most languages not allow the bounds or increment of an enumeration controlled loop to be
floating-point numbers? (7M+8M)

a.
5. a) What does it mean for a language to be strongly typed? Statically typed? What prevents, say,
C from being strongly typed?
dd
b) Discuss the type safety problems that arise with variant records. How can these problems be
addressed? (7M+8M)
sa
6. a) Describe in detail about the calling sequence to maintain stack layout. Explain this with a
typical stack frame.
m

b) Describe three alternative means of allocating co-routine stacks. What are their relative
strengths and weaknesses? (7M+8M)
xa

7. a) Describe how virtual functions can be used to achieve the effect of subroutine closures.
.e

b) Describe in detail about data hiding in Euclid and Ada. (7M+8M)


w

8. a) Explain in detail how Control Flow and Assignment Expressions are defined in Scheme with
examples. Also discuss briefly on the concept of Program as Lists in Scheme.
w

b) What are clauses, terms, and structures in Prolog? What are facts, rules, and queries? Give
examples of each. (7M+8M)
w

2 of 2

To get more 'n' more just vist : www.creativeworld9.com

Potrebbero piacerti anche