CSCI 316: Quiz 9 - Subprograms
Sign in to Google
to save your progress.
Learn more
* Indicates required question
Email
*
Your email
Last Name
*
Your answer
First Name
*
Your answer
Student Id
*
Your answer
Which characteristic most clearly distinguishes a subprogram from an inline code block?
*
1 point
It is named and can be invoked multiple times
It must be recursive
It must use parameters
It must be declared inside another subprogram
It always returns a value
Which of the following is not a typical design issue for subprograms?
*
1 point
Parameter passing methods
Operator precedence
Static versus dynamic scoping
Local referencing environments
Type checking of parameters
A local referencing environment of a subprogram consists of
*
1 point
Only stack-dynamic variables
Only parameters
Variables declared inside the subprogram and its ancestors
All variables accessible during program execution
Only statically allocated variables
Which parameter-passing method passes the address of the actual parameter?
*
1 point
Pass-by-result
Pass-by-name
Pass-by-copy
Pass-by-reference
Pass-by-value
Pass-by-value-result is sometimes described as
*
1 point
Copy-in copy-out
Indirect addressing
Deferred binding
Call-by-need
Lazy evaluation
Which parameter-passing method can lead to aliasing problems? Pass by...
*
1 point
Reference
Value, Name, Reference
Name and Reference
Name
Value
Which parameter-passing method is not supported directly by most modern languages?
*
1 point
Pass-by-value-result
Pass-by-result
Pass-by-reference
Pass-by-value
Pass-by-name
In pass-by-name, actual parameters are
*
1 point
Copied into the formal parameter
Treated as constants
Re-evaluated every time the formal parameter is used
Evaluated before the call
Passed as addresses
Which language feature allows subprograms to be passed as parameters?
*
1 point
First-class functions
Static binding
Ad-hoc polymorphism
Stack-dynamic allocation
Overloading
Which of the following is required for higher-order functions?
*
1 point
Subprogram parameters
Nested subprograms
Static scoping
Dynamic scoping
Operator overloading
Calling a subprogram through a pointer or reference is known as
*
1 point
Direct binding
Generic invocation
Overloading
Indirect call
Static dispatch
Which of the following best describes function overloading?
*
1 point
Functions passed as parameters
Functions selected at run time by type
Multiple functions with the same name but different parameter profiles
Functions declared inside other functions
Multiple functions with the same body
Which mechanism supports compile-time polymorphism?
*
1 point
Closures
Coroutines
Virtual methods
Overloading
Dynamic binding
Generic subprograms are primarily designed to support
*
1 point
Concurrency
Exception handling
Dynamic scoping
Type abstraction
Encapsulation
A closure is best described as
*
1 point
A function with no parameters
A function bundled with its referencing environment
A recursive subprogram
A generic function
A coroutine with state
Which feature allows multiple entry points and suspended execution?
*
1 point
Closures
Exceptions
Generics
Coroutines
Threads
Unlike subprograms, coroutines
*
1 point
Must be recursive
Cannot share data
Resume execution where they last suspended
Must be statically allocated
Cannot return values
The general semantics of calls and returns include
*
1 point
Exception propagation
Name binding only
Garbage collection
Operator dispatch
Parameter transmission and return address handling
Which data structure is most commonly used to manage subprogram calls?
*
1 point
Heap
Stack
Tree
Graph
Queue
An activation record typically contains
*
1 point
Only return values
Only local variables
Only parameters
Only static variables
Local variables, parameters, and control information
Which item is not normally stored in an activation record?
*
1 point
Saved registers
Parameters
Program source code
Local variables
Return address
Subprograms that have no local variables and no parameters are easiest to implement using
*
1 point
Dynamic scoping
Closures
Static allocation
Heap allocation
Stack-dynamic allocation
Stack-dynamic local variables are allocated
*
1 point
During garbage collection
At compile time
When the program terminates
When the subprogram is called
At program start
Which implementation challenge arises with nested subprograms?
*
1 point
Accessing nonlocal variables
Stack overflow
Parameter passing
Overloading resolution
Type checking
A static link in an activation record points to
*
1 point
The global environment
The caller’s activation record
The most recent activation record
The activation record of the lexically enclosing subprogram
The heap
A dynamic link points to
*
1 point
The lexically enclosing subprogram
The caller’s activation record
A closure
The heap
The global frame
Which scoping method relies on the call chain for name resolution?
*
1 point
Static scoping
Lexical scoping
Shallow scoping
Block scoping
Dynamic scoping
Which scoping method is used by most modern languages?
*
1 point
Ad-hoc scoping
Static scoping
Runtime scoping
Dynamic scoping
Shallow binding
In deep binding, the environment of a subprogram parameter is
*
1 point
The global environment
The environment at the time of call
The heap
The environment of the caller
The environment at the time of definition
Which design goal is most negatively impacted by excessive aliasing?
*
1 point
Writability
Portability
Expressivity
Efficiency
Reliability
A copy of your responses will be emailed to the address you provided.
Submit
Clear form
Never submit passwords through Google Forms.
reCAPTCHA
Privacy
Terms
This content is neither created nor endorsed by Google. -
Terms of Service
-
Privacy Policy
Does this form look suspicious?
Report
Forms
Help and feedback