• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/181

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

181 Cards in this Set

  • Front
  • Back

During the evaluation of a function, the value of the parameter

cannot change throughout the evaluation

A scheme lambda function that returns the cube of its first argument less the square of its second would be

(LAMBDA (x, y) (- (* x x x) (* y y) ) )

If a language treats functions the same way it treats data, then functions are said to be

first-class entities

One of the main reasons that functional languages have not had the success that imperative languages have enjoyed is that

imperative languages are much more strongly matched to the capabilities of the underlying hardware

Assuming n is a positive integer, what is returned by (define (fib n) (if (= n 1) n (* n (fib (- n 1) ) ) ) )?

the factorial of n

Scheme language requires that ( ) functions be converted to iterative implementations

tail-recursive

The EVAL function, by itself, serves as

a LISP interpreter

A function that returns a Boolean value is known as

a predicate function

The basic data structure in LISP/Scheme?Racket is

the cons cell

What will be the result of (cons (list (cons 1 2) 3 4 ) 5) ?

( ( (1 . 2) 3 4) . 5)

A nameless function is known as

a lambda function

A function that can take a function as an argument and/or return a function as its result is known as

a higher-order function

Iteration is implemented in a functional language via

recursion

If a function always returns the same value, given the same parameters (and has no side effects), it is said to be

referentially transparent

The three flow control mechanism provided by Scheme are

IF, COND, and recursion

The name used to describe having multiple ways to accomplish the same task is

feature multiplicity

When there are few restrictions on how primitive constructs can be combined, the language is said to be

orthogonal

Which of the following are the three primary categories of languages, per the author?

imperative, functional, and logical

A general observation that is true more often than not regarding language design decisionsis that

improvement in one area often requires sacrifice in another.

When two or more identifiers access the same memory cell, this is known as

aliasing.

The smallest parts of a language, such as operators, special words, numeric values, arecalled

lexemes.

Categories of lexemes are called

tokens.

The 'syntax' of a programming language is

the form of its expressions, statements, and program units.

The 'semantics' of a programming language is

the meaning of its expressions, statements, and program units.

The language described by a grammar

is independent of the manner (order) in which rules are applied.

A language recognizer performs what task?

Answers the question of whether a particular sentence is a member of a particularlanguage.

A parser performs what task?

Creates a hierarchical description of the grammatical structure of a sentence.

A lexer performs what task?

Reduces a sentence into a stream of tokens.

A context free grammar imposes precedence of operators by placing

lower precedence operators closer to the Start symbol in the production chain.

The strings that can be produced by a language are called

sentences.

The rules of a context free grammar are known as

productions.

Which of the following is NOT a trait of identifiers in most programming languages?

The name may contain digits in any position.

A language is considered ambiguous if

a given sentence can be represented by two different parse trees.

The production: "Bob: Sue op Bob" enforces

right associatively of Bob.

A "terminal" in a grammar is

an element consisting of a token or literal lexeme.

Which is NOT true regarding the "dangling else" (a.k.a. "else-association") problem?

This is inherently ambiguous in any language that does not have an "end-if" orequivalent keyword.

Which of the following is NOT a reason given by the author for studying the concepts ofprogramming languages?

Improved ability to understand poorly written code.

The main reason that no single language has come to dominate all of programming is that

language selection criteria are largely self-contradictory and highly context dependent.

What is the principal problem with left-recursive productions?

Some important syntax analysis algorithms cannot be used with grammars containing suchproductions.

Which of the following is not a primary criterion, per the author, for selecting aprogramming language?

Scalability.

The name used to describe having multiple ways to accomplish the same task is

feature multiplicity.

When there are few restrictions one how primitive constructs can be combined, the languageis said to be

orthogonal.

Which language category is generally the most influenced by the underlying hardwarearchitecture?

Imperative.

When complicated data structures and operations can be built that allow the underlyingdetails to be ignored when used is an example of

abstraction.

The reliability of a program is significantly affected by all but which of the following?

An optimizing compiler.

The total cost of a programming language is a strong function of all of the following except

the ability to run the same executable on different operating systems.

Much of the evolution in program language design has been motived by the

