Chapters 7-10 Combined

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

The termination model resumes control at the exact point an exception is first raised after it is handled

F

To exit a loop completely, the continue statement is used

F

If a pointer is passed by value, the procedure cannot modify the contents of the pointer. T/F

False

Pass by name is included in all Algol60 descendants. T/F

False

Polymorphism allows names to have multiple types but does not allow for static type checking. T/F

False

In the absence of side effects, normal order evaluation does not change the semantics of a program

T

Lisp rewuires all expression to be fully parenthesized

T

The do statement ensure that the code of a loop is executed at least once

T

A call to procedure transfer to control to the beginning of the body of the called procedure. T/F

True

All computer data is finite. T/F

True

Declarations in surrounding blocks are called nonlocal declarations. T/F

True

Hindley-Milner type checking assigns type varaibles to all unnamed types. T/F

True

An activation block cannot communicate with the rest of the program. T/F

False

An activation record is a stored log, recording each time a procedure or function is activated. T/F

False

Another name for activation record is stack record. T/F

False

If an operator can be used to perform more than one operation, it is said to be shadowed. T/F

False

In Ada, parameters can be declared an in or out, but nor both. T/F

False

In C++, declarations that bind all potential attributes are called prototypes. T/F

False

Java does not allow dynamically sized arrays. T/F

False

Java requires manual deallocation of objects. T/F

False

Pass by value implies that changes cannot occur outside the procedure through the use of parameters. T/F

False

A __ is a mechanism in programming for abstracting a group of actions or computations. A. Statement B. Procedure C. Block D. Method

Procedure

A(n) __ type uses itself in its declaration. A. Bootstrap B. Recursive C. Reference D. Enumerated

Recursive

______ states that any two expressions in a program that have the same values may be substituted for each other anywhere in the program

Referential transparency

__ are used to revert control back to a method caller. A. Return-statements B. Revert-statements C. Control-statements D. Redirect-statements

Return-statements

operators can be written in infix, postfix or prefix notation

T

A procedure is a mechanism for abstracting a group of actions or computations. T/F

True

Locations are places where values can be stored. T/F

True

Pass by value is the default mechanism in C++ and Pascal. T/F

True

Pointers are often used in the creation of recursive types. T/F

True

Procedures were first introduced when memory was scarce, as a way of splitting a program into small, separately compiled pieces. T/F

True

When a nonlocal name is used in an expression, the declaration that applies to that name cannot be determined until execution time under dynamic scoping. T/F

True

You call a procedure by stating its name, together with arguments to the call. T/F

True

____ are any storable quantities, such as integers. a. Values b. Identifiers c. Data d. Locations

Values

In the guarded if statement, the _____ are the Boolean expressions

guards

The most closely nested rule is used to disambiguate _____

if statements

Variables declared in the calling method are said to be in the __ environment. A. Calling B. Defining C. Static D. Stack

Calling

A procedure with no nonlocal dependencies is considered to be in __ forms. A. Independent B. Closed C. Control D. Structured

Closed

Ada is a language with no explicit types. T/F

False

All data types must be names. T/F

False

Enumerated types are never ordered. T/F

False

Every language comes with a set of predefined types from which all other types are constructed. T/F

False

Recursion is allowed in Fortran77. T/F

False

Reference counting is a lazy method of storage reclamation. T/F

False

Static binding occurs during execution. T/F

False

Static constants are always computed at load time. T/F

False

Static type checking occurs at runtime. T/F

False

The type system is the naming convention for data types. T/F

False

In a(n) __ environment, all memory allocation can be preformed at load time, and the location of all variables are fixed for the duration of program execution. A. Dynamic B. Universal C. Global D. Fully static

Fully static

____ are generally bound at load time. a. All variables b. All attributes c. Predefined identifiers d. Global variables

Global variables

If a type must be inferred by the translator, it is considered to be a(n) __ type. A. Explicit B. Strong C. Implicit D. Weak

Implicit

_____ code is code for a function body that is inserted directly at the point where the function would be called

Inline

A procedure is defined by providing a(n) and a body. A. Name B. Interface C. Activation Record D. Error Handler

Interface

____ declarations are associated with a specific block. a. Local b. General c. Global d. Specific

Local

Type declaration is the process of __. A. Inferring new data types B. Creating type constructors C. Naming new data types D. Associating data types of identifiers

Naming new data types

A procedure communicates with the rest of the program through its parameters and through __. A. Constants B. Functions C. Nonlocal references D. Overloaded variables

Nonlocal references

Historically, the interpretation of pass by name arguments as functions to be evaluated was expressed by referring to them as __. A. chunks B. objects C. thunks D. expressions

