Beruflich Dokumente
Kultur Dokumente
Cheeryal (V), Keesara (M), Ranga Reddy District 501 301 (T.S)
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
(2015-2016)
Faculty In charge
HOD-CSE
Dr. D.S.R. Murthy
Contents
S.No
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
A
B
25
26
Topic
Cover Page
Syllabus copy
Vision of the Department
Mission of the Department
PEOs and POs
Course objectives and outcomes
Page. No.
3
4
6
6
7
9
15
10
10
11
12
16
16
19
114
118
124
126
140
140
140
141
142
Tutorial problems
Known gaps ,if any and inclusion of the same in lecture schedule
Discussion topics , if any
References, Journals, websites and E-links if any
Quality Measurement Sheets
Course End Survey
Teaching Evaluation
Student List
Group-Wise students list for discussion topic
Course coordinator
Program Coordinator
145
HOD
2
Branch:
Year:
Semester:
Programme : UG
CSE A & B
Version No : 3
III
Updated on :
1) Name :
2) Sign
2) Sign :
3) Design : Asst.Prof
3) Design :
4) Date
4) Date :
Verified by : 1) Name
2) Sign
1) Name :
3) Design :
2) Sign
4) Date
3) Design :
4) Date
3) Date :
2.JNTU Syllabus :
UNIT I :
Preliminary Concepts: Reasons for studying, concepts of programming languages, Programming
domains, Language Evaluation Criteria, influences on Language design, Language categories,
Programming Paradigms Imperative, Object Oriented, functional Programming , Logic Programming.
Programming Language Implementation Compilation and Virtual Machines, programming
environments. Syntax and Semantics: general Problem of describing Syntax and Semantics, formal
methods of describing syntax - BNF, EBNF for common programming languages features, parse trees,
ambiguous grammars, attribute grammars, denotational
UNIT II :
Data types: Introduction, primitive, character, user defined, array, associative, record, union, pointer
and reference types, design and implementation uses related to these types. Names, Variable, concept
of binding, type checking, strong typing, type compatibility, named constants, variable initialization.
Expressions and Statements: Arithmetic relational and Boolean expressions, Short circuit evaluation
mixed mode assignment, Assignment Statements, Control Structures Statement Level, Compound
Statements, Selection, Iteration, Unconditional Statements, guarded commands.
UNIT III:
Subprograms and Blocks: Fundamentals of sub-programs, Scope and lifetime of variable, static and
dynamic scope, Design issues of subprograms and operations, local referencing environments,
parameter passing methods, overloaded sub-programs, generic sub-programs, parameters that are subprogram names, design issues for functions user defined overloaded operators, co routines.
UNIT IV :
Abstract Data types: Abstractions and encapsulation, introductions to data abstraction, design issues,
language examples, C++ parameterized ADT, object oriented programming in small talk, C++, Java, C#,
Ada 95
Concurrency: Subprogram level concurrency, semaphores, monitors, massage passing, Java threads, C#
threads.
Exception handling : Exceptions, exception Propagation, Exception handler in Ada, C++ and Java.
Logic Programming Language : Introduction and overview of logic programming, basic elements of
prolog, application of logic programming.
UNIT V :
Functional Programming Languages: Introduction, fundamentals of FPL, LISP, ML, Haskell, application of
Functional Programming Languages and comparison of functional and imperative Languages.
Scripting Languages : Pragmatics , Key concepts , Case Study : Python values and types , variables ,
storage and control , Binding and scope , procedural abstraction , data abstraction ,separate compilation
, module library
5. Suggested Books :
Text Books :
1. Concepts of Programming Languages Robert .W. Sebesta 8/e, Pearson Education 2008.
2.. Programming Language Design Concepts , D.A.Watt,Wiley dreamtech,rp-2007
Reference Books :
1. Programming Languages , 2nd Edition , A.B.Tucker,R.E.Noonan,TMH
2. Programming languages K.C.Louden,2nd Edition,Thomson 2003
3. LISP Patric Henry Winston and Paul Horn Pearson Education.
4. Programming in PROLOG,W.F.Clocksin,&C.S.Mellish,5th Edition,Springer
5. Programming Python,M.Lutz,3rd Edition,Oreilly,SPD,rp-2007
6. Core Python Programming ,Chun ,II Edition,Pearson Education,2007
7. Guide to Programming with Python,Micheal Dawson,Thomson,2008
applications.
4. An ability to design, implement and evaluate computer-based systems, processes,
components or programs to meet desired needs within realistic constraints of time and
space.
5. An ability to use current techniques, skills and modern engineering tools necessary to
economic principles and apply them to manage projects as a member and leader in a
team.
11. A recognition of the need for and an ability to engage in life-long learning and
Course description
The main topics of this course include a comparative study of programming language features,
an introduction to programming language design and implementation, and an introduction to the
theory of formal languages.
Learning Outcomes
Upon successful completion of this course, the student will be able to:
7.Brief notes on the importance of the course and how it fits into the curriculum
The study of programming languages examines the principles and limitations of computing
(or programming) models, the effective design and use of systems or languages based on
these models and methods to compare their relative strengths and weaknesses in particular
contexts. Undergraduate students benefit from studying this course, regardless of their future
career paths and interests. It strengthens a students understanding of computation itself, its
power and its limitations. Moreover, the knowledge and skills acquired enable students to
critically compare and choose the most appropriate abstractions for describing particular programs, and to adopt and develop new models as they emerge.
8.Prerequisites if any
Basic knowledge about C,C++ & Java Programming languages .
10
P.Haritha
Learning Outcomes
S.No Unit
1
Contents
Preliminary
Concepts:
Outcomes
Reasons
for
Convinces the
student that this
course is indeed
important
Explain Important
features of PLs
Identify which
Programming
domains,
Language
categories,
design,
Language
Programming Paradigms.
language is suited
programming environments.
of project
. Write PL
semantics
technically.
Forms a good
foundation for the
course Compiler
Design
11
II
Distinguish
which PLs
support what
rationale behind
their inclusion
Design issues to
be considered
while designing
in potential new
PLs
Explain Which
PL supports what
control
statements
Identify the
limitations of
control
statements in
different PLs
Make judicious
choice of control
statements in a
potential new PL
III
Outline the
importance of
process abstraction.
operations,
local
environments,
parameter
methods,
overloaded
referencing
passing
sub-programs,
Comfortable with
advanced topics in
contemporary PLs
12
like overloaded
subprograms and
generic subprograms
operators, co routines.
Is ready to assimilate
the concept of data
abstraction
VI
Appreciate the
gradual evolution of
programming
languages to include
process abstraction
Subprogram
level
concurrency,
semaphores,
monitors,
massage
handling
exception
Propagation,
Ex:C,C++,Java
Write programs in
C++,Java and Ada
Exceptions,
showing abstract
Exception
data type
implementations in
these languages
Outline the
concurrency concept
of Threads in Java
Design an exception
handler in a PL
Identify alternate
form of
programming ie
logic programming
13
type of applications
logic programming
languages are
preferred over
imperative
languages
Outline alternate
form of
Programming
and
programming ie
and
functional
comparison
Languages
of
functional
imperative Languages.
Scripting Languages : Pragmatics , Key
programming
type of applications
functional languages
imperative
languages
Write small
programs in Python
HOD
PEOS
PEO1,PEO2,PEO3
POs
PO2,PO3,PO4,PO5,PO7,PO8,PO11
Course Outcome
PO3,PO7
PO1,P11
PO2,PO4
PO2,PO4,PO7
4
5
POs
PO2, PO3 ,PO5
PO3,PO5,PO7
PO5,PO8
PO3,PO11,PO7
15
Topics Covered
Unit
Unit-1 Introduction
No of
Teaching
Periods
aids
BB
BB
BB
BB
BB
BB
programming environments
BB
BB
BB
BB
EBNF
BB
Attribute Grammar
BB
BB
Operational Semantics
BB
Axiomatic semantics
BB
Denotational Semantics
BB
Tutorial/Assignment/NPTEL
LCD
BB
BB
Logic Programming.
Semantics
16
record, union
BB
BB
BB
BB
BB
BB
BB
BB
BB
Assignment Statements
BB
BB
BB
BB
Unconditional Statements
BB
Guarded commands.
BB
Tutorial/Assignment/NPTEL
LCD
BB
BB
Static scope
BB
dynamic scope
BB
BB
BB
BB
BB
Tutorial/Assignment/NPTEL
LCD
BB
BB
17
BB
BB
BB
Semaphores
BB
BB
BB
BB
BB
BB
BB
BB
BB
Tutorial/Assignment/NPTEL
LCD
BB
BB
ML, Haskell
BB
BB
BB
BB
BB
BB
Tutorial/Assignment/NPTEL
LCD
Total
73
18
I . Introductory topics :
Programming Domains :
Scientific applications
Large number of floating point computations
Fortran
Business applications
Produce reports, use decimal numbers and characters
19
COBOL
Artificial intelligence
Symbols rather than numbers manipulated
LISP
Systems programming
Need efficiency because of continuous use
C
Web Software
Eclectic collection of languages: markup (e.g., XHTML), scripting (e.g., PHP),
general-purpose (e.g., Java)
Readability: the ease with which programs can be read and understood
Writability: the ease with which a language can be used to create programs
Reliability: conformance to specifications (i.e., performs to its
specifications)
Cost: the ultimate total cost
1.Readability :
Overall simplicity
A manageable set of features and constructs
Few feature multiplicity (means of doing the same operation)
Minimal operator overloading
Orthogonality
20
Aliasing
Presence of two or more distinct referencing methods for the same
memory location
Readability and writability
A language that does not support natural ways of expressing an
algorithm will necessarily use unnatural approaches, and hence
reduced reliability
2.Writability :
Simplicity and orthogonality
Few constructs, a small number of primitives, a small set of rules for
combining them
Support for abstraction
The ability to define and use complex structures or operations in
ways that allow details to be ignored
Expressivity
A set of relatively convenient ways of specifying operations
Example: the inclusion of for statement in many modern languages
3.Reliability :
Type checking
Testing for type errors
Exception handling
Intercept run-time errors and take corrective measures
Aliasing
Presence of two or more distinct referencing methods for the same
memory location
22
Imperative
Central features are variables, assignment statements, and iteration
Examples: C, Pascal
Functional
Main means of making computations is by applying functions to
given parameters
Examples: LISP, Scheme
Logic (declarative)
Rule-based (rules are specified in no particular order)
Example: Prolog
V Implementation Methods :
1. Compilation:
- Translate high-level program to machine code
- Slow translation
- Fast execution
2. Pure interpretation:
- No translation
24
- Slow execution
- Becoming rare
3. Hybrid implementation systems:
- Small translation cost
- Medium execution speed
VI. Programming Environments :
30
Recognizers
Read a string and decide whether it follows the rules for the language
Example: syntax analysis part of a compiler (Chapter 4)
Generators
A device that generates sentences of a language (BNF)
More useful for specifying the language than for checking a string
III.BNF Fundamentals :
Non-terminals: BNF abstractions used to represent classes of syntactic
structures
Terminals: lexemes and tokens
Grammar: a collection of rules
Examples of BNF rules:
31
<ident_list> identifier
| identifier, <ident_list>
<if_stmt> if <logic_expr> then <stmt>
BNF Rules :
A rule has a left-hand side (LHS) and a right-hand side (RHS), and consists
of terminal and nonterminal symbols
Derivations :
BNF is a generative device
Use a grammar to generate sentences that belong to the language
the grammar describes
A derivation is a repeated application of rules, starting with the start
symbol and ending with a sentence (all terminal symbols)
| <expr> - <term>
| <term>
| <term> / <factor>
| <factor>
EBNF:
<expr>.expected_type = <expr>.actual_type
2. Syntax rule: <var> -> id
Semantic rule:
<var>.actual_type <- lookup (id, <var>.env)
postcondition
1.Expression
2.Assignment statement
3.loop statement
39
A binding is static if it occurs before run time and remains unchanged throughout
program execution.A binding is dynamic if it occurs during execution or can
change during execution of the program.
IV.Data types : a unique type for every category of variables in the problem
space
Design Issues for all data types:
41
1.Primitive Data Types (those not defined in terms of other data types)
Number
-Integer
-Floating point
-Decimal
Boolean
Character
Character string
42
5.Unions : is a type whose variables are allowed to store different type values
at different times during execution
6. Sets : A set is a type whose variables can store unordered collections of distinct
values from some ordinal type
43
I.
Arithmetic Expressions :
The operator precedence rules for expression evaluation define the order
5. Conditional Expressions :
Conditional Expressions
45
8. Overloaded Operators :
*Use of an operator for more than one purpose is called operator overloading
--Some are common (e.g., + for int and float)
--Some are potential trouble (e.g., * in C and C++)
*Loss of compiler error detection (omission of & in
x = &y will not be detected by compiler )
*Some loss of readability
*Can be avoided by introduction of new symbols (e.g., Pascals div for integer
division)
*C++ and Ada allow user-defined overloaded operators
Potential problems:
Users can define nonsense operations
Readability may suffer, even when the operators make sense
9 . Type Conversions :
A narrowing conversion is one that converts an object to a type that cannot
include all of the values of the original type e.g., float to int
47
10 . Coersion :
A coercion is an implicit type conversion in mixed mode expression (expr that has
operands of different types)
Disadv:They decrease the type error detection ability of the compiler
In most languages, all numeric types are coerced in expressions, using widening
conversions
In Ada, there are virtually no coercions in expressions
Causes
--Inherent limitations of arithmetic e.g., division by zero
--Limitations of computer arithmetic e.g. overflow
And underflow
--ignored by the run-time system or caught as exceptions
48
II.
Relational Expressions
--Use relational operators and operands of various types
--Evaluate to some Boolean representation
--Operator symbols used vary somewhat among languages (!=, /=, .NE., <>, #)
Boolean Expressions
--Operands are Boolean and the result is Boolean
--Example operators
FORTRAN 90
and
Ada
&&
and
or
||
or
not
not
xor
III.
C has no Boolean type--it uses int type with 0 for false and nonzero for true
An expression in which the result is determined without evaluating all of the operands
and/or operators
49
Ada: programmer can specify either (short-circuit is specified with and then
and or else)
Ex: while(Index <= ListLen) and then (..) is short circuit
IV.Assignment Statements :
1. Compound Operators :
a=a+b
is written as
a += b
3. Assignment as an Expression :
In C, C++, and Java, the assignment statement produces a result and can be used as
an operand
Ex:
4. Mixed-Mode Assignment :
variables cannot be
assigned to integers
Within expressions
Among program units
Among program statements
I . Selection Statements :
A selection statement provides the means of choosing between two or more
paths of execution
Two general categories:
Two-way selectors
Multiple-way selectors
a) Two-Way Selection Statements :
i) General form:
if control_expression
then clause
else clause
ii) Design Issues:
What is the form and type of the control expression?
How are the then and else clauses specified?
How should the meaning of nested selectors be specified?
iii) Nesting Selectors:
Java example
if (sum == 0)
if (count == 0)
result = 0;
52
else result = 1;
Java's static semantics rule states else matches with the nearest if
To force an alternative semantics, compound statements may be used:
if (sum == 0)
{
if (count == 0)
result = 0;
}
else result = 1;
The above solution is used in C, C++, and C#
Perl requires that all then and else clauses to be compound
b) Multiple-Way Selection Statements :
Allow the selection of one of any number of statements or statement groups
Design Issues:
1. What is the form and type of the control expression?
2. How are the selectable segments specified?
3. Is execution flow through the structure restricted to include just a single
selectable segment?
4.What is done about unrepresented expression values?
i) Early multiple selectors:
FORTRAN arithmetic IF (a three-way selector)
IF (arithmetic expression) N1, N2, N3
Segments require GOTOs
53
ii) Ada :
for var in [reverse] discrete_range loop
...
55
end loop
A discrete range is a sub-range of an integer or enumeration type
Scope of the loop variable is the range of the loop
Loop variable is implicitly undeclared after loop termination
b) Logically-Controlled Loops :
Repetition control is based on a Boolean
Design issues:
Pre-test or post-test?
56
Should the logically controlled loop be a special case of the counting loop
statement expression rather than a counter
i) General forms:
while (ctrl_expr)
do
loop body
loop body
while (ctrl_expr)
ii) Examples :
Pascal has separate pre-test and post-test logical loop statements (while-do and
repeat-until)
C and C++ also have both, while-do and do- while
Java is like C, except the control expression must be Boolean
Ada has a pretest version, but no post-test
FORTRAN 77 and 90 have neither
Perl has two pre-test logical loops, while and until, but no post-test logical loop
i) Examples :
C , C++, and Java: break statement
Java and C# have a labeled break statement: control transfers to the label
An alternative: continue statement; it skips the remainder of this iteration, but
does not exit the loop
58
59
60
62
64
C,C++ :Pass a pointer to the array and the sizes of the dimensions as other
parameters
65
Java, C# : Similar to Ada .Arrays are objects; they are all single-
Ad hoc binding: The environment of the call statement that passed the
subprogram
Ex : consider prog in JavaScript
Function sub1() {
Var x;
Function sub2() {
Alert(x);
};
Function sub3()
Var x;
X = 3;
Sub4(sub2);
};
Function sub4(subx) {
Var x;
X= 4;
Subx();
}
X = 1;
Sub3();
};
-- consider execution of sub2 when it is called in sub4
--for shallow binding the ref env for this is that of sub4 so x evaluates to 4.Not
appropriate for
Static scoped lang.Implmntd in some dyn scoped lang
67
68
--A subprogram that takes a generic parameter which can be used to describe
the type of the parameters of the subprogram provide parametric
polymorphism.
--Ex : template <class Type>
Type max(Type first, Type second)
{ return first > second ? first : second; }
The above template can be instantiated for any type for which operator > is
defined
int max (int first, int second)
{
70
conditions:
The representation of, and operations on, objects of the type are defined in a single
syntactic unit
--The adv is easier program organization and , modifiability as everything associated with a
data structure is together and also separate compilation
of the same
The representation of objects of the type is hidden from the program units that use
these objects.
--Adv is reliability .By hiding the data representations, user code cannot directly access
objects of the type
Design Issues for abstract data types :
--A syntactic unit to define an ADT
--Built-in operations such as Assignment,Comparison
should be included
71
An Example in C++ :
class stack {
private:
int *stackPtr, maxLen, topPtr;
public:
stack() {
// a constructor
stackPtr = new int [100];
maxLen = 99;
topPtr = -1;
};
~stack () {delete [] stackPtr;}; //destructor
void push (int num) ,-;
void pop () ,-;
int top () ,-;
int empty () ,-;
private:
private int [] *stackRef;
private int [] maxLen, topIndex;
public StackClass() { // a constructor
stackRef = new int [100];
maxLen = 99;
topPtr = -1;
};
public void push (int num) ,-;
public void pop () ,-;
public int top () ,-;
public boolean empty () ,-;
}
4. C# :
--Based on C++ and Java
--Adds two access modifiers, internal and protected internal
--All class instances are heap dynamic
--Default constructors are available for all classes
--Garbage collection is used for most heap objects, so destructors are rarely used
--Includes structs which are lightweight classes that do not support inheritance
--Common accessor methods are getter and setter
--C# provides properties as a way of implementing getters and setters without requiring
explicit method calls
C# Property Example :
public class Weather {
75
...
Weather w = new Weather();
int degreeDaysToday, oldDegreeDays;
...
w.DegreeDays = degreeDaysToday;
...
oldDegreeDays = w.DegreeDays;
II. Parameterized Abstract Data Types :
Parameterized ADTs allow designing an ADT that can store any type elements
Also known as generic classes
C++ and Ada provide support for parameterized ADTs
Java 5.0 provides a restricted form of parameterized ADTs
C# does not currently support parameterized classes
Parameterized ADTs in C++ :
Classes can be somewhat generic by writing parameterized constructor functions
III. Encapsulation Constructs :
*Large programs have two special needs:
--Some means of organization, other than simply division into subprograms
76
--Some means of partial compilation ie compilation units that are smaller than the whole
program
--A grouping of subprograms that are logically related, into a unit that can be separately
compiled is the Obvious solution.
--Such collections are called encapsulation
1.Encapulation in Ada & Fortran95:
Nested Subprograms : Organizing programs by nesting subprogram definitions inside
larger subprograms that use them
2. Encapsulation in C :
Files containing one or more subprograms can be independently compiled
The interface is placed in a header file
Included thr #include preprocessor specification
3. Encapsulation in C++ :
Similar to C
Addition of friend functions that have access to private members of the friend class
4. Ada Packages :
Ada specification packages can include any number of data and subprogram
declarations
Ada packages can be compiled separately
A packages specification and body parts can be compiled separately
5. C# Assemblies :
A collection of files that appear to be a single dynamic link library or executable
A DLL is a collection of classes and methods that are individually linked to an
executing program
77
Naming Encapsulations :
Large programs define many global names;Hence need a way to divide into logical
groupings
A naming encapsulation is used to create a new scope for names
1. C++ Namespaces :
--Can place each library in its own namespace and qualify names used outside with the
namespace
--C# also includes namespaces
--Java Packages;clients of a package can use fully qualified name or use the import
declaration
--Ada Packages are defined in hierarchies which correspond to file hierarchies;Visibility
from a program unit is gained with the with clause
IV. Fundamentals of OOP :
Abstract data types
Inheritance
Polymorphism & Dynamic binding
Terminology of obj orientation :
--ADTs are called classes
--Class instances are called objects
--A class that inherits is a derived class or a subclass
--The class from which another class inherits is a parent class or superclass
--Subprograms that define operations on objects are called methods
--Calls to methods are called messages
--The entire collection of methods of an object is called its message protocol or
message interface
78
--Messages have two parts a method name and the destination object
--A class can modify an inherited method.The new one overrides the inherited one.The
method in the parent is overridden.
--There are two kinds of variables in a class:
Class variables - one/class
Instance variables - one/object
--There are two kinds of methods in a class:
Class methods accept messages to the class
Instance methods accept messages to objects
Lang Ex:
Out of the many object-oriented programming languages
--Some support procedural and data-oriented programming e.g., Ada and C++
--Some support functional program e.g., CLOS
--Newer languages do not support other paradigms but use their imperative structures
e.g., Java and C#
--Some are pure OOP language e.g., Smalltalk
V. Design Issues for OOP Languages :
1. The Exclusivity of Objects : Everything is an object , Add objects to a complete
typing system
2. Subclasses as Types : A derived class is a subtype if it has an is-a
relationship
81
--A member that is not accessible in a subclass can be declared to be visible there
using the scope resolution operator (::), e.g.,
class subclass_3 : private base_class {
base_class :: c;
c) Dynamic Binding :
--A method can be defined to be virtual, which means that they can be
dynamically bound to messages
--A pure virtual function has no definition at all
--A class that has at least one pure virtual function is an abstract class
d) Evaluation :
--C++ provides extensive access controls (unlike Smalltalk)
--C++ provides multiple inheritance
--In C++, the programmer can decide at design time which methods will be
statically bound and which dynamically bound
--Smalltalk type checking is dynamic
--Because of interpretation and dynamic binding, Smalltalk is ~10 times slower
than C++
III. Support for OOP in Java :
a) Gen Characteristics:
--All data are objects except the primitive types
--Primitive types can have wrapper classes that store one data value
--All objects are heap dynamic, referenced through reference variables, and most
are allocated with new
82
--A finalize method is implicitly called when the garbage collector is about to
reclaim the storage occupied by the object
b) Inheritance :
--Single inheritance only is supported ,but there is an abstract class category /
interface that provides some of the benefits of multiple inheritance
--An interface can include only method declarations and named constants, e.g.,
public interface
83
--The parent class version can still be called explicitly with the prefix base: Eg :
base.Draw()
c) Dynamic binding :
--All C# classes are ultimately derived from a single root class, Object
--To allow dynamic binding of method calls to methods:
The base class method is marked virtual
The corresponding methods in derived classes are marked override
Abstract methods are marked abstract and must be implemented in all
subclasses
d) Evaluation :
--C# is the most recently designed C-based OO language
--The differences between C#s and Javas support for OOP are relatively minor
V. Ada 95 :
a) General Characteristics :
--OOP was one of the most imp extensions to Ada 83
--Encapsulation container is a package that defines a tagged type which can be
record or private type.
--A tagged type includes a sys maintained tag to indicate its type during execution
--No constructors or destructors are implicitly called
b) Inheritance :
--Subclasses can be derived from tagged types
--New entities are added to the inherited entities by placing them in a record
definition
--All subclasses are subtypes
84
--No support for multiple inheritance.A comparable effect can be achieved using
generic classes
c) Dynamic Binding :
--Provides both static & dyn binding of procedure calls to procedure definitions in
tagged types
d) Evaluation :
--Ada offers complete support for OOP
--C++ offers better form of inheritance than Ada
--Ada includes no initialization of objects thr constructors
--Dynamic binding in C-based OOP languages is restricted to pointers and/or
references to objects; Ada has no such restriction and is thus more orthogonal
I. Concurrency can occur at four levels:
Machine instruction level
High-level language statement level
Unit level /Subprogram level
Program level
--Because there are no language issues in instrctn & program level concrncy, they
are not addressed here
II. Concurrency can be :
--Physical concurrency implemented thr multiple independent processors (
multiple threads of control)
--Logical concurrency which presents the effect of physical concurrency
implemented thr time-sharing one processor ( PL can be designed as if there were
multiple threads of control)
III. H/W support for cncrcy thr Multiprsr archs :
85
--Late 1950s : one gen purpose procr and one or more special purpose procrs for
input & output operations.
--Early 1960s : multiple complete processors, used for program level concurrency
--Mid 1960s : multiple partial processors, used for instruction level
concurrency.Eg : some m/cs have two or more floating pt arithmetic units. PL
compilers
determine which instrctns can be executed concrntly & schedule these
instructions accordingly.
--Single Instruction Multiple Data (SIMD) m/cs
multiple procrs execute same instr on diff data sets
--Multiple Instruction Multiple Data (MIMD) m/cs
Multiple procrs execute diff instructions.
IV. Language support for cncrcy :
-- Thr Semaphores, monitors & message passing
--Implemented in PL/I , Ada95 , Java , C#
V. Why Study Concurrency :
--Provides a diff way of conceptualising s/w that can be very useful & simulate the
real world better as many real-world situations involve cncrcy.Ex:various m/cs
working simultaniously in a factory
--Since multiprocessor computers capable of physical concurrency are now widely
available why not make use of them by implementing concurrency.
VI. Basic Terminology :
a) Task or process is a program unit that can be in concurrent execution with
other program units
--Tasks differ from ordinary subprograms in that:
86
88
deposit(VALUE);
release(fullspots);
{increase filled}
end loop;
end producer;
task consumer;
loop
wait (fullspots);
fetch(VALUE);
release(emptyspots);
{increase empty}
end loop;
end consumer;
b) Comp Sync with semaphores :
--A third semaphore access is used to control access
--The counter of access will only have values 0 & 1
hence called a binary semaphore--Ex :
semaphore access, fullspots, emptyspots;
access.count = 0;fullstops.count = 0;
89
emptyspots.count = BUFLEN;
task producer;
loop
wait(emptyspots);
wait(access);
deposit(VALUE);
release(access);
{relinquish access}
release(fullspots);
{increase filled}
end loop;
end producer;
task consumer;
loop
wait(fullspots);
wait(access);
fetch(VALUE);
release(access);
release(emptyspots);
{relinquish access}
{increase empty}
end loop;
end consumer;
c) Evaluation of Semaphores :
--Misuse of smphs can cause failures in coop sync, e.g., buffer will overflow if the
wait of fullspots is left out
--Misuse of smphs can cause failures in comp sync, e.g., the prog will deadlock if the
release of access is left out
VIII. Monitors :
90
a) A monitor is an ADT for shared data where shared data and its operations are
encapsulated (rather than being in the client units) to restrict access
--All access is resident in the monitor
*Monitor implmntn guarantee synchronized access by allowing only one access at
a time
*Calls to monitor procedures are implicitly queued if the monitor is busy at the
time of the call
-- Concurrent Pascal, Modula, Mesa, Ada, Java, C#
b) Evaluation of Monitors :
--A better way to provide comp sync than are smphs
--Smphrs can be used to implmnt mntrs & vice versa
--Support for coop sync is very similar as with smphs, so it has the same problems
IX. Message Passing : Ada
a) Central idea: task communication is like seeing a doctor most of the time she waits
for you or you wait for her, but when you are both ready, you get together, or
rendezvous/sync message passing.
-- rendezvous is a mechanism to allow a task to indicate when it is willing to accept
messages
--When a sender tasks message is accepted by a rceiver task, the actual message
trnsmsn is called a rendezvous
--This is the Ada 83 Message-Passing Model
91
--Ada 95 includes Ada 83 features for conc, plus two new features protected objts
& Asynchronous cmnctn
b) Evaluation of the Ada message passing :
--Message passing model of conc is powerful and general.Both mon & semphs can
be implemented with message passing.
-- In the absence of distributed processors, the choice between monitors and
tasks with message passing is only a matter of taste
--For distributed systems, message passing is a better model for concurren
92
I. Exception Handling:
--An exception is any unusual event, either erroneous or not, detectable by either
hardware or software, that may require special processing
--The special processing that may be required after detection of an exception is
called exception handling
--The exception handling code unit is called an exception handler
--In a lang without exception handling when an exception occurs, control goes to
the OS, where a message is displayed and the program is terminated
--In a lang with exception handling programs are allowed to trap some exceptions,
thereby providing the possibility of fixing the problem and continuing
93
exception_name | others
--Excp handlers are placed at the end of the block or unit in which they occur
3. Binding Exceptions to Handlers :
--If the block or unit in which an excp is raised does not have a handler for that
excp, the excp is propagated elsewhere to be handled
--Procedures : propagate it to the caller
94
V. Basic terminology :
95
96
Logical Operators
Name
Symbol
Example
Meaning
negation
not a
conjunction
ab
a and b
Name
Example
Meaning
a or b
universal
X.P
existential
X.P
disjunction
ab
equivalence
ab
a is equivalent
to b
implication
ab
ab
a implies b
b implies a
Quantifiers
1-10
1-11
VI. Prolog :
-- University of Aix-Marseille Natural language processing
-- University of Edinburgh Automated theorem proving Terminology - Edinburgh
Syntax
a) Term: a constant, variable, or structure
i) Constant: an atom or an integer
Atom: symbolic value of Prolog which can be either a string of letters,
digits, and underscores beginning with a lowercase letter OR a string of
printable ASCII characters delimited by apostrophes
Variable: any string of letters, digits, and underscores beginning with an
uppercase letter .Instantiation is the binding of a var to a value & lasts
only as long as it takes to satisfy one complete goal
Structure: represents atomic proposition ie functor(parameter list)
b) Fact Statements :
i) Correspond to Headless Horn clauses ex: female(shelley).
ii) Rule Statements :
97
Corr to Headed Horn clause where right side is antecedent ie if part (may be
single term or conjunction ie multiple terms separated by logical AND op) & left
side is consequent ie then part (must be single term)
Ex : ancestor(mary,shelley) :- mother(mary,shelley).
sibling(X,Y):- mother(M,X), mother(M,Y),father(F,X),
father(F,Y).
iii) Goal Statements :
A proposition that we want system to prove or disprove
Same format as headless Horn ex: man(fred)
iv) Inferencing Process of Prolog / resolution:
To prove a goal is true, must find a chain of inference rules and/or facts. For goal
Q: B :- A ; C :- B ; ; Q :- P
v) Prolog supports int vars & int arithmetic using is op which takes an arithmetic
expression as right operand and variable as left operand ex :
A is B / 17 + C
(empty list)
98
I. Introduction :
1.The design of the functional langs is based on mathematical functions that is closer
to the user, but relatively unconcerned with the architecture of the m/cs on which
programs will run
2. A mathematical function is a mapping of members of one set, called the domain
set, to another set, called the range set
--A lambda expression specifies the parameter(s) and the mapping of a function in
the following form
--Lambda expressions describe nameless functions,prmeter(s) are placed after the
expression
e.g., ((x) x * x * x)(2) which evaluates to 8
e.g.,
(+ 5 2) yields 7
--QUOTE - takes one parameter; returns the parameter without evaluation .Reqd
because the Scheme interpreter, EVAL, always evaluates parameters to fn
applications before applying the fn.QUOTE avoids para evltn when not ncssry
--DEFINE binds a symbol to an expression
(DEFINE pi 3.141593)
2. COMMON LISP :
--A combination of many of the features of the popular dialects of LISP around in the
early 1980s
--A large and complex language--the opposite of Scheme
--Features include: records ,arrays ,complex numbers,
character strings,powerful I/O capabilities,packages with access control,iterative
control statements
100
3. ML :
--A static-scoped functional language with syntax that is closer to Pascal than to LISP
--It is strongly typed (whereas Scheme is essentially typeless) and has no type
coercions
--Uses type declarations, but also does type inferencing to determine the types of
undeclared variables
--Includes exception handling and a module facility for implementing abstract data
types
--Includes lists and list operations
--ML specifics
The val statement binds a name to a value (similar to DEFINE in Scheme)
Function declaration form:fun name (parameters) = body;
e.g., fun cube (x : int) = x * x * x;
4. HASKELL :
--Similar to ML (syntax, static scoped, strongly typed, type inferencing)
--Diff from ML (and most other FL) in that it is purely fnctinl (e.g., no var, no
assgnmnt stmnts, no side effects of any kind)
--Uses lazy evaluation (evaluate no subexpression until the value is needed)
--Has list comprehensions, which allow it to deal with infinite lists using set notation
ex: [n * n | n *1..20++
V. Applications of Functional Languages :
--APL is used for throw-away programs
--LISP is used for AI,Knowledge rprsntn,m/c learning,Natural language
processing,Modeling of speech and vision
101
The ability to generate, load, and interpret source code at run time
through an eval function. (Perl, Python, Tcl, javascript, shell scripts,
REXX, APL; missing in VB [But present in VBScript])
103
Plays well with others. Can be easily integrated with larger systems.
Scripting languages are often used to "glue" more-rigid systems
together. True of REXX; probably not true of APL.
o
Rich I/O capabilities, including pipes, network sockets, file I/O, and
filesystem operations.
Language interpreter
VII . Python :
"hello"+"world"
"helloworld"
"hello"*3
"hellohellohello" # repetition
"hello"[0]
"h"
# indexing
"hello"[-1]
"o"
# (from end)
"hello"[1:4]
"ell"
# slicing
len("hello")
# size
# comparison
"e" in "hello"
# concatenation
# search
B) . Container Types :
Lists : Flexible arrays, not Lisp-like linked lists
a = [99, "bottles of beer", ["on", "the", "wall"]]
Same operators as for strings
a+b, a*3, a[0], a[-1], a[1:], len(a)
105
# parentheses optional
x, y, z = point # unpack
lastname = key[0]
singleton = (1,)
# trailing comma!!!
empty = ()
# parentheses!
3. Control structures :
if condition:
statements
[elif condition:
statements] ...
else:
statements
while condition:
statements
for var in sequence:
statements
break
continue
# from procedure
return expression
# from function
Ex Function :
def gcd(a, b):
"greatest common divisor"
while a != 0:
a, b = b%a, a # parallel assignment
return b
>>> gcd.__doc__
'greatest common divisor'
>>> gcd(12, 20)
4
5. Classes :
class name:
"documentation"
statements
-orclass name(base1, base2, ...):
...
Most, statements are method definitions:
def name(self, arg1, arg2, ...):
...
May also be class variable assignments
108
Example Class :
class Stack:
def __init__(self):
# constructor
self.items = []
def push(self, x):
self.items.append(x)
def pop(self):
x = self.items[-1]
del self.items[-1]
return x
def empty(self):
return len(self.items) == 0 # Boolean result
# no 'new' operator!
# -> 1
x.push(1)
x.empty()
# [1]
# -> 0
x.push("hello")
x.pop()
# [1, "hello"]
# -> "hello"
# [1]
# -> [1]
Subclassing :
109
class FancyStack(Stack):
"stack with added ability to inspect inferior stack items"
def peek(self, n):
"peek(0) returns top; peek(-1) returns item below that; etc."
size = len(self.items)
assert 0 <= n < size
# test precondition
return self.items[size-1-n]
6. Module library :
Collection of stuff in foo.py file
functions, classes, variables
Importing modules:
import re; print re.match("[a-z]+", s)
from re import match; print match("[a-z]+", s)
Import with rename:
import re as regex
from re import match as m
Before Python 2.0:
import re; regex = re; del re
Packages : Collection of modules in directory
Must have __init__.py file
May contain subpackages
Import syntax:
from P.Q.M import foo; print foo()
from P.Q import M; print M.foo()
110
# new
7.Catching exceptions :
def foo(x):
return 1/x
def bar(x):
try:
print foo(x)
except ZeroDivisionError, message:
print "Cant divide by zero:", message
bar(0)
f = open(file)
try:
process_file(f)
finally:
f.close()
print "OK"
# always executed
# executed on success only
Raising exceptions :
raise IndexError
raise IndexError("k out of range")
raise IndexError, "k out of range"
try:
something
except:
catch
everything
111
print
raise
"Oops"
# reraise
8.Standard Library :
Core:
os, sys, string, getopt, StringIO, struct, pickle, ...
Regular expressions:
re module; Perl-5 style patterns and matching rules
Internet:
socket, rfc822, httplib, htmllib, ftplib, smtplib, ...
Miscellaneous:
pdb (debugger), profile+pstats
Tkinter (Tcl/Tk interface), audio, *dbm, ...
112
Topic to be covered
Additional Topics
UNIT I
Introduction
Reasons for studying, concepts of
programming languages,
Programming domains
Language Evaluation Criteria
Influences on Language design
Language categories, Programming Paradigms
Imperative, Object Oriented, functional
Programming , Logic Programming.
Programming
Language Implementation Compilation and
Virtual Machines, programming
environments.
Evaluation of major
programming languages
Syntax and Semantics: general Problem of
describing Syntax and Semantics
Formal methods of describing syntax BNF
parse trees, ambiguous grammars
EBNF for common programming languages
features
Attribute grammars
Axiomatic semantics for common
programming language features
113
initialization.
Arithmetic relational and Boolean
expressions, Unconditional Statements
Short circuit evaluation mixed mode
assignment
Assignment Statements
Control Structures Statement Level,
Compound Statements
Selection
Iteration
Unconditional Statements
Guarded commands.
Test
Unit-III
Fundamentals of sub-programs
114
History of Ada
115
Programming
Languages
116
3.a) What are all of the differences between the enumeration types of C++ and those of java?
b) What is the purpose of the ACTION, GOTO table of an LR parser? Explain with example? [7+8]
4.a) How does C support relational and Boolean expressions?
b) What mixed-mode assignments are allowed in C and Java? Explain.
c) Explain with an example the for statement of the C-based languages. [15]
5.a) Distinguish between pass-by-value and pass-by reference with suitable examples.
b) What are the characteristics of co-routine feature? List the languages which allow co-routines.
[7+8]
6.a) What is the primary problem with using semaphores to provide synchronization?
b) Explain how information hiding in provided in an ADA package. [7+8]
7.a) Write detailed compassion of the Exception Handling capabilities of C++ and those of JAVA?
b) What is the difference between checked and unchecked exception in java?
c) How is user defined exception defined in ADA? [7+8]
8.a) Give comparison of Functional and Imperative Languages.
b) What are the three features of Haskell that makes very different from schema?
c) Compare structure programming and functional programming. [15]
Code No: 09A50501
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD
B. Tech III Year I Semester Examinations, May/June 2013
(Computer Science and Engineering)
Time: 3 hours Max. Marks: 75
Answer any five questions
--All questions carry equal marks
Principles of Programming Languages
118
119
120
121
17.Question Bank:
UNIT I
Why is it important to study principles of programming languages?
What are the different categories into which we can divide the various
programming languages.
Differentiate between procedural and object oriented programming languages.
UNIT II
What are the design issues for names?
What is an alias, l-value of a variable & r-value?
Define binding, binding time, static binding and dynamic binding.
Define static, stack dynamic, explicit heap dynamic and implicit heap
dynamic variables.
What are the advantages and disadvantages of these? .
Define coercion,
What is coercion?
Explain what are Assignment statements?
What are over loaded operators?
What are the design issues for selection structures?
UNIT III
124
What is a subprogram ?
Explain about parameters w.r.t subprograms ?
What are the Design Issues for Subprograms ?
What are the various Parameter Passing Methods?
How are Parameter Passing methods Implemented in various languages ?
What are the design Considerations for Parameter Passing
Explain what is Referencing Environment w.r.t nested subprograms ?
What are the Design Issues for Functions :
Explain about Coroutines
Explain how subprogram is overloaded. Give example?
Explain how subprogram names are passed as parameters. Illustrate with
examples?
What is 'PARAMETRIC PLOYMORPHISM'?
Differentiate between Static scope and Dynamic scope?
Explain about scope and lifetime of a variable?
Explain in detail generic subprograms?
UNIT IV
What is a semaphore? Write the algorithms for cooperation and competition
synchronization using semaphores
Explain about the Concept of Abstraction.
What are the design Issues for abstract data types ?
What are Encapsulation Constructs?
What are the Design Issues for OOP Languages?
Explain how the following languages support object orientation
a) Smalltalk
125
b) C++
c) Ada
d) c#
Explain Java threads in detail?
Explain semaphores with examples ?
Explain about Monitors
Explain Message Passing in Ada
Explain in detail c# threads.
Explain c++ parameterized abstract data types.
Explain sub program level concurrency
Give an example in C++ of an exception that is propagated out of its scope.
Write a prolog program to calculate factorial of a number?
Write the following statement in first order predicate calculus.
If it is raining or snowing, then there is precipitation.
Explain Exception propagation in detail.
Write about Java exception handling?
What are the applications of Logic programming languages?
What are basic elements of prolog?Explain.
Explain how backtracking works in Prolog
Explain Exception handling in Java
Explain Exception Propagation in Ada.
UNIT V
Explain the basic primitives of LISP. Give suitable examples
126
Explain the operations that can be performed on atoms & lists in LISP
Discuss basic elements of LISP. Give ex
Write a lisp fn which computes nth Fibonacci number
Explain ML inferencing process
Explain about the datatypes and their values in python.
What is the importance of module library in python.
What is the difference between a tuple and a list ?
Explain the main features of Imperative Languages.
Write a detail note on functions in ML.
Give comparison of Functional and Imperative Languages.
What are the applications of Functional Languages?
Explain how Haskell differs from ML.
Explain Data abstraction in Python?
18.Assignment Questions
ASSIGNMENT QUESTIONS
UNIT-1
127
UNIT-2
1. What are the design issues for names?
2.Explain about strong typing.
3.What is Dynamic binding?
4.What is an associative array ?
5. What is coercion?
6. Explain what are Assignment statements?
7.What are the design issues for selection structures?
8.Explain Guarded Commands
Unit 3
128
Unit 4
1.What is semaphore? Explain with bounded buffer example
2.What is a monitor? Explain with example
3.What are the basic concepts of declarative semantics? Explain.
4.What are the different forms of a prolog term? Explain.
Unit 5
1. Write a HASKEL function that computes the volume of a cylinder given
radius.
2. Describe semantics of
a) COND &
b) LET
3. Explain the scoping rules used in scheme, common lisp, ML and HASKEL.
4. Mention the 3 ways in which ML is different from Scheme.
5. What are the applications of functional programming languages.
129
UNIT-1
1. The following is the widely used programming language developed for Artificial
Intelligence Application
1. LISP 2. FORTRAN 3. COBOL 4.ALGOL 60
2. The following language require Interpreter
1. C++ 2. C 3. COBOL 4. APL
3. C was developed by_____________.
4. The first language to provide even limited supported for data abstraction is
_________.
5. Fortran was the first language for scientific applications. [True/False]
6. C++ is object Oriented language. [True/False]
7 . The first high level programming language to include pointer variables was [ ]
1. Fortran 2. Ada 3. Algol-60 4. PL/1
8. In C and C++ the asterisk (*) denotes the following operation. [ ]
1. Dereferencing 2. negation 3. referencing 4. address
9. In FORTRAN90, Loop parameters are evaluated [ ]
1. Thrice 2. only once 3. twice 4. every time
10. The until keyword is used in for loop of ALGOL 60. [True/False]
11. In ADA, blocks are specified with declare clauses. [True/False]
12. ML is a Meta language for program verification system named LCF.
[True/False]
130
27. The first high level programming language to include pointer variables was
Fortran. [True/False]
28. The following is a name and an associated value such that value may never be
allowed to change by the program during execution [ ]
1. Variable 2. constant 3. keyword 4. Global variable
29. BNF is _______________________
30. In a parse tree, Leaf node represents ___________.
1.terminals 2. Non-terminals 3.parent nodes 4. Child nodes
31. If all the attributes values in a parse tree have been computed the tree is said to
be________.
1.half attributed tree
2.fully attributed tree
3.parse tree
4.game tree
32. Dynamic typing is used in LISP. [True/False]
33. The associativity of all operators in Pascal is of any order. [True/False]
34. The following is correct about semantics [ ]
1. Meaning of the expression, statement and programs units
2. Conditions for writing expressions, statements and programs units
3. Rules for writing expressions, statements and programs units
4. Protocol to be followed by statements
UNIT-II
133
7. Having two or more distinct referencing methods or names for the same memory
cell is called _____________.
8. The ________ variables are bound to memory cells before execution begins and
remains bound to the same memory cell through out execution.
9. The ability of a program to intercept run-time errors, take corrective measures
and then continue execution is called________
10. _____________ language can select only one single statement under IF [ ]
1. C++ 2. FORTRAN 3. C 4. PASCAL
11. FORTRAN uses the following statement to select more than one statement
under IF with negative condition [ ]
1. IF 2. FOR 3. while 4. GOTO
12. Dynamic typing used in the following language [ ]
1. APL 2. LISP 3. SNOBO L4 4. Pascal
13. The following is a logical statement that is assumed to be true. [ ]
1. Axiom 2. Post Condition Statement
3. Reference statement 4. Precondition statement.
14. The following of the variable is the time between creation and termination [ ]
1. Context 2. scope 3. range 4. lifetime
15. The _____________types are supported directly in the hardware of the
machine and not defined in terms of other types.
16. In C switch case statement the default expression type can be_________.
17. _____________language support independent compilation.
18. ____________ has a pretest version, but no post test logically controlled
iteration
19. The type of the following operator ?: is [ ]
1. unary 2. not an operator 3. ternary 4. binary
20. The following type stores values as sequences of characters [ ]
134
UNIT-III
136
4.A formal parameter is a dummy variable listed in the subprogram header and
used in the subprog
5.An actual parameter represents a value or address used in the subprogram call
statement
6. In C++, default parameters must appear last
7.Fortran Always used the
semantics model
c) 27, 7
d) None of the above
14. The- results returned by functions under value-result and reference
parameter passing conventions [ ]
a) Do not differ
b) Differ in the presence of loops
c) Differ in all cases
d) May differ in the presence of exceptions
15. The caller is _______________during execution of the called subprogram []
(A) suspended (B) terminated (C) blocked (D) none
16. A Subprogram declaration provides the _________________, but not body,of
the subprogram. [ ]
(A) definition (B) code (C) protocol (D) none
17.If local variables are stack-dynamic, advantage is _________________
[]
(A) deallocation
(B) allocation
(C) indirect address
(D) they support
recursion
18. The period of time between an allocation and its subsequent disposal is called
(A) Life time (B) scope (C) binding (D) all
19. In java, object parameters are passed using
[]
(A) call-by-name (B) call-by-value (C) call-by-reference
(D) call-by-result
20) Which modifier used in C# method to specify a formal parameter [ ]
A) New B) Def C) Params D) A&B
21) Variables defined inside the subprogram is called [ ]
A) Global variables B) Local Variables C) Parameter D)None
UNIT-IV
1. Nearly all programming languages support process abstraction with subprograms
2. Ada :The encapsulation construct is called packages
3. In C++ The class is the encapsulation device
4. C# does not currently support parameterized classes
5. A class that inherits is a derived class or a subclass
138
6. The class from which another class inherits is a parent class or superclass
7. Subprograms that define operations on objects are called methods
8. Calls to methods are called messages
9. The entire collection of methods of an object is called its message protocol
10.Ex of a pure OOP language Smalltalk
11.SIMD stands for Single Instruction Multiple Data m/cs
12. MIMD stands for Multiple Instruction Multiple Data m/cs
13.Task or process is a program unit that can be in concurrent execution with
other program units
14.Heavyweight tasks execute in their own address space and have their own
run-time stacks
15. Lightweight tasks all run in the same address space and use the same runtime stack
16. Synchronisation is a mechanism that controls the order in which tasks
execute.
17.Cooperation Sync: Task A must wait for task B to complete some specific
activity before task A can continue its execution
18. Competition Sync: Two or more tasks must use some resource that cannot
be simultaneously used
19.Task execution control is maintained by a program called the scheduler
20.If all tasks in a concurrent environment lose their liveness, it is called
A)deadlock B)semaphore C)concurrency D)none
21. A ------ is a data structure consisting of a counter and a queue for storing
task descriptors which stores all relevant info about the exec state of a task.
A)semaphore B)message passing C)monitor D)A&B
22.Semaphores have only two operations
139
]
(A) stop () (B) yield () (C) suspend () (D) start ()
26. Array Index Outof BoundsException is defined in _____________package []
(A) java.applet (B) java.awt (C) java.util (D) java.lang
27. An instance of abstract data type is called
[]
A) Variable B) Object C) Value D) Constructor
28 The encapsulating constructs in Ada are called [ ]
A) Exceptions B) Interfaces C) Definitions D) Packages
29. Concurrency can occur at _______________level
[ ]
(A) kernel (B) program (C) unit (D) data
30.When a sender tasks message is accepted by a rceiver task, the actual message
transmission is called a rendezvous
31.An
specification of results are stated & not detailed procedures for producing them.
A) Logic B) functional C) Imperative D) None
35. The particular form of symbolic logic used for logic programming is called
A) predicate calculus B) functions C) algorithms D) A&B
140
some code will be executed how the execution of a try compound terminates.
A) finally B) throws C) try D) catch
44. The categories of exceptions in Java are
a) checked b) unchecked c)constant d)a&b
45. Empty left side propositions are called as
a) headed horn clauses
b) horn clauses
c) hypotheses
d) goal
46.Re-consideration of path is
a) backtracking
b) BFS
141
c) farward chaining
d) backward chaining
49. Logic programming languages are used in
a) RDBMS
b) expert systems
c) natural language processing
d) all
UNIT-5
1. A static-scoped functional language with syntax that is closer to Pascal than to LISP
A) ML B) HASKELL C) C D) FORTRAN
2. ML is strongly typed (whereas Scheme is essentially typeless) and has no type
coercions
3.
142
143
e books :
1. Concepts of Programming Languages Robert .W. Sebesta 7/e, Pearson
Education.
2.Programming Languages Louden, Second Edition, Thomson.
Subject Experts :
1. Prof. K.Gopinath , Professor Computer Science & Automation (CSA),
Indian Institute of Science (IISc), Bangalore 560012 INDIA
144
12R11A0507
B MADHU SUDHAN
12R11A0509
13R11A0501
A BHARATH KUMAR
13R11A0502
AKUNOOR SAKETH
13R11A0503
13R11A0504
13R11A0505
13R11A0506
13R11A0507
BANDARU KRUTHI
10
13R11A0509
BODA ABHISHEK
11
13R11A0510
B VINOD
12
13R11A0511
13
13R11A0512
BOMMAGANI NARESH
14
13R11A0513
C SRAVAN KUMAR
15
13R11A0514
CHAVALA VISHAL
16
13R11A0515
17
13R11A0516
DUDIMADOGULA JHANSI
18
13R11A0517
19
13R11A0518
20
13R11A0519
G YAMINI
21
13R11A0520
GANGAVARAPU SARIKA
22
13R11A0521
23
13R11A0522
GUDI NIKHITHA
24
13R11A0523
GUNDABATTULA SHRAVANI
25
13R11A0524
HARSHITHA KRISHNA T
26
13R11A0525
27
13R11A0526
28
13R11A0527
KARLA MAHESH
29
13R11A0528
30
13R11A0529
KAUSHIK KHANDELWAL
31
13R11A0530
32
13R11A0531
33
13R11A0532
34
13R11A0533
KUCHALLAPATI RENUKA
35
13R11A0535
NASEEM FATHIMA
36
13R11A0536
37
13R11A0537
PINNINTI SHIVANI
38
13R11A0538
39
13R11A0539
PUVVULA ROHINI
40
13R11A0540
RAHUL T
41
13R11A0541
RAJENDRAN ONISHA
42
13R11A0542
RICHARD BENHUR K
43
13R11A0543
44
13R11A0544
S JAYANTH
45
13R11A0545
46
13R11A0546
SANJEEVU TEJASWANI
146
47
13R11A0547
TADIPARTHI CHRISTINA
48
13R11A0548
TALAKOKKULA VISHAL
49
13R11A0549
TANNIRU MOUNIKA
50
13R11A0550
51
13R11A0551
V TULAJA SRAVANTHI
52
13R11A0552
53
13R11A0553
P S MANASA
54
13R11A0554
13R11A0555
ADLA JAYASHREE
13R11A0556
ALETI ROOPAREDDY
13R11A0557
B ADITYA REDDY
13R11A0558
13R11A0559
B KARTHIK RAO
13R11A0560
13R11A0561
13R11A0562
13R11A0563
BANDARU PRADEEP
10
13R11A0564
BHASKAR DIVYA
11
13R11A0565
B TEJASREE
12
13R11A0566
13
13R11A0567
14
13R11A0568
15
13R11A0569
16
13R11A0570
CHILASAGAR JYOTHI
17
13R11A0571
CHILUKOJI JAYANTHI
18
13R11A0572
19
13R11A0573
20
13R11A0574
21
13R11A0575
GUBBA SRILAKSHMI
22
13R11A0576
23
13R11A0577
GINKA KIRAN
24
13R11A0578
25
13R11A0579
J SUSMITHA
26
13R11A0580
27
13R11A0581
KANDUKURI SURYATEJA
28
13R11A0582
KOLLIPARA NISCHAL
29
13R11A0583
L PRUTHIVI KUMAR
30
13R11A0584
31
13R11A0585
LAKSHMI PRASANNA B
32
13R11A0586
MOKHAMATAM SWETHA
33
13R11A0587
34
13R11A0588
M S BHUVAN
35
13R11A0589
36
13R11A0590
MARABOINA KEERTHANA
37
13R11A0591
MAVARAM BHARGAVA
38
13R11A0592
39
13R11A0593
NAGAPURI DIVYA
40
13R11A0594
41
13R11A0595
42
13R11A0596
POTHANA HARIKA
43
13R11A0597
PUNNA SPOORTHY
148
44
13R11A0598
RAMESH B K
45
13R11A0599
S SAIKIRAN
46
13R11A05A0
47
13R11A05A1
48
13R11A05A2
49
13R11A05A3
SHARATH KUMAR P
50
13R11A05A4
51
13R11A05A5
T MADHURI CHARY
52
13R11A05A6
53
13R11A05A7
54
13R11A05A8
V LAKSHMI
55
13R11A05A9
VADLAMANI ADITYA
56
13R11A05B0
VEERAMALLI SAITEJA
57
13R11A05B1
58
13R11A05B2
59
13R11A05B3
YALLAMBHOTLA ACHYUTH
60
13R11A05B4
II CSE A
12R11A0507
B MADHU SUDHAN
12R11A0509
13R11A0501
A BHARATH KUMAR
13R11A0502
AKUNOOR SAKETH
13R11A0503
149
13R11A0504
13R11A0505
13R11A0506
13R11A0507
BANDARU KRUTHI
B SOUJANYA
13R11A0508
13R11A0509
BODA ABHISHEK
13R11A0511
13R11A0512
BOMMAGANI NARESH
13R11A0513
C SRAVAN KUMAR
13R11A0514
CHAVALA VISHAL
13R11A0515
13R11A0516
DUDIMADOGULA JHANSI
13R11A0517
13R11A0518
13R11A0519
G YAMINI
13R11A0520
GANGAVARAPU SARIKA
13R11A0521
13R11A0522
GUDI NIKHITHA
13R11A0523
GUNDABATTULA SHRAVANI
13R11A0524
HARSHITHA KRISHNA T
13R11A0525
13R11A0526
13R11A0527
KARLA MAHESH
13R11A0528
13R11A0529
KAUSHIK KHANDELWAL
13R11A0530
13R11A0531
13R11A0532
13R11A0533
KUCHALLAPATI RENUKA
13R11A0535
NASEEM FATHIMA
13R11A0536
13R11A0537
PINNINTI SHIVANI
13R11A0538
13R11A0539
PUVVULA ROHINI
13R11A0540
RAHUL T
13R11A0541
RAJENDRAN ONISHA
13R11A0542
RICHARD BENHUR K
13R11A0543
13R11A0544
S JAYANTH
13R11A0545
13R11A0546
SANJEEVU TEJASWANI
13R11A0547
TADIPARTHI CHRISTINA
151
13R11A0548
TALAKOKKULA VISHAL
13R11A0549
TANNIRU MOUNIKA
13R11A0550
13R11A0551
V TULAJA SRAVANTHI
13R11A0552
13R11A0553
P S MANASA
13R11A0554
II CSE B
1
13R11A0555
ADLA JAYASHREE
13R11A0556
ALETI ROOPAREDDY
13R11A0557
B ADITYA REDDY
13R11A0558
13R11A0559
B KARTHIK RAO
13R11A0560
13R11A0561
13R11A0562
13R11A0563
BANDARU PRADEEP
13R11A0564
BHASKAR DIVYA
13R11A0565
B TEJASREE
13R11A0566
13R11A0567
13R11A0568
13R11A0569
13R11A0570
CHILASAGAR JYOTHI
13R11A0571
CHILUKOJI JAYANTHI
13R11A0572
13R11A0573
13R11A0574
13R11A0575
GUBBA SRILAKSHMI
13R11A0576
13R11A0577
GINKA KIRAN
13R11A0578
13R11A0579
J SUSMITHA
13R11A0580
13R11A0581
KANDUKURI SURYATEJA
13R11A0582
KOLLIPARA NISCHAL
13R11A0583
L PRUTHIVI KUMAR
13R11A0584
13R11A0585
LAKSHMI PRASANNA B
13R11A0586
MOKHAMATAM SWETHA
13R11A0587
13R11A0588
M S BHUVAN
13R11A0589
13R11A0590
MARABOINA KEERTHANA
153
13R11A0591
MAVARAM BHARGAVA
13R11A0593
NAGAPURI DIVYA
13R11A0594
13R11A0595
13R11A0596
POTHANA HARIKA
13R11A0597
PUNNA SPOORTHY
13R11A0598
RAMESH B K
13R11A0599
S SAIKIRAN
13R11A05A0
13R11A05A1
13R11A05A2
13R11A05A3
SHARATH KUMAR P
13R11A05A4
13R11A05A5
T MADHURI CHARY
13R11A05A6
13R11A05A7
13R11A05A8
V LAKSHMI
13R11A05A9
VADLAMANI ADITYA
13R11A05B0
VEERAMALLI SAITEJA
13R11A05B1
13R11A05B2
13R11A05B3
YALLAMBHOTLA ACHYUTH
13R11A05B4
154