1 This question is about the Nature of Programming Languages. a) Explain the essential characteristics and features...
Question:
1 This question is about the Nature of Programming Languages.
a) Explain the essential characteristics and features for each of the following categories of programming language. Provide sample code to illustrate these features. i. Imperative Languages.
ii. Declarative Languages.
iii. Scripting Languages.
b) Event-Driven Programming is often associated with programs for Graphical User Interfaces (GUIs) and Web Programming. Describe the meaning of the term Event Driven Programming and provide code examples of how this style of programming works. Are all languages suitable for Event-Driven Programming?
2.a) What is an IDE and what are its key features and functions?
b) Compare and contrast compilation and interpretation as software translation processes.
'Testing is the same as debugging.' Discuss this statement and explain whether or not you agree with it. In your answer, consider tools and techniques that might be used.
3.a) Within the context of the object-oriented (OO) paradigm, discuss the relationship between a class and an object, illustrating your discussion with appropriate examples. You should comment on the associated concepts of class/object attributes and behaviour and how they are represented. What specific OO concepts describe bringing together attributes and behaviour into a class and restricting (or removing) access to the implementation?
b) A key element of the OO paradigm is the method. Begin by describing the purpose of the method concept before moving on to explain the different categories and types of method to be found in an OO programming language. Illustrate your discussion with simple examples.
4.a) A Prolog database about pets contains the following facts: dog(rover). dog(bert). dog(snowy). cat(fluffles). cat(tom). rabbit(thumper). eats(tom, fish). eats(bert, biscuits). eats(fluffles, cream). eats(fluffles, fish). eats(rover, biscuits). eats(rover, meat). eats(snowy, meat). eats(thumper, lettuce). Provide an example of each of the following and describe how each would be used: I. A ground query (no variables). II. An existential/nonground query (using variables). III. A conjunctive query (using a conjunction). IV. A rule (with a head and a body).
b) Describe the use of findall/3 in Prolog and give an example of how it could be used with the example database in part a).
c) Describe how negation-as-failure is used in Prolog. Give an example of a query using negation and explain how it is executed using the example database above.
5.a) Some functions will have 'side effects'. In fact, some functions are written just for their side effects. Explain the term side effects and give an example of a function that has side effects as well as producing a value.
b) Explain the terms domain and range, as they pertain to functions in functional programming. Choose a programming language that has a function for calculating the length of a string. What is the domain and range of this function? Is this a partial function or not? Explain your answer.
c) Using a functional language of your choice, write a recursive function naturalise which should take a list of integers as its parameter and return a copy of the list of numbers except that negative numbers are replaced by zero. For example, naturalise [3,-5,6,-9,8] should give the result [3,0,6,0,8].
Statistics For Business And Economics
ISBN: 9780134506593
13th Edition
Authors: James T. McClave, P. George Benson, Terry Sincich