Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 6 Which of the following statements are true? I) An anonymous function (a.k.a lambda function) is a function definition that is not bound to

Question 6

Which of the following statements are true?

I) An anonymous function (a.k.a lambda function) is a function definition that is not bound to an identifier.

II) A closure (a.k.a. function closure) is a function or reference to a function together with a referencing environmenta table storing a reference to each of the non-local variables of that function. A closureunlike a plain function pointerenables a function to access those non-local variables even when invoked outside its immediate lexical scope.

III) Closures capture the run-time environment at the time/point the function is declared as opposed to the run-time environment at the time the function is executed.

IV) One difference between Common LISP and Scheme is that Scheme implements closures but Common LISP does not.

Question 6 options:

a-

II, III, and IV

b-

I, II, III, and IV

c-

I, II, and III

d-

I and II

Question 7

Which of the following statements are true?

I) A higher-order function is a function that takes one or more functions as an input.

II) Most functional programming languages are derived from the ideas of lambda calculus in mathematics.

III) The map and fold functions, found in many functional programming languages, are examples of higher-order functions.

IV) Neither C++ as of the C++11 standard nor Java 8 provide language level support for lambda functions or higher-order functions.

V) In the ChurchTuring Thesis, the untyped lambda calculus is claimed to be capable of computing all effectively calculable functions and is therefore logically equivalent to a Universal Turing Machine.

Question 7 options:

a-

I, II, III, and IV

b-

I, II, and V

c-

II, III, and IV

d-

I, II, III, V

e-

I and II

Question 8

Which of the following statements are true?

I) Static type-checking is the process of verifying the type safety of a program based on analysis of a program's source code. If a program passes a static type-checker, then the program is guaranteed to satisfy some set of type-safety properties for all possible inputs. Because static type-checking operates on a program's text, it allows many bugs to be caught early in the development cycle.

II) Dynamic type-checking is the process of verifying the type safety of a program at run-time.

III) The presence of static type-checking in a programming language prevents use of dynamic type-checking.

IV) Static typing advocates believe programs are more reliable when they have been well type-checked early in the development cycle, while dynamic typing advocates point to a large and growing body of code that has proven reliable without static type checking. The opposing views reflect different emphasis on the trade-offs between more effort by programmers and compilers up-front to avoid potential errors vs. finding certain categories of errors only at run-time.

V) Some proponents of dynamic type checking observe that it is impossible for compilers to identify all program bugs at compile time. Therefore, extensive testing is always required if the goal is to eliminate bugs. If extensive tests are used, type errors that might have been detected by a static type checker at compile time will be detected when testing even when dynamic typing is used. Since type errors will be caught whether static type checking used or not, the decision to use static type checking or not should be based on wether one approach or the other promotes more programmer productivity. For example, if programmers save time by using dynamic typing, then the programmers will have more time to develop tests.

Question 8 options:

a-

I, II, III, and IV

b-

I and II

c-

I, II, IV, V

d-

I, II, III

e-

I, II, and IV

Question 9

Which of the following statements are true?

I) Interpreters, compilers, type-checkers, and documentation generators are examples of programs that take other programs as input.

II) An Abstract Syntax Tree (AST) is a tree data structure representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code.

III) Abstract syntax tree data structures represent every detail appearing in the program syntax.

IV) Context free grammars prevent the possibility of ambiguity in programming languages.

V) Context free grammars can enable code generation for individual nodes in an AST without dependencies on parent nodes or child nodes. Context free grammars imply the AST, like all trees, is an acyclic directed graph, and algorithms tailored for acyclic directed graphs play prominent roles in code generation and optimization from ASTs.

Question 9 options:

a-

I, II, V

b-

I, II, IV, and V

c-

I, II, III, and IV

d-

II, III, IV

Question 10

Which of the following statements are true?

I) Interpreters may translate input programs into executable code.

II) Compilers may translate input programs into executable code.

III) Some compilers and interpreters translate input programs into portable intermediate code.

IV) Just-in-time compilers are a practical example of "Dynamic Machine Code Generation".

Question 10 options:

a-

I, II, and IV

b-

I and II

c-

I, II, III, and IV

d-

I, II, III

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago