Question
7. Which statement is wrong? (A) In Ruby, all of the arithmetic, relational, and assignment operators, as well as array indexing, shifts, and bitwise logic
7. Which statement is wrong? (A) In Ruby, all of the arithmetic, relational, and assignment operators, as well as array indexing, shifts, and bitwise logic operators, are implemented as methods (B) In Lisp, all arithmetic and logic operations are performed by subprograms. (C) In Lisp, a C expression x + y * z must be written as the following expression: (+ x (* y z)) (D) In Ruby, if-then-else statements can be used to perform a conditional expression assignment.
8. Given the code in C below: int a =10; int fun() { .... return 5; } void main() { a = a - fun(); } which statement is wrong? (A) If the function fun() changes the value of a, a side effect occurs. (B) If no side effect, the value of a in the main() will be 5. (C) If the function fun() changes the value of a to a = 4 and the function call is evalued first, the value of a in the main() will be -5. (D) (C) If the function fun() changes the value of a to a = 14 and the variable a is evalued first, the value of a in the main() will be 5.
9. Which statement is wrong? (A) A program has the property of referential transparency if any two expressions having the same value can be substituted for one another anywhere in the program, without affecting the action of the program. (B) The value of a referentially transparent function depends entirely on its returned value. (C) Using the same symbol for two completely unrelated operations is detrimental to readability. (D) The simple keying error can be undetected by the compiler; such an error may be difficult to diagnose.
10. Which statement is correct? (A) converting a double to a float in Java is a widening conversion (B) if the floating-point value 1.3E25 is converted to a double in a Java program, the result will not be safe. (C) converting an int to a float in Java is a widening conversion. (D) integer-to-floating-point widening can result in the loss of four digits of precision.
11. Which statement is correct? (A) Type conversions implicitly requested by the programmer are referred to as casts. (B) In Ada, the exponentiation operator, **, can only take an integer type for the 1st operand and an float type for the 2nd operand (C) ML and F# always coerce operands in expressions. (D) In Java, operands of byte and short types are coerced to int whenever virtually any operator is applied to them.
12. Which statement is wrong? (A) A relational operator compares the values of its two operands. (B) A relational expression has two operands and one relational operator. (C) The value of a relational expression must be Boolean. (D) The syntax of the relational operators for equality and inequality differs among some programming languages.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started