Docsity

Midterm Exam 1 with Solutions - Programming Languages | CS 3723, Exams of Programming Languages

Partial preview of the text

Download Midterm Exam 1 with Solutions - Programming Languages | CS 3723 and more Exams Programming Languages in PDF only on Docsity!

CS 3723: MipTERM Exam I Nam: So/utions Please read each question carefully and answer it in the space provided. There are ten questions. Each question is worth 10 points. 1. Postscript is Turing-Complete. Use this knowledge to answer the following questions: (a) What can be said about the class of functions that can be computed by a Postscript document compared to those that can be computed by a Turing-Machine? A postseriet document can be written that would compute any Purction that Can be Compute o by a Turing Machine, (b) If Church-Turing Thesis is correct, what can be said more generally about the class of functions that can be computed? d A: postseript docuneat can be weitter that Would conpale any Function that caa be computed, (c) Since the Halting Problem is undecidable, what can be said about how long it can take to render (i.e., execute) arbitrary Postscript documents? It may take an unbounded, possibly itintte, eomount of time and this Cannot be predicted in aduunce, 2. (a) Besides Postscript, list four other computer languages that are Turing Complete. Exanples jncude. q Java, Lisp Se, esh Per) (b) List three languages that are not Turing-Complete. Examples include! HT/12, SGML, POF S@L, C55 3. What do each of the following Scheme expressions evaluate to? Write the result value. And if the result is a list, diagram the memory layout for the list. (a) (cons ’a (cons ’b ’())) fa b) fal PET} (b) (sqrt (+ (* 3 2) 10)) qy (c) (+ (cdr (cons 1 2)) 7) (d) (cons (car (cdr (a 1 2))) ?(+ 3 4)) (+3 COPE T perp (e) (lambda (x) (cons x x)) ’(a b c)) (la 6c) a bo)