Q2 (a) Give a sketch of the implementation of the printf
function in the C programming language. Just to mention, the printf
function takes variable number of arguments. (4)
(b) In many PL implementations, the hardware registers are
divided into two sets to implement the calling sequence. Why is
this done? (2)
Q3 What is the advantage of providing block structuring in
programming languages? Using an example, illustrate the static
scoping rules in block structured languages. For the example above,
explain how a compiler can implement static scoping? (6)
Q4 Give an example demonstrating the utility of having a local
array of a function, whose size is decided at run time. How is this
facility implemented by a programming language? (6)
Q5 (a) Give an example of the utility of an intern static
variable in the C programming language. How can intern static
variables be implemented? Where are they allocated space by typical
compilers? (3)
(b) Give an example of the utility of an extern static variable
in the C programming language. How is the facility of an extern
static variable implemented? (3)
Q6 Giving reasons, explain how a compiler optimizes the calling
sequence if it recognises a tail-recursive call. Can this
optimization be done by the interpreter as well?(3)
Q2 (a) Give a sketch of the implementation of the printf function in the C programming language. Just to mention, the pr
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Q2 (a) Give a sketch of the implementation of the printf function in the C programming language. Just to mention, the pr
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!