Question

Using Dr-Racket, what is the purpose of the number function? (define (number n) (local [(define (abstract...

Using Dr-Racket, what is the purpose of the number function?
(define (number n)
(local [(define (abstract int)
(* int 11))] (build-list n abstract)))

A) Create a list of the first n multiples of 11 starting at 11.

B) Create a list of the first n multiples of 11 starting at 0.

C) Create a list of the first n multiples of 11 starting at 1.

D) Create a list of the first 11 multiples of n starting at 1.

E) Create a list of the first 11 multiples of n starting at 0.

F) Create a list of the first 11 multiples of n starting at n.

Homework Answers

Answer #1

SOLUTION

The given code makes a function named number that takes an arguement "n".

And it prepares a list of "n" multiples of 11 starting from 0.

Let me explain the underlying concept .

Inside the function it is creating an abstract function that takes an integer and then the expression (* int 11) is responsible for multiplication .Then the next expression calls the abstract function passing "n" as arguement.

PROOF:

SO the correct option is B

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In Dr-Racket, which of the following is not necessarily true of a function that takes no...
In Dr-Racket, which of the following is not necessarily true of a function that takes no arguments? A) It can result in side effects B) It might return (void) C) It might return a value like any other function D) It has the same result every time it is called, since it has no input arguments to deal with E) It is called like any other function, i.e. inside parentheses F) It can result in both side effects and return...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n ==...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n == 0)    return 0; else    return n * f(n - 1); } A. 120 B. 60 C. 1 D. 0 10 points    QUESTION 2 Which of the following statements could describe the general (recursive) case of a recursive algorithm? In the following recursive function, which line(s) represent the general (recursive) case? void PrintIt(int n ) // line 1 { // line 2...
Consider the following function: 01: void cpUniq (const int* source, int N, vector<int>& dest) 02: {...
Consider the following function: 01: void cpUniq (const int* source, int N, vector<int>& dest) 02: { 03: list<int> L; 04: for (int i = 0; i < N; ++i) 05: { 06: copy (source, source + i, front_inserter<int>(L)); 07: } 08: for (int j: L) 09: { 10: if (find(dest.begin(), dest.end(), j) != dest.end()) 11: dest.push_back(j); 12: } 13: } and the following list of complexity values: A: O(1), B: O(log N), C: O(N), D: O(N log N), E: O(N2),...
This question is in C++ format and relevant (a) What is the purpose of the f1...
This question is in C++ format and relevant (a) What is the purpose of the f1 function below?    int f1( int data[], int n ) {      int a = 0;      for(int i = 1; i < n; i++)            if(data[i] == 0)                 a++;      return a; } (b) In the signature of the f1 function above, state whether each of the parameters is pass-by-value or pass-by-reference? (c) Complete the definition of the function f2 below such that...
True or false for C++ 1.int n = 11/5; will allocate memory for n and initialize...
True or false for C++ 1.int n = 11/5; will allocate memory for n and initialize with the value 2. 2.Array indices begin with the number 1. 3.You can define multiple functions with the same identifier 4.Variables declared local to a function are still accessible after the function completes execution 5.structs by default have private access specification.
assume you are in main.cpp define a function that is NOT SCOPED to any class. It...
assume you are in main.cpp define a function that is NOT SCOPED to any class. It is NOT a member of the ListInterface nor LinkedList classes. Your function should accept two lists. You will remove all values from the first list that are present in the second list. Example: Lists before call:                                                          Lists after call: target: A, B, C, A, D, C, E, F, B, C, A                        target: A, A, D, E, F, A toRemove: C, B, Q,...
•• R5.9We have seen three kinds of variables in C++: global variables, parameter variables, and local...
•• R5.9We have seen three kinds of variables in C++: global variables, parameter variables, and local variables. Classify the variables of Exercise •• R5.8 according to these categories. 1 int a = 0; 2 int b = 0; 3 int f(int c) 4 { 5 int n = 0; 6 a = c; 7 if (n < c) 8 { 9 n = a + b; 10 } 11 return n; 12 } 13 14 int g(int c) 15 {...
Using the Script: function EulerMethod1(n) X = 0 : 1/n : 1 ; Y = zeros(...
Using the Script: function EulerMethod1(n) X = 0 : 1/n : 1 ; Y = zeros( 1, n + 1 ) ; Y(1) = 1 ; for k = 1 : n m = Y(k) ; Y(k + 1) = Y(k) + m*( X(k + 1) - X(k) ) ; end clf plot( X, Y ) Create a new script, which defines the function EulerMethod2. The purpose of EulerMethod2 is to use Euler's Method to approximate the solution to the...
using dr.racket programing language If we write a function that tests whether a list contains only...
using dr.racket programing language If we write a function that tests whether a list contains only strings, odd numbers, or even numbers, you will notice that the code that iterates through the list stays the same, with the only change being the predicate function that checks for the desired list element. If we were to write a new function for each of the tests listed above, it would be more error-prone and an example of bad abstraction. We could write...
MUST WRITE IN C++ Objective: Learn how to design classes using abstract classes and inheritance Assignment:...
MUST WRITE IN C++ Objective: Learn how to design classes using abstract classes and inheritance Assignment: MUST WRITE IN C++ Objective: Learn how to design classes using abstract classes and inheritance Assignment: In cryptography, encryption is the process of encoding a message or information in such a way that only authorized parties can access it. In this lab you will write a program to decode a message that has been encrypted using two different encryption algorithms. Detailed specifications: Define an...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT