Tuesday, February 3, 2015

Chapter 7 : Review Question

Q6 : What associativity rules are used by APL?
A    : In APL, all operators have the same level of precedence. Thus, the order of evaluation of operators in APL expressions is determined entirely by the associativity rule, which is right to left for all operators.

Q7 : What is the difference between the way operators are implemented in C++ and Ruby?
A    :The difference is in Ruby, all the arithmetic, relational, and assignment operator, as well as array indexing, shifts, and bitwise logic operators, are implemented as methods. While in C, they aren't implemented as methods.

Q8 : Define functional side effect.
A : functional side effect is a side effect of a function which occurs when the function changes either one of its parameters or a global variable.

Q9 : What is a coercion?
A : A coercion is a process by which a compiler automatically converts a value of one type into a value of another type when that second type is required by the surrounding context.

Q10 : What is a conditional expression?
A : *A conditional expression is an expression that returns value A or value B depending on whether a Boolean value is true or false. A conditional expression lets you write a single assignment statement that has the same effect as the following:
if condition:
    x = true_value
else:
    x = false_value

No comments:

Post a Comment