Principles of Programming Languages (NCS-503)
Section-Wise Important Questions & Study Notes
SECTION–A
(Attempt all questions | 2 × 10 = 20)
This section checks definitions, short explanations, and basic concepts.
Write 2–3 lines only, very crisp answers.
(a) Programming Environment & Language Design
Programming environment (hardware, OS, users, tools) influences syntax, features, efficiency, and security of a language.
(b) Language Semantics
Semantics defines the meaning of program statements, i.e., what a program actually does.
(c) Access Specifiers
Public: accessible everywhere
Private: accessible only within class
Protected: accessible in class and derived classes
(d) Bootstrapping
Bootstrapping is the technique of writing a compiler for a language in the same language itself.
(e) Need of Language Translators
Translators convert high-level language into machine code so that computer can execute programs.
(f) Compiler vs Interpreter
Compiler translates whole program at once; interpreter translates line by line.
(g) Inline Function
Inline function expands function code at call point, reducing function call overhead.
(h) Properties of Constructor
Same name as class, no return type, automatically invoked, used to initialize objects.
(i) LISP Procedure to Find Cube
(defun cube (x) (* x x x))
(j) Abstract Data Type (ADT)
ADT defines data + operations without specifying implementation details.
SECTION–B
(Attempt any THREE | 10 × 3 = 30)
Write structured answers with headings and examples.
2(a) Phases of a Compiler
Explain with block diagram: Lexical Analysis
Syntax Analysis Semantic Analysis
Intermediate Code Generation Code Optimization
Code Generation Symbol Table & Error Handler
2(b) Facts & Rules in Prolog
Fact: basic statement (e.g., parent(john, ram).)
Rule: logical relation
Example:
grandparent(X,Y) :- parent(X,Z), parent(Z,Y).
2(c) Storage Representation of Data Structures
Explain: Static allocation
Stack allocation Heap allocation
Mention advantages and use cases.
2(d) Syntactic Criteria of Programming Language
Discuss: Simplicity
Readability Orthogonality
Expressiveness Uniformity
2(e) Activation Record
Explain fields: Local variables
Parameters Return address
Control link Access link
Explain activation tree and show recursive calls for factorial.
SECTION–C
(Attempt any ONE | 10 × 1 = 10)
3(a) Lambda Calculus
Explain: Lambda expression
Function abstraction Application
Free variables: not bound by lambda Bound variables: defined within lambda
OR
3(b) Inheritance Explain concept and types:
Single Multiple
Multilevel Hierarchical
Give simple examples in OOP.