shift in the major cost of computing from hardware to software.

Which of the following is NOT true about programming language needs at the present time

computing power has reached a point that unsafe languages such as C should never beused for new code.

The use of purely interpreted languages has seen a comeback in recent years in part because

the processing speed and memory available to support interpretation has improveddramatically.

The use of intermediate code running on a virtual machine greatly facilites

platform portability.

Which type of variable has the storage binding and lifetime normally associated with"automatic" variables?

Stack-dynamic.

The use of functions such as malloc() and free() are used with which type of variable?

Explicit heap-dynamic.

The term "static" generally implies

that the associated attribute is known prior to runtime and does not change once theprogram has started running.

The term used to describe the specification of a variables type and other attributes notincluding storage allocation is

declaration.

The term used to describe the specification of a variables type and other attributesincluding storage allocation is

definition.

Which of the following is NOT true: Compared to dynamicly scoped languages, staticallyscoped languages

require fewer parameters to be passed to functions.

The referencing environment of a statement is

the collection of all variables that are visible in that statement.

Which of the follow is NOT a means that was discussed for how a language might determinevariable type?

Value of a leading digit in the variable name.

Which of the following is NOT true of dynamic type binding?

Type checking must be done at compile time.

What is a reserved word in a language definition?

A word that, although otherwise valid, cannot be used as a name (variable or function).

The attributes that are bound to a variable are

name, address, value, type, lifetime, and scope.

The address of a variable is sometimes called its

lvalue.

Decimal data types are intended to

store decimal values, including fractional values, exactly over some range.

A reference to a substring is typically called a

slice.

Which of the following is NOT an ordinal type?

string

Signed integer data types most typically use which of the following internal representations?

Twos complement.

An array in which the binding of both the subscript range and memory allocation occursbefore execution is a

static array.

When two operators of the same precedence are adjacent in an expression, evaluation isperformed

according to the associativity of the operators.

Most programming languages use which ordering notation for binary operations?

infix.

What is a "side effect"?

When the evaluation of an expression changes the value of a variable.

What is "referential transparency" refer to?

When any two expressions that produce the same value can be substituted for each otheranywhere in a program.

What is an alias?

One or more additional variable names that refer to the same memory location.

When variables are bound to a type through default conventions, this is known as

implicit declaration.

When a variable is assigned a type based on the context of it use, this is known as

type inference.

In most languages, variables that are local to functions have what kind of storage binding?

Stack-dynamic.

The scope of a variable is

the range of statements in which the variable is visible.

What distinguishes static (lexical) scoping from dynamic scoping?

Static scoping can be determined prior to execution while dynamic scoping can only bedetermined at run time.

A data type can be described as

a collection of data values and a set of predefined operations on those values.

The type system of a programming language does all of the following except

restricts the programmer to using only predefined types that have been marked safe.

Primitive data types

are those data types that are not defined in terms of other data types.

Which of the following statements regarding string data types is true.

String data types vary significantly from one language to another.

How is the length of a string determined in the C programming language?

A sentinel value, null, is placed in an array after the last character in the string.

An enumeration type is generally

a set of named constants.

The following are all significant design issues for arrays except:

Should array elements be homogeneous (i.e., all of the same type)?

A type who variables may store different data types at different times is known as a

union.

What is a "dangling pointer"?

A pointer that refers to a heap-dynamic variable that has been deallocated.

What does "lost memory" refer to?

A block of allocated memory that is no longer accessible to a user program.

Floating point data types most typically use which of the following internal representations?

IEEE-754

Which of the following statements is NOT true regarding operator overloading:

Overloaded operators always operate on user-defined data types.

A type conversion to a type that cannot store even approximations of all of the values ofthe original type is

a narrowing conversion.

Implicit type conversions performed transparently by the compiler are referred to as

coersions.

Errors such as overflow, underflow, and division by zero, are

called run-time errors or exceptions.

Relational operators

are almost always of a lower precedence than the arithmetic operators.

In C, if a=6, b=4, and c=2, the result of evaluating a < b < c will be

1

Short-circuit evaluation is when

an operand of an expression may not be evaluated if the expression result can bedetermined by the other operand.

