CSCI 461 - Exam Questions With 100%
Verified Answers
Object-oriented languages use variables whose lifetimes are
associated with object lifetimes
True
False -
correct answer ✅True
The activation record for the following function can be deallocated
as soon as the function returns.
fun f x = fn y => x+y;
True
False -
correct answer ✅False
Consider the following code:
fun addXToAll (x,theList) =
,CSCI 461 - Exam Questions With 100%
Verified Answers
let
fun addX y = y + x;
in
map addX theList
end;
Which function calls map?
map
addX
addXToAll -
correct answer ✅addXToAll
,CSCI 461 - Exam Questions With 100%
Verified Answers
The following ML function contains a function call that passes a
function parameter f. In each case, will the function f use its nesting
link when it is called.
fun haveFun f = map f [1, 2, 3, 4, 5, 6];
No
The function has an error
Yes
Cannot determine. Need know the definition of f. -
correct answer ✅Cannot determine. Need know the definition of f.
Check all correct statement about the activation record.
In a stack of activation records: stack frames pushed on call,
popped on return
In C, it can be deallocated when the function returns
, CSCI 461 - Exam Questions With 100%
Verified Answers
Dynamic allocation means that activation record allocated when
function is called
To support recursion, we need to allocate a new activation record
for each activation -
correct answer ✅In a stack of activation records: stack frames
pushed on call, popped on return
In C, it can be deallocated when the function returns
Dynamic allocation means that activation record allocated when
function is called
To support recursion, we need to allocate a new activation record
for each activation
To use textual substitution before compiling is a natural
implementation of ________________
pass by value
Verified Answers
Object-oriented languages use variables whose lifetimes are
associated with object lifetimes
True
False -
correct answer ✅True
The activation record for the following function can be deallocated
as soon as the function returns.
fun f x = fn y => x+y;
True
False -
correct answer ✅False
Consider the following code:
fun addXToAll (x,theList) =
,CSCI 461 - Exam Questions With 100%
Verified Answers
let
fun addX y = y + x;
in
map addX theList
end;
Which function calls map?
map
addX
addXToAll -
correct answer ✅addXToAll
,CSCI 461 - Exam Questions With 100%
Verified Answers
The following ML function contains a function call that passes a
function parameter f. In each case, will the function f use its nesting
link when it is called.
fun haveFun f = map f [1, 2, 3, 4, 5, 6];
No
The function has an error
Yes
Cannot determine. Need know the definition of f. -
correct answer ✅Cannot determine. Need know the definition of f.
Check all correct statement about the activation record.
In a stack of activation records: stack frames pushed on call,
popped on return
In C, it can be deallocated when the function returns
, CSCI 461 - Exam Questions With 100%
Verified Answers
Dynamic allocation means that activation record allocated when
function is called
To support recursion, we need to allocate a new activation record
for each activation -
correct answer ✅In a stack of activation records: stack frames
pushed on call, popped on return
In C, it can be deallocated when the function returns
Dynamic allocation means that activation record allocated when
function is called
To support recursion, we need to allocate a new activation record
for each activation
To use textual substitution before compiling is a natural
implementation of ________________
pass by value