Document Details

SofterByzantineArt5682

Uploaded by SofterByzantineArt5682

2018

APJ Abdul Kalam Technological University

Tags

programming paradigms programming computer science exam

Summary

This is a past paper for the Programming Paradigms course from APJ Abdul Kalam Technological University in the year 2018. The paper includes various questions related to programming concepts like recursion, exceptions, threads and more.

Full Transcript

# APJ Abdul Kalam Technological University ## Seventh Semester B.Tech Degree Examination, December 2018 ### Course Code: CS403 ### Course Name: Programming Paradigms **Max. Marks:** 100 **Duration:** 3 Hours ## Part A Answer all questions, each carries 4 marks. | Question | Description...

# APJ Abdul Kalam Technological University ## Seventh Semester B.Tech Degree Examination, December 2018 ### Course Code: CS403 ### Course Name: Programming Paradigms **Max. Marks:** 100 **Duration:** 3 Hours ## Part A Answer all questions, each carries 4 marks. | Question | Description | Marks | |:---------|:-------------------------------------------------------------------------------------------------------------------|:-----:| | 1 | Show what is side-effect in an expression with the help of an example? | (4) | | 2 | Can a user access a non-local object in case of subroutines, give valid reasons. | (4) | | 3 | With example, briefly explain structural and named equivalence. | (4) | | 4 | Describe the parameter modes used in ADA. | (4) | | 5 | Consider the function (define double(lamda(x)(+xx))), Evaluate the expression (double(*23)) in applicative order as well as normal order. | (4) | | 6 | With help of an example, show how exception is handled in C++? | (4) | | 7 | Differentiate greedy and minimal matches. Generate greedy and minimal matches for the pattern /(cd)+/ in the string acdcdcdcde | (4) | | 8 | Explain constructors and destructors | (4) | | 9 | What is a thread pool in Java? What purpose does it serve? | (4) | | 10 | In what sense is fork/join more powerful than co-begin? | (4) | ## Part B Answer any two full questions, each carries 9 marks. 11. a) Write a pseudo code to find the factorial of a number based on recursive and tail recursive procedure. b) Give the code for the following source with and without short-circuit evaluation. if( (A<=B) and (C<D) or (E!=F)) then then clause else else clause 12. a) Summarize the differences among mark and sweep, stop and copy, and generational garbage collection. b) How records are represented in programming languages? Explain. 13. a) Consider the following pseudocode: x: integer := 3 y: integer := 4 procedure add x := x + y procedure second(P : procedure) x: integer := 5 P() procedure first y: integer := 6 second(add) first() write integer(x) (a) What does this program print if the language uses static scoping? Give reasons (b) What does it print if the language uses dynamic scoping and give reasons b) What are the memory layouts used in arrays? How the address calculation is done in three dimensional arrays? ## Part C Answer any two full questions, each carries 9 marks. 14. a) Explain co-routine? Why cactus-stack is used in co-routine? b) In what sense do generics(template) serve a broader purpose in C++? Explain how to maintain the static link and dynamic link during a subroutine call. 15. a) (let ((a 6) (b 8) (square (lambda (x) (* x x))) (plus +)) (sqrt (plus (square a) (square b)))) Write the output of the above code? Explain how let and lambda construct works b) Define lazy evaluation with an example. 16. a) How database manipulation is carried out in Prolog using assert and retract? b) What are the unification rules used in Prolog? ## Part D Answer any two full questions, each carries 12 marks. 17. a) Explain the innovative features of scripting languages. b) Summarize the visibility rules used in C++. 18. a) Compare and differentiate the data types of popular scripting languages to those of compiled languages like C. b) What is a semaphore? What operations does it support? How binary and general semaphore does differ? 19. a) Describe six different mechanisms(principles) commonly used to create new threads of control in a concurrent program b) What is a JIT compiler? What are its potential advantages over interpretation/conventional compilation?

Use Quizgecko on...
Browser
Browser