Programming Languages Chapter 7 Review

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What operator usually has left associativity?

+

What is a cast?

an explicit conversion of data types of operands by programmers

What is a mixed-mode expression?

an expression that allows its operand to have different types

In JavaScript, what is the difference between == and ===?

== commits coercion between the operands but === does not.

Define narrowing and widening conversions.

A narrowing conversion converts a value to a type that cannot store even approximations of all of the values of the original type. A widening conversion converts a value to a type that can include at least approximations of all of the values of the original type.

How do parentheses affect the precedence rule?

A parenthesized part of an expression has precedence over its adjacent unparenthesized parts.

What is short-circuit evaluation?

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

What is an infix operator?

An operator that appears in between their operands.

What is an overloaded operator?

An operator that has more than one use.

What is a unary operator?

An operator with a single operand

Give a solution to the problem of operand evaluation order and side effects.

Disallowing functional side effects or causing the language definition to state that operands in expressions are to be evaluated in a particular order and demand that implementors guarantee that order

What is the difference between the way exponentiation operators are implemented in Fortran and Ruby?

Exponentiation in Fortran and Ruby is right associative, so in the expression

How does operand evaluation order interact with functional side effects?

If there is no functional side effect, the order of evaluation doesn't matter. But if there exist functional side effect, it may change the value of operands that change the value of expression

What associativity rules are used by Java?

Left to right.

What mixed-mode assignments are allowed in ML?

ML doesn't allow mixed mode assignments at all!

Define operator precedence and operator associativity.

Operator precedence determines which operator would be evaluated first if they were all in the same expression. Associative can be left or right and determines which operator would be evaluated first if operators with the same precedence were next to each other.

What two languages include multiple assignments?

Perl and Ruby

What is the associativity of C's unary arithmetic operators?

Right to left

How is referential transparency related to functional side effects?

Side effects violate referential transparency

What is the purpose of a compound assignment operator?

To act as a shorthand method of specifying the form of assignment where the destination variable also appears as the first operand in the expression on the right side.

When do we call operators "adjacent"?

We call operators "adjacent" if they are separated by a single operand.

What is one possible disadvantage of treating the assignment operator as if it were an arithmetic operator?

it provides yet another kind of expression side effect

What mixed-mode assignments are allowed in Java?

mixed-mode assignment in which the required coercion is widening

What are the advantages of referential transparency?

semantics of programs are much easier to understand being that functions are equivalent to a mathematical function.


संबंधित स्टडी सेट्स

Chapter 10 : Human Resource Management

View Set

Lean six sigma Green belt test questions

View Set

Verbs in the Active and Passive Voice

View Set

Biology 1010: Final Exam Study Guide

View Set

BUSI 332 Chapter 13, BUSI 332 Chapter 14, BUSI 332 Chapter 15, BUSI 332 Chapter 16

View Set

Chapter one POS American Government

View Set