Thunks

A block consists of a sequence of declarations followed by a sequence of statements. T/F

True

A fundamental abstraction mechanism in any programming language is the use of names, or identifiers to denote language entities or constructs. T/F

True

A narrowing conversion is an implicit conversion that may result in loss of data. T/F

True

A procedure declaration creates a constant procedure value and associates a symbolic name with that value. T/F

True

A procedure specification includes its names, the names and types of its formal parameters and its return type, if any. T/F

True

A reference is the address of an object under control of the system, which cannot be used as a value or operated on in any way. T/F

True

A translator's symbol table stores the mappings between names and attributes. T/F

True

A union is considered to be discriminated if a tag is added to the union to distinguish the type of the element. T/F

True

Each function call generates a region of allocated memory associated with the function; this is called an activation record. T/F

True

Each type descriptor includes a field called a type for to identify the category of the data type. T/F

True

For multidimensional array declarations must have all but the first dimension specified. T/F

True

In C and Java, parameters are passed by value behave as local variables of the procedure. T/F

True

In a block-structured language with heap allocation, there are three kinds of allocation: static (for global variables), automatic (for local variables), and dynamic (for heap allocation). T/F

True

In a strongly typed programming language, the set of legal programs is a proper subset of the set of safe programs. T/F

True

In pass by name parameter passing, arguments are not evaluated until their actual use as parameters in the procedure. T/F

True

In strongly typed languages, procedure calls must be checked so that the arguments agree in type and number with the parameters of the procedure. T/F

True

Mark and sweep is a lazy method of storage reclamation. T/F

True

Names can be bound to attributes prior to translation time, as in the case of predefined identifiers. T/F

True

Pass by name can be described an an advanced inlining process for procedures. T/F

True

Pass by reference is also known as copy-in, copy-out. T/F

True

Pass by value can be described as an advanced inlining process for procedures. T/F

True

The for - loop construct provides for a(n) _____ expression, a test expression and an update expression

initializer

In C++, exception handlers are associated with _____ blocks

try-catch

Languages without static type systems are usually called __ languages. A. reverse types B. untyped C. weakly typed D. strongly types

untyped

The bindings of ____ to storage locations is called the memory. a. names b. attributes c. values d. identifiers

values

A ____ is an object whose stored value can change during execution. a. method b. variable c. pointer d. class

variable

Functions are written in prefix form

T

___ occurs when multiple access links must be followed to arrive at a nonlocal variable

Access chaining

The __ is the memory allocated for the local objects of a procedure block. A. Call record B. Activation record C. Activation heap D. Heap record

Activation record

__ are known as actual parameters. A. Arguments B. Global variables C. Control statements D. Normal parameters

Arguments

_____ errors can occur at any moment, not necessarily in response to program code execution

Asynchronous

_____ statements transfer control to and from sequences of statements

Block

The group of actions in a procedure is called the __ of the procedure. A. Parameters B. Arguments C. Activation record D. Body

Body

If a parameter behaves as a constant value during execution, the parameter is passed __. A. By address B. By reference C. By type D. By value

By Value

If the parameter becomes an alias for the argument, the parameter is passed __. A. by reference B. by address C. by value D. by type

By reference

Pass __ copies in the parameter value, and at the end of execution, copies out the final value of the parameter. A. by value B. by reference C. by value-result D. by address

By value-result

The __ environment houses global variables. A. Calling B. Dynamic C. Defining D. Universal

Defining

The __ determines the allocation of memory. A. stack B. Environment C. Memory Manager D. Translator

Environment

A unary operator can take one or more operands

F

Alan Turing introduced the guarded if statement

F

All languages restrict expression from producing side effects

F

An expression, in its purest mathematical form, produces side effects

F

Delayed evaluation is sometimes called strict evaluation

F

Exception handlers throw exceptions

F

If-then-else is an example of a binary operator

F

A procedure communicates with its calling environment through __. A. Parameters B. Local variables C. Constants D. Shared Memory

Parameters

_____ evaluation stops once the truth value of a Boolean expression is known

Short-circuit

A _____ is executed for its side effects and returns no value

Statement

A language has referential transparency when its expression produce no side effects

T

A sentinel-based loop if often used in situations where a series of input values must be processed

T

Bracketing keywords are used in the if statement to remove ambiguity

T

Exception handling is an attempt to imitate in a programming language the features of a hardware interrupt or error trap

T

If-expression never have all of their subexpressions evaluated

T

If-operators are a special case of operators that delay evaluating their operands

T

In a case statement, no two listed cases may have the same value after conversion

T

