Program Language Systems - Chapter 7

Program Language Systems - Chapter 7

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

What does a widening conversion do?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

5 years ago

Date created

Mar 1, 2020

Cards (53)

Section 1

(50 cards)

What does a widening conversion do?

Front

Converts a value to a type that can include at least approximations of all of the values of the original type

Back

What is the name of an operator that has three operators?

Front

Ternary

Back

What do Boolean operators take and produce?

Front

Boolean operands and Boolean values

Back

What arithmetic operations are only approximations of their mathematical counterparts?

Front

Floating-point

Back

When does a program have the property of referential transparency?

Front

if any two expressions in the program that have the same value can be substituted for one another anywhere in the program, without affecting the action of the program

Back

Arithmetic operators are often used for how many purposes?

Front

More than one

Back

What are the two types of associativity?

Front

Left and right

Back

What is the concept of referential transparency related to?

Front

Functional side effects

Back

Although widening conversions are usually safe, what can they sometimes result in?

Front

Reduced accuracy

Back

Those who would rather include a wide range of coercions are more concerned with what?

Front

The loss in flexibility that results from restrictions

Back

What are the two forms of type conversion?

Front

Widening or narrowing, explicit and implicit

Back

A relational operator is an operator that does what?

Front

Compares the values of its two operands

Back

When is operator overloading acceptable?

Front

When neither readability nor reliability suffer

Back

Where were most of the characteristics of arithmetic expressions in programming languages inherited from?

Front

Mathematics

Back

What are mixed mode expressions?

Front

When an operator can has operands of different types

Back

What is the purpose of an arithmetic expression?

Front

To specify an arithmetic computation

Back

The Boolean operators usually include those for what?

Front

AND, OR, and NOT operations, and sometimes for exclusive OR and equivalence

Back

The operation that determines the truth or falsehood of a relational expression depends on what?

Front

The operand types

Back

What are the fundamental means of specifying computations in a programming language?

Front

Expressions

Back

What are some issues in expression semantics?

Front

Type mismatches, coercions, and short-circuit evaluation

Back

Those against a broad range of coercions are concerned with what?

Front

The reliability problems that can result from such coercions

Back

In all of the common imperative languages, where can the unary minus operator appear in an expression?

Front

Either at the beginning or anywhere inside the expression

Back

What dictates the order of evaluation of its operators?

Front

Operator precedence and associativity rules of a language

Back

When the two operands of an operator are not of the same type and that is legal in the language, what must the compiler do?

Front

The compiler must choose one of them to be coerced and supply the code for that coercion

Back

What is the name of an operator that has a single operand?

Front

Unary

Back

What are two possible solutions to the problem of operand evaluation order and side effects?

Front

First, the language designer could disallow function evaluation from affecting the value of expressions by simply disallowing functional side effects. Second, the language definition could state that operands in expressions are to be evaluated in a particular order and demand that implementors guarantee that order.

Back

How are variables in expressions evaluated?

Front

By fetching their values from memory

Back

What is the operator evaluation order of expressions is dictated by?

Front

The associativity and precedence rules of the language

Back

What is a short-circuit evaluation of an expression?

Front

One in which the result is determined without evaluating all of the operands and/or operators

Back

What is the most important advantage to referentially transparent programs?

Front

That the semantics of such programs is much easier to understand than the semantics of programs that are not referentially transparent

Back

What are the operator precedence rules for expressions are based on?

Front

The hierarchy of operator priorities, as seen by the language designer

Back

What does a narrowing conversion do?

Front

Converts a value to a type that cannot store even approximations of all of the values of the original type

Back

What is the name of an operator that has two operands?

Front

Binary

Back

What is operator overloading?

Front

The multiple use of an operator

Back

The relational operators always have _______ precedence than the arithmetic operators.

Front

Lower

Back

Why are programs written in pure functional languages referentially transparent?

Front

Because they do not have variables

Back

A relational expression has how many operands and operators?

Front

Two operands and one relational operator

Back

If the language requires type checking, either static or dynamic, what errors cannot occur?

Front

Operand type errors

Back

What is it called when when the result of an operation cannot be represented in the memory cell where it must be stored?

Front

Overflow or underflow, depending on whether the result was too large or too small

Back

What is an infix operator?

Front

A descriptor for operators that appear between their operands

Back

What is the purpose of assignment statements?

Front

To cause the side effect of changing the values of variables, or the state, of the program

Back

How can programmers alter the precedence and associativity rules?

Front

By placing parentheses in expressions

Back

When does a a functional side effect occur?

Front

When the function changes either one of its parameters or a global variable

Back

Boolean expressions consist of what?

Front

Boolean variables, Boolean constants, relational expressions, and Boolean operators

Back

The value of a relational expression is what?

Front

Boolean, except when Boolean is not a type included in the language

Back

Floating-point overflow, underflow, and division by zero are examples of what kinds of errors?

Front

Run-time errors, which are sometimes called exceptions

Back

The value of an expression depends at least in part on what?

Front

The order of evaluation of the operators in the expression

Back

The most common error in expressions occurs when what happens?

Front

The result of an operation cannot be represented in the memory cell where it must be stored

Back

What is the essence of the imperative programming languages?

Front

The dominant role of assignment statements

Back

What are type conversions explicitly requested by the programmer are called what?

Front

Explicit conversions, or casts, NOT coercions

Back

Section 2

(3 cards)

What is a compound assignment operator?

Front

A shorthand method of specifying a commonly needed form of assignment

Back

Nearly all programming languages currently being used use the what sign forthe assignment operator

Front

Equal

Back

What is the disadvantage of allowing assignment statements to be operands in expressions?

Front

It provides yet another kind of expression side effect

Back