17 - Expressions Flashcards

(28 cards)

1
Q

refers to the means of specifying computations in a program

A

expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

operators can be (3)

A
  1. unary (single operand)
  2. binary (two operands)
  3. ternary (three operands)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

types of expressions (3)

A
  1. arithmetic
  2. relational
  3. boolean
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

on types of expressions:

used to specify mathematical computations

A

arithmetic expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

on types of expressions:

used to compare two values

A

relational expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

on types of expressions:

used for boolean operations and may sometimes require operands to be of boolean type

A

boolean expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

design issues of expressions (4)

A
  1. operator evaluation order
  2. operand evaluation order
  3. operator overloading
  4. type conversions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

on design issues of expressions:

partially define what order the operators would be executed

A

operator evaluation order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

on design issues of expressions:

defines which use of variables in the expression create a side-effect

A

operand evaluation order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

occurs when a subprogram changes the value of an operand that will be used later in the expression

A

side-effect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

solutions to side-effect (2)

A
  1. disallow functions to have expressions that might cause side-effects
  2. have an order when expressions are to be evaluated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

on design issues of expressions:

operators having multiple uses

A

operator overloading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

on design issues of expressions:

whether we should allow a programmer to define a different operation for an operator

A

operator overloading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

on design issues of expressions:

are values allowed to be converted

A

type conversions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

conversion to a type that can store all approximations of the original type

A

widening conversion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

conversion to a type that cannot even store approximations of the original type

A

narrowing conversion

17
Q

type of conversion that is done by the compiler based on the operand types

A

implicit type conversion (coercion)

18
Q

type of conversion that is requested by the programmer

A

explicit type conversion (typecast)

19
Q

types of conversion (4)

A
  1. widening conversion
  2. narrowing conversion
  3. implicit type conversion (coercion)
  4. explicit type conversion (typecast)
20
Q

happens when the result is determined without completely evaluating the expression

A

short-circuit evaluation

21
Q

allows the programmer to dynamically change the binding of values to variables

A

assignment statements

22
Q

types of assignment statements (5)

A
  1. simple assignment
  2. conditional targets
  3. compound assignment
  4. unary assignment
  5. multiple assignments
23
Q

what type of assignment statement is shown below?

number = 124

A

simple assignment

24
Q

what type of assignment statement is shown below?

if flag:
    a = 0
else:
    b = 0
A

conditional targets

25
what type of assignment statement is shown below? count += 1
compound assignments
26
what type of assignment statement is shown below? count++;
unary assignments
27
what type of assignment statement is shown below? a, b = "Hello", 124
multiple assignments
28
in some languages, assignment statements return the __ assigned to the variable
value