In normal order evaluation, each operation begin its evaluation before its operands are evaluated

T

Most languages use a mix-fix form that distributes the syntax of an if-then-else operator throughout the expression

T

Synchronous errors occur in direct reaction to program execution

T

Syntactic sugar is a language construct that is completely expressible in terms of other constructs

T

When parameters are passed by value, the arguments are expressions that are evaluated at the time of the call, with all the arguments' value becoming the values of the parameters during execution of the procedure. T/F

True

When you define a procedure, the parameters you list in the interface are the formal parameters. T/F

True

Sequence operators are used to ______

allow several expression to be combined into a single expression and evaluated

Evaluating all operands before applying operators is called ____ evaluation

applicative order

In a function, the operands are viewed as ___

arguments

Ada uses a(n) ______ for its if-statements

bracketing keyword

The process of joining a block of free memory with immediately adjacent blocks to form a larger contiguous block of free memory is called ___

coalescing

In C, the _____ statement skips the remainder of the loop body and resumes execution with the next evaluation of the control expression

continue

The pointer to the previous activation record is the ___ link

control

An ambiguity in which it cannot be determined which id statement that should be associated with a single else statement is called the ____ problem

dangling - else

The ____ environment maintains the location of the current activation record

environment pointer

When an error is thrown, a(n) _____ is executed to recover normal execution

exception handler

______ are an example of implicit control mechanisms

exception handlers

Stack unwinding occurs when an exception is thrown and control is ______

exited back in search of a handler

In a(n) ___ environment, activation records are not removed as long as there are references to any of its local objects

fully dynamic

Arguments are specified for use with ____

functions

A general form for a loop construct is given by Dijkstra's structure called the _____

guarded do

The access link provides access to ___

nonlocal variables

The local variable ___ stores the distance from the environment pointer

offset

If an exception is thrown and no handler is found in the block, control is passes to the next enclosing block in a process that is called ____ the exception

propagating

Reference counting is a form of ___

reclamation of storage that is no longer referenced

If control resume at the point where the exception was the first raised, _____ model is being used

resumption

If a program crashes, it fails the ______ test

robustness

The advantage of postfix and prefix forms of expression is that ____

they do not require parentheses to express the order in which operators are applied

__ types have no name A. Generic B. Anonymous C. Variable D. User-Defined

Anonymous

__ is a term used for the type correctness of assignments. A. Assignment Linking B. Value Assignment C. Assignment compatibility D. Backwards compatibility

Assignment compatibility

Ada has a completely safe union mechanism called a variant record. T/F

True

Any scoping structure that can be referenced directly in a language must have its own symbol table. T/F

True

Binding time refers to when an attribute is computed and bound to a name. T/F

True

Casts are permitted on structured types if they have identical sizes in memory. T/F

True

Dangling references are locations that have been deallocated from the environment but can still be accessed by a program. T/F

True

Declaration visibility includes only those regions of a program where the bindings of the declaration apply. T/F

True

Explicit typing can be used to remove ambiguities in programs. T/F

True

For multidimensional arrays, the column-major form of allocation can be used only if all array indices must be specified together. T/F

True

In Ada, simple data types are called scalar types. T/F

True

In C, blocks are called compound statements. T/F

True

In C, types that are constructed using type constructors are called derived types. T/F

True

In C/C++, multidimensional array declaration must have all but the first dimension specified. T/F

True

Names can be reused within nested blocks by associating each declaration with a level number and an offset. T/F

True

Static type information allows compilers to allocate memory efficiently. T/F

True

Subset types inherit operations from their parent types. T/F

True

The lifetime of an object is the duration of its allocation in the environment. T/F

True

A pointer is an object whose stored value is a ____. a. activation record b. direction c. compound value d. reference to another object

a. reference to another object

Dynamic allocation places variables ____. a. on the heap b. in the pointer list c. on the stack d. in the symbol table

on the heap

If an operator performs more than one function it is said to be ____. a. shadowed b. implicit c. overloaded d. variable

overloaded

A data type is a(n) __? A. encoding form B. set of values C. style of storage D. group of location in memory

set of values

A variable declared locally within a block is said to ____ a global variable of the same name. a. shadow b. mirror c. occlude d. override

shadow

When a change in the value of a variable persists beyond the execution of a statement, a ____ has occurred. a. error b. side effect c. compound change d. persistent effect

side effect

Explicit conversions are often referred to as __. A. Casts B. Coercions C. Narrowing conversions D. Widening conversions

Casts

Implicit conversion are often referred to as __. A. Type leaps B. Symbolic conversions C. Interpretive conversions D. Coercions

Coercions

