Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CSE 461: Programming Languages Concepts Prof. G. Tan Spring 2022 Homework 7 Due on Apr 27th at 6pm; Submission: Only a 3-day late submission will be allowed, as we want to release the solution early...

1 answer below »

CSE 461: Programming Languages Concepts
Prof. G. Tan
Spring 2022
Homework 7
Due on Apr 27th at 6pm;
Submission: Only a 3-day late submission will be allowed, as we
want to release the solution early for you to prepare for the final exam.
Please submit your homework via Canvas. It’s okay if you submit a scanned
version of your on-paper answers, but please make sure your scanned version
is legible.
1. (4 points) For each of the following Racket lists, draw its memory
epresentation using atom and cons cells:
(a) ’(everyday (is a) new beginning)
(b) ’((everyday is) (a) new (beginning))
2. (4 points) For each of the following Racket expressions, draw the mem-
ory representation of its result after its evaluation:
(a) (cons (cons ’b ’c) (cons ’b ’c))
(b) ((lambda (x) (cons x x)) (cons ’b ’c))
3. We have a Racket program below:
(define lst ’(Racket (is fun)))
(define lst (car (cdr lst)))
(define lst (cons ’Racket lst))
(a) (2 points) Draw the memory layout in terms of cells for each
execution step of the above program. Assume Ga
age Collection
does not run in intermediate steps.
(b) (1 point) What is the value of lst at the end?
(c) (1 point) Suppose the system decides to perform a Mark-and-
Sweep Ga
age Collection at the end, which memory cells would
e recycled?
1
Answered 4 days After Apr 25, 2022

Solution

Anandkumar answered on Apr 30 2022
115 Votes
Question 2B)
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here