JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B. Tech III PRINCIPLES OF PROGRAMMING LANGUAGES Previous Question Paper (October - 2020 - R13)
Answer any five questions. All questions carry equal marks.
Main
Give an unambiguous grammar for if-then-else.
Answer
The dangling else problem arises in standard grammars because an else clause can be associated with multiple if statements. To resolve this, we must distinguish between matched statements (those where every if has a corresponding else) and unmatched statements. An unambiguous grammar is defined as follows:
In this grammar, an unmatched statement cannot appear before an else clause, forcing the else to bind to the closest preceding if statement.
Explain in detail about various language implementation methods.
Answer
Language implementation methods define how source code is transformed into executable machine code. The three primary methods are:
- Compilation: The source program is translated into machine code by a compiler. The resulting object code is executed directly by the hardware. This approach offers high execution speed but requires a separate compilation step before execution.
- Pure Interpretation: The source program is executed by an interpreter, which acts as a software simulation of a computer. The interpreter fetches, decodes, and executes instructions one by one. This allows for easy debugging and platform independence but is significantly slower than compiled code.
- Hybrid Implementation: This method translates high-level source code into an intermediate language (e.g., bytecode), which is then interpreted by a virtual machine. This provides a balance between the portability of interpretation and the efficiency of compilation. Examples include Java (JVM) and Python.
Compute the weakest precondition for the following sequences of assignment statements and their post conditions:
Answer
Sign in to view the complete answer paper.
Differentiate between functional and imperative languages.
Answer
Sign in to view the complete answer paper.
Discuss different data types in different programming languages.
Answer
Sign in to view the complete answer paper.
Differentiate between pointers and reference types with examples.
Answer
Sign in to view the complete answer paper.
Explain the problems associated with Unconditional Branching.
Answer
Sign in to view the complete answer paper.
Describe the process of Array initialization.
Answer
Sign in to view the complete answer paper.
Describe the problem of passing multi-dimensioned arrays as parameters. Explain with examples.
Answer
Sign in to view the complete answer paper.
In what fundamental ways do the generic parameters to a Java 5.0 generic method differ from those of C++ methods?
Answer
Sign in to view the complete answer paper.
What are the design issues for subprograms? What are the differences between a function and a procedure?
Answer
Sign in to view the complete answer paper.
What languages allow the user to overload operators? Give examples.
Answer
Sign in to view the complete answer paper.
How are instances of Ada generic classes and C++ template classes created? Explain with examples.
Answer
Sign in to view the complete answer paper.
How can exceptions explicitly raised in C++? Explain with an example.
Answer
Sign in to view the complete answer paper.
What is the difference between an ML val statement and an assignment statement in C?
Answer
Sign in to view the complete answer paper.
How exceptions are handled in Python?
Answer
Sign in to view the complete answer paper.