Type __ are used to construct complex types from basic types. A. Constructors B. Assemblers C. Checkers D. Combiners

Constructors

To obtain the value of a location in memory referenced by a pointer, the pointer must be __. A. Dereferenced B. Linked C. Evaluated D. Product

Dereferenced

The primary data structure used to represent type attributes is called a type __. A. Definer B. Descriptor C. Constructor D. Enumerator

Descriptor

Ordinal data types in Ada are called __ types. A. Simple B. Scalar C. Composite D. Discrete

Discrete

If information is maintained and checked at runtime, the checking is __. A. Dynamic B. Static C. Referential D. Inferential

Dynamic

____ binding occurs during execution a. Rapid b. Static c. Value d. Dynamic

Dynamic

__ types are set whose elements are named and listed explicitly. A. List B. Array C. Enumerated D. Simple

Enumerated

Type __ algorithms determine if two separately declared types are the same. A. Inference B. Equivalence C. Comparison D. Enforcing

Equivalence

Java uses assignment by cloning for all object variables. T/F

False

Lexical scoping rules are sometimes called dynamic scoping. T/F

False

The declaration before use scoping rule in C allows any declaration to be used as long as it is declared within the current block. T/F

False

The meaning of a name cannot be determined by the attributes associated with it. T/F

False

The most general type possible for a polymorphic function with a given implementation is called its __ type. A. General B. Base C. Principal D. Specialized

Principal

In Java, types constructed using type constructors are called __ types. A. Reference B. Simple C. Primitive D. Integral

Reference

When a structured type is cast, the translation merely __ the memory as a different type. A. Reallocates B. References C. Reinterprets D. Realigns

Reinterprets

Which of the following languages has no explicit types or translation-time typing? A. Ada B. Java C. C++ D. Scheme

Scheme

__ equivalence in type checking is when two objects are built in the same way using the same type constructors from the same simple types. A. Referential B. Simple C. Constructor D. Structural

Structural

In C, the Cartesian product type constructor is available as the __ construction. A. structure B. set C. array D. enumerator

Structure

To create a new data type that contains a subset of a known data type, the __ mechanism is used. A. subtype B. anonymous union C. intersection D. product

Subtype

Each call to a method is referred to as a ____. a. activation b. branching c. execution d. invocation

activation

In C, the ____ operator retrieves the address of a variable as a pointer. a. dereference b. allocation c. address of d. reference

address of

A ____ occurs when the same object is bound to two different names at the same time. a. duplicate b. multi-reference c. alias d. conflict

alias

In object-oriented languages such as Java and Smalltalk, the ____ is the only declaration that does not itself need to be inside another class declaration. a. file b. module c. package d. class

class

Assignment by sharing works by ____. a. accessing shared memory b. duplicating memory addresses c. copying the location of the first variable to the second d. copying the value to a new location

copying the location of the first variable to the second

In C++, declarations that bind all potential attributes are called ____. a. symbols b. prototypes c. explicits d. definitions

definitions

The bindings of names to storage locations is called the ____. a. environment b. compiler c. symbol table d. translator

environment

Language systems that automatically reclaim garbage are said to perform ____. a. recycling b. garbage collection c. memory reallocation d. memory reclamation

garbage collection

The process a translator goes through to determine whether the type information in a program is consistent is called type __ . A. Inference B. Constructing C. Equivalence D. Checking

inference

In C, the scope of a binding is limited to the block in which its associated declaration appears. This scoping rule is called ____ scope. a. lexical b. block c. package d. namespace

lexical

The ____ is the level number and offset of a declared name. a. lexical address b. explicit address c. compound address d. block address

lexical address

The body of an externally defined function will not be bound until ____. a. load time b. link time c. translation time d. execution time

link time

A ____ constant is a name for a literal. a. manifest b. static c. compile-time d. symbolic

manifest

Garbage is defined as ____. a. variables with duplicate values b. a collection of unused variables c. memory that has been allocated in the environment but that has become inaccessible to the program d. a collection of unused constants

memory that has been allocated in the environment but that has become inaccessible to the program

The scope of a binding is ____. a. the region over which the binding is maintained b. the precision of the binding c. the magnitude of the binding d. the time when the binding takes place

the region over which the binding is maintained


Set pelajaran terkait

Lesson 3 & Electrical Quantities and Ohm's Law

View Set

MGMT Ch 13 - Contract Performance, Breach, and Remedies

View Set

Neuromuscular Disorders: DMD and BMD

View Set

kjanatomy- ch. 1- 4 anatomical planes

View Set

Chapter 18: Negotiable Instruments: Transferability and Liability

View Set