CSE 3302 Programming Languages Final Exam

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/60

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

61 Terms

1
New cards

c

(cons 'a 'b) will result in:

A. '(a b ())

B. '((a) b)

C. '(a . b)

D. '(a b)

2
New cards

d

(cons '(a) '(b)) will result in:

A. '(a b ())

B. '((a) b)

C. '(a . b)

D. '( a b)

3
New cards

d

(cons 'a '(b)) will result in:

A. '(a b ())

B. '((a) b)

C. '(a . b)

D. '(a b)

4
New cards

b

(car (cdr '( a b (c d e) f (g h i)))) will result in:

A. '((g h i))

B. 'b

C. '(c d e)

D. '(g h i)

5
New cards

c

(car (cdr (cdr '(a b (c d e) f (g h i))))) will result in:

A. '((g h i))

B. 'b

C. '(c d e)

D. '(g h i)

6
New cards

a

(cdr (cdr (cdr (cdr '(a b (c d e) f (g h i))))))

A. '((g h i))

B. 'b

C. '(c d e)

D. '(g h i)

7
New cards

d

Recursion is to Scheme as ____ are to Java.

A. arrays

B. expressions

C. functions

D. loops

8
New cards

b

Tail recursion requires functions to:

A. do significant processing after calling other functions

B. return to their caller as the very last thing they do

C. have one return statement at the very end of their code

D. do no significant processing after calling another function

9
New cards

c

Scheme allows nameless functions by using:

A. cond

B. define

C. lambda

D. '()

10
New cards

b

(pair? x) returns #t when:

A. the length of x is exactly 2

B. (car x) and (cdr x) are defined

C. (car x) and (cdr x) are the same S-expression

D. the first two elements of x are the same

11
New cards

d

What will appear on the console for the JavaScript code below?

arr=[];

arr[10]=1;

console.log(arr["5"]);

A. exception

B. 5

C. 1

D. undefined

12
New cards

b

The difference between actual parameters and formal parameters is:

A. actuals are call-by-value, formal are call-by-name

B. actuals are in the caller, formals are in the called subprogram

C. actuals are in the called subprogram, formals are in the caller

D. no difference

13
New cards

b

Omitting the "new" on a call to an intended construct will bind "this" to:

A. an array of arguments

B. the global object

C. the last instance created by this constructor

D. the prototype

14
New cards

c

Static chain links go through which type of allocation?

A. static

B. heap

C. stack

D. registers

15
New cards

a

(cdr (cdr (cdr (cdr '(a b (c d e) f (g h i))))))

A. '((g h i))

B. 'b

C. '(c d e)

D. '(g h i)

16
New cards

d

A thrown JavaScript exception may be:

A. a string

B. a declared exception type

C. a number

D. any of these

17
New cards

c

Exceptions may be implemented in Scheme by using

A. closures

B. cond

C. continuations

D. set!

18
New cards

c

(car (cdr (cdr '(a b (c d e) f (g h i)))))

A. '((g h i))

B. 'b

C. '(c d e)

D. '(g h i)

19
New cards

a

Which of the following is a JavaScript type?

A. boolean

B. char

C. int

D. real

20
New cards

a

JavaScript makes a simple stack available through:

A. array methods

B. prototypal inheritance

C. cloning the stack class

D. closure

21
New cards

d

Keyword parameters give flexibility in:

A. achieving overloading

B. making call-by-name work effectively

C. overriding the reserved words of a language

D. the order in which parameters are passed

22
New cards

a

The difference between actual parameters and formal parameters is:

A. actuals are in the caller, formals are in the called subprogram

B. actuals are in the called subprogram, formals are in the caller

C. actuals are call-by-value, formals are call-by-name

D. no difference

23
New cards

d

PL/0 uses static links to:

A. Update the display table

B. Return from a called procedure

C. Place an integer on the stack

D. Reference data

24
New cards

b

PL/0 uses dynamic links to:

A. Update the display table

B. Return from a called procedure

C. Place an integer on the stack

D. Reference Data

25
New cards

b

(cons (car (cdr '(h (i j k) l m))) (cdr '(d e(g f) (a b c)))) will result in:

A. '((e (g f) (a b c)) i j k)

B. '((i j k) e (g f) (a b c))

C. '(((g f) (a b c)) i j k)

D. '((i j) e (g f) (a b c))

26
New cards

a

(car (cons (car (cdr '(a (b c) (d e)))) (cdr '(((f g)) h i (j k))))) will result in:

A. '(b c)

B. '((b c))

C. '(d e f g)

D. '((b c) h i (j k))

27
New cards

c

Continuations could be viewed as being a generalization of:

A. activation records

B. combinator

C. exceptions

D. functions

28
New cards

a

Call-by-name is associated with which language?

A. ALGOL 60

B. C

C. JavaScript

D. Pascal

29
New cards

b

## may be used in a C macro to:

A. apply the macro in a call-by-name fashion

B. concatenate tokens

C. simulate Pascal var argument passing

D. stringify tokens

30
New cards

b

The static link and dynamic link for an activation record will be the same when:

A. never

B. a procedure has called itself

C. the call is from a nested procedure

D. in all cases

31
New cards

c

What will appear on the console for the JavaScript code below?

arr=[];

arr[10]=1;

console.log(arr["10"];

A. exception

B. 5

C. 1

D. undefined

32
New cards

c

The difference between actual parameters and formal parameters is:

A. actuals are in the called subprogram, formals are in the caller

B. actuals are call-by-value, formals are call-by-name

C. actuals are in the caller, formals are in the called subprogram

D. no difference

33
New cards

b

PL/0 uses static links to:

A. Place an integer on the stack

B. Reference data

C. Update the display table

D. Return from a called procedure

34
New cards

d

PL/0 uses dynamic links to:

A. Place an integer on the stack

B. Reference Data

C. Update the display table

D. Return from a called procedure

35
New cards

a

(cons (cdr '(d e (g f) (a b c))) (car (cdr '(h (i j k) l m)))) will result in:

A. '((e (g f) (a b c)) i j k)

B. '((i j k) e (g f) (a b c))

C. '(((g f) (a b c)) i j k)

D. '((i j) e (g f) (a b c))

36
New cards

c

(cons (cdr '(e (g f) (a b c))) (car (cdr '(h (i j k) l m)))) will result in:

A. '((e (g f) (a b c)) i j k)

B. '((i j k) e (g f) (a b c))

C. '(((g f) (a b c)) i j k)

D. '((i j) e (g f) (a b c))

37
New cards

d

Which language's operator precedences have the least similarity to the other three?

A. C

B. Java

C. JavaScript

D. Pascal

38
New cards

a

Overloading operators may be done in which language?

A. C++

B. Java

C. JavaScript

D. C

39
New cards

a

The value resulting from !!(4/2) in JavaScript will be

A. true

B. false

C. 2

D. undefined

40
New cards

the argument is evaluated every time it is used

What is call-by-name?

41
New cards

d

The lambda calculus is a major influence on which language?

A. C

B. Java

C. Pascal

D. Scheme

42
New cards

c

The difference between actual parameters and formal parameters is:

A. actuals are in the called subprogram, formals are in the caller

B. actuals are call-by-value, formal are call-by-name

C. actuals are in the caller, formals are in the called subprogram

D. no difference

43
New cards

taking a value and passing a copy of that value to the function

What is call-by-value?

44
New cards

b

Duff's device involves which PL construct?

A. C union

B. C Switch

C. Java Switch

D. C varargs

45
New cards

a

Static chain links go through which type of allocation?

A. stack

B. heap

C. static

D. registers

46
New cards

c

(car (cdr (cdr '(a b (c d e) f (g h i)))))) will result in:

A. '((g h i))

B. 'b

C. '(c d e)

D. '(g h i)

47
New cards

a

(cdr (cdr (cdr (cdr '(a b (c d e) f (g h i))))))) will result in:

A. '((g h i))

B. 'b

C. '(c d e)

D. '(g h i)

48
New cards

d

A thrown JavaScript exception may be:

A. a string

B. a declared exception type

C. a number

D. any of these

49
New cards

a

Call-by-name is associated with which language?

A. ALGOL 60

B. ALGOL 68

C. JavaScript

D. Pascal

50
New cards

b

The Y combinator is useful for:

A. anonymous functions

B. continuations

C. threads

D. unary functions

51
New cards

d

Keyword parameters give flexibility in:

A. achieving overloading

B. making call-by-name work effectively

C. overriding the reserved words of a language

D. the order in which parameters are passed

52
New cards

d

For which of these languages is there a significant difference between "for" and "while" loops?

A. C

B. Java

C. JavaScript

D. Pascal

53
New cards

d

Keyword parameters give flexibility in:

A. achieving overloading

B. making call-by-name work effectively

C. overriding the reserved words of a language

D. the order in which parameters are passed

54
New cards

d

Beside a switch statement, Duff's device also involves which C construct?

A. break

B. continue

C. goto

D. loop

55
New cards

a

The cost of addressing a variable in PL/0 is linear in:

A. level difference

B. number of entries in the display

C. scope level of the instruction

D. scope level of the variable

56
New cards

c

(cons (cdr '(e (g f) (a b c))) (car (cdr '(h (i j k) l m)))) will result in:

A. '((e (g f) (a b c)) i j k)

B. '((i j k) e (g f) (a b c))

C. '(((g f) (a b c)) i j k)

D. '((i j) e (g f) (a b c))

57
New cards

a

(cdr (cdr (cdr (cdr '(a b (c d e) f (g h i))))))

A. '((g h i))

B. 'b

C. '(c d e)

D. '(g h i)

58
New cards

b

The for .. in construct is used to:

A. enumerate array elements that are not undefined

B. enumerate properties

C. test a subclass/superclass relationship

D. iterate over an integer subrange

59
New cards

b

Call-by-name is most similar to application of:

A. #include

B. macro

C. r-value

D. recursion

60
New cards

b

The state of a Scheme computation may be saved as:

A. an anonymous function

B. a continuation

C. a fixed point

D. a thread

61
New cards

d

PL/0 uses dynamic links to:

A. Place an integer on the stack

B. Reference data

C. Update the display table

D. Return from a called procedure