In C, the statement a=b+c=d+e will produce the same result as

this is a syntax error in C.

The C statement a=(b=c)?3:2; will result in what value assigned to 'a' if b=0 and c=0?

3

Compound assignment operators

are a shorthand method of specifying common used expressions.

An assignment statement with a conditional target means that

the variable that a value is assigned to depends on the evaluation of an expression.

Mixed-mode assignments that disallow narrowing coersions

increase the reliability of a language.

A function prototype in C/C++ is another term for a function's

declaration.

In object-oriented languages, a "method" generally refers to a subprogram that is

called from an instance of class and has access to all of that instance's data.

A generic subprogram is one whose

computation can be done on data of different types in different calls.

A 'closure' is a

nested subprogram combined with its referencing environment.

Which of the following parameter passing schemes ensures that the subprogram is notcapable of changing variables seen by the caller?

pass-by-value

Which of the following parameter passing schemes gives gives rise to issues associatedwith aliases?

pass-by-reference

Which parameter passing scheme is often used by compilers for generic parameters but isotherwise not part of any widely used modern langauges.

pass-by-name

Because C uses row-major array indexing, which of the following is a workable headerfor passing an 20-row, 10-col array to a function?

void fun(int matrix[][10]) {...}

The method of establishing the referencing environment for nested subprograms instatically-scoped languages is almost always

deep binding.

In C/C++, it is possible to pass functions as arguments to functions through the use of

function pointers.

An activation record is a data structure that holds all but which of the followinginformation about a function call?

Static local variables.

An activation record is almost always located

on the function call stack.

In an activation record, the pointer to the base of the activation record of the calleris known as

a dynamic link.

In an activation record, the pointer to the base of the activation record for the mostrecently called lexical parent of the called program is known as

a static link.

In an activation record, the location in the code at which to resume execution once thecalled program terminates is known as

the return address.

What is the only difference, in terms of the activation record instances, when asubprogram makes a recursive call to itself?

There is no difference

The dynamic link, in static-scoped languages, is used to

provide traceback information when a run-time error occurs.

The dynamic link, in dynamic-scoped languages, is used to

access nonlocal variables.

The static link, in static-scoped languages, is used to

access nonlocal variables.

Which element is not needed in an activation record when subprograms cannot be nested?

A static link.

Blocks (compound statements) that provide user-specified local scopes can beimplemented as

parameterless nested subprograms, even in languages that don't support nestedsubprograms.

Blocks within a subprogram can be implemented

by including any block variables as part of the subprogram's set of local variables onthe stack

Dynamic scoping that is implemented via tracing through the activation records for thenearest instance of a variable name is known as

deep access.

Dynamic scoping that is implemented via maintaining a separate stack for each namedvariable is known as

shallow access.

A "central table" is one alternative method of implementing

shallow access.

In most languages, when a function terminates the caller sees the return value

on top of the stack.

The semantics of the call to a "simple" subprogram (no nesting and only static localvariables) require all of the following actions except

saving the execution status of the current program unit.

The semantics of the return from "simple" subprogram (no nesting and only static localvariables) require all of the following actions except

deallocating memory on the stack for the local variables.

In some processors, particularly RISC processors, subprogram parameters are not passedon the stack but, instead, via

processor registers.

A subprogram is 'active'

from the time it is called until the time it terminates.

Deep access and shallow access

are two different ways of implementing the same access semantics for non-localvariables in a dynamically-scoped language.

The two-way selection statement is commonly known as

the if-then-else structure.

The ambiguous-else (or dangling-else) problem is generally resolved by what rule?

each 'else' clause is paired with the most recent unpaired 'if' expression.

The multiple selection statement is commonly known as

the switch structure.

When control flows from one case label to the next, this is known as

flow-through.

In C, if a switch expression does not have a 'default' case, then

the entire construct is skipped if none of the case labels match the expression.

Which of the following is NOT true regarding switch statements in C:

case labels can cover a range of values.

Iterative statements are broadly categorized as belong to one of which two categories?

Counter-controlled and Logically controlled.

In C, which of the following is true of the looping constructs?

Any loop that can be written using one construct can be implemented using either of theremaining constructs.

