Question 7 1 point Select all of the following statements th
Question 7 (1 point)
Select all of the following statements that are true.
Question 7 options:
The following Racket function, func, is functionally identical to the Scheme standard map function. The type of the parameter f can be any valid Scheme type.
(define (func f lst)
(cond
[(empty? lst) empty]
[else (cons (f (first lst)) (func f (rest lst)))]
)
)
In Python, a dictionary is a list of (key, value) pairs. The key can be any \"immutable\" object (tuples, strings, numbers), and the value can be any Python object.
The Scheme constructor, cons, is used when you already have a list and you want to add one new element.Cons takes two arguments, an element and a list (in that order), and returns a new list whose car is the first argument and whose cdr is the second.
The Scheme statement,
(map (lambda (x)(* x x)) \'(9 8 7 6))
evaluates to the list,
\'(81 64 49 36)
Question 8
Select all of the following statements that are true.
Question 8 options:
Python has dynamic typing and binding, and everything in Python is an object. As in Smalltalk, Python classes themselves are objects. In Python 3.5, built-in types can be used as base classes for extension by the user.
A program written in Python will always take more time to execute that a logically equivalent program written in Java or C++.
The Python statement,
map(lambda x: x * x, [9, 8, 7, 6])
evaluates to the list,
[81, 64, 49, 36]
Because of the run time typing, Python\'s run-time must work harder than Java\'s. For example, when evaluating the expression a+b, the python run-time must first inspect the objects a and b to find out their type, which is not known at compile time. It then invokes the appropriate addition operation, which may be an overloaded user-defined method. Java, on the other hand, can perform an efficient integer or floating point addition but requires variable declarations for a and b, and Java does not allow overloading of the + operator for instances of user-defined classes.
Question 9 (1 point)
Select all of the following statements that are true.
Question 9 options:
Python lists may be used as keys in dictionaries.
Python tuples are derived from (inherit) from Python lists.
Python includes three types of built-in data structures: lists, immutable lists called tuples, and hash tables called dictionaries.
Python tuples may be used as keys in dictionaries.
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | 
Solution
Answer 9 - B C D are true option A is false
Answer 8 - A C D are true option B is false
Answer 7 - B D are true option A C are false


