lOMoARcPSD|50656904
Ppl aprl-may 2024 - Question Paper
principles of programming language (Anna University)
Scan to open on Studocu
Studocu is not sponsored or endorsed by any college or university
Downloaded by Malar Vizhi (malarvizhiselvaraj2005@[Link])
lOMoARcPSD|50656904
FAI
tlhl2024
Reg. No. :
Question Paper Code :50441
B.E/[Link]. DEGREE EXAMINATIONS, APRIMAY 2024.
Fifth/Sixth Semester
Computer Science and Engineering
CCS 358- PRINCIPLES OF PROGRAMMING LANGUAGES
(Common to :Computer Science and Design/ Computer Science and Engineering
(Artificial Intelligence and Machine Learning)/Computer Science and Engineering
(Cyber Security)/ Computer and Communication Engineering/ Artificial Intelligence
and Data Science/ Information Technology)
(Regulations 2021)
Time : Three hours Maximum: 100 marks
Answer ALL questions.
PART A (10x 2 = 20 marks)
1 List the supports added to Fortran 2003.
2. State the relationship between the non-terminal and terminal symbols in a
Grammar.
3. List the two disadvantages of dynamic binding.
4. Make a simple swap code using multiple assignments in perl.
5. Give two examples of a multiple selector statement.
6. State true or false
(a) An iterator need not be history sensitive
(b) All of the predefined generic collections in Java implement Iterable
(Interface).
7. List the basic three features that every object oriented programming languages
must support.
8. What are Listeners?
9. List any two features of prolog.
10. Define bin functional form if b= f° g; f(o) =x+ 2;g(r) =3 *x.
Downloaded by Malar Vizhi (malarvizhiselvaraj2005@[Link])
lOMoARcPSD|50656904
PART B(5 x 13 =65 marks)
11. (a) @ Describe the evolutional change that 'SMALTALK had brought into
the programming field. (4)
(1) Using the grammar given, show a parse tree and a leftmost
derivation for each of the following statements: (9)
GRAMMER:<assign> ’ <id> =<expr>
<id>’ A| B|C
<expr>’ <id> + <expr> | <id>* <expr> |(<expr>) | <id>
(1) A= A* (B + (C*A))
(2) B= C* (A* C+B)
(3) A= A* (B + (C)
Or
(b) ) Differentiate imperative and declarative programming. (4)
(ii) Justify with explanations the statement «The tokens of a
programming language are a regular language, and a lexical
analyzer is a finite automaton." (9)
12. (a) ) Find the type of binding in the following examples by reasoning (6)
int x = 10;
temp = [20.5, 35.8, 32.0]
var name =John":
(ii) Ilustrate how to make a column wise slices and row wise slices in a
twodimensional array in python. (7)
Or
(b) () Discuss about the statie scope, dynamic scope and block scope of
variables. (6)
(ii) Implement code to demonstrate the rainbow colours as enumerated
data types. (7)
2 50441
Downloaded by Malar Vizhi (malarvizhiselvaraj2005@[Link])
lOMoARcPSD|50656904
13. (a) () State how to avoid confusion in semantics in implementation of
nested ifelse statements. (9)
(1) Translate the following call to Scheme's COND to C and set the
resulting value to y. (4)
(COND
( x10) x)
(<x 5) (*2x)
(=x7) (+x 10)
Or
(b) ) Demonstrate how break/contin ue helps to have a user-located loop
control mechanisms. (7)
(ii) Explain the following: (6)
(1) Overloaded sub program
(2) Generic sub program
(3) Closure
14. (a) ) Differentiate instance methods, instance variables with class
methods and class variables with suitable examples. (6)
(i1) Discuss about the fundamental concepts of concurrency. (7)
Or
(b) Write about the efficiency of nested classes in object oriented
programming. (7)
(ii) Explain how semaphore variables allow to have synchronized and
safe access to the shared data? (6)
15. (a) ) Write the following English conditional statements as
Prolog-headed Horn clauses: (9)
(1) IfFred is the father of Mike, then Fred is an ancestor of Mike.
(2) If Mike is the father of Joe and Mike is the father of Mary,
then Mary is the sister of Joe.
(3) If Mike is the brother of Fred and Fred is the father of Mary,
then Mike is the uncle of Mary.
(ii) Explain how to write an Arithmetic Expression in LISP. (4)
Or
3
50441
Downloaded by Malar Vizhi (malarvizhiselvaraj2005@[Link])
lOMoARcPSD|50656904
Discuss the appronches for attempting to mateh a goal with a fact
in adatabase in PROLOG. (6)
(i1) Write a Scheme function that takes a simple list of numbers as a
parameter and returns a list with the largest and smallest numbers
in the input list. (7)
PART C-(1x 15 = 15 marks)
16. (a) Write pseudocode for user defined Exception class in Java and to raise
and catch the exception when any of input array values is greater than
100. State how the control flows when an exception is raised and not
raised.
Or
(b) State how event handling is effective in Java GUI program ming with
suitable examples.
4 50441
Downloaded by Malar Vizhi (malarvizhiselvaraj2005@[Link])