With the C 'for' statement, which of the following statements is NOT true?

An infinite loop results if the 'for' header's the test expression (the middleexpression) is left out.

What is perhaps the single strongest reason that the 'break' statement is includedinstead of using a 'goto' statement?

The 'goto' statement is highly unstructured while the 'break' statement's restrictionskeep the code readable.

Most modern languages still include a 'goto' statement (or equivalent) for what reason?

There are situations in which the judicious use of a 'goto' statement is reasonable andremains readable.

In addition to sequences, what two control structures are absolutely required toexpress computation?

Selection and pre-test loops.

Data-based control structures designed to execute the loop body one time for each data element are generally known as

iterators.

In many processors, particularly simple ones, all of the control structures in alanguage are ultimately implemented using

conditional and unconditional branch (i.e., goto) instructions.

Why do most languages include more control statements than are absolutely required forcompleteness?

Readability and writability.

The method used by some languages to eliminate the ambiguous-if problem syntacticallyis to require

the use of a reserved word to close the selection entity explicitly.

In pure functional programming languages, counter controlled loops are generallyimplemented

using recursion.

Hardware support for looping structures is problematic in practice because

hardware design and language design are difficult to coordinate over a sufficientlylong time.

Which of the following statement concerning goto statements is false?

Since all hardware architecture is based on conditional and unconditional branches, allmodern languages support the goto statement.

Except for coroutines, subprograms in modern languages generally have all of the following characteristics except:

a single exit point.

The general distinction between a "procedure" and a "function" is that

functions return values while procedures do not.

The parameters in a subprogram header are called

formal parameters.

In most languages, formal and actual parameters are bound together by

position.

The referencing environment of a subprogram

is the collection of variables that can be accessed by statements within that subprogram.

A subprogram's local variables are generally either

static or stack-dynamic.

Which parameter passing scheme is also known as pass-by-copy?

Pass-by-value-result

Which parameter passing scheme is primarily used for situations in which no values need be passed to the subprogram, but rather only values need to be passed back to the caller?

Pass-by-result

Most parameter passing schemes are implemented via

the function call stack.

Ensuring that formal and actual parameters are consistent is the role of

type checking.

In most languages, when a function terminates the caller sees the return value

on top of the stack.

Dynamic scoping that is implemented via tracing through the activation records for thenearest instance of a variable name is known as

deep access.

The act of creating an abstract data type and hiding its implementation details isgenerally referred to as

encapsulation.

An abstract data type includes

a representation of the data as well as the processes that act upon that data.

A primary motivator for data abstraction is to

manage complexity.

The problem of different programmers calling their methods or classes the same thing ismitigated through the use of

namespaces.

To qualify as an abstract data type, all of the following must be true except:

the internal representation must be clearly defined and documented.

When access to internal data members is needed, accessor methods (getters and setters) areused for all of the following reasons except.v

accessor methods provide fast, efficient access to data members without the functioncall overhead that would otherwise be involved.

The act of creating an abstract data type and hiding its implementation details isgenerally referred to as

encapsulation.

An abstract data type includes

a representation of the data as well as the processes that act upon that data.

What is an 'abstraction'?

A representation that includes only the most significant parts.

A functions or procedure can generally be classified as a

process abstraction.

Most floating-point data types qualify as an abstract data type for all of the followingreasons except:

the data type has been standardized as part of the IEEE-754 floating point standard.

The name that is usually used to describe subprograms that are only accessible to othersubprograms that are part of the same abstract data type is

private.

The name that is usually used to describe subprograms that are accessible to subprogramsthat use an abstract data type is

public.

In object-oriented terminology, a 'method' is a subprogram

that is specific to a class and can only be invoked via an instance of an object of

A 'constructor' is a method that

is called whenever a new instance of a class object is created.

A 'destructor' is a method that

is called whenever an instance of a class object is deleted.

Destructors are rarely used in C# because

the use of garbage collection makes the timing of when a destructor is executedunpredictable.

The purpose of having parameterized abstract data types is

to allow a generically defined data type be able to handle actual data of various types.

What is a reserved word in a language definition?

A word that, althoughotherwise valid, cannot be used as a name (variable or function).