Top

Language Fundamentals - General Questions

11.

Whenever the "&&" operator is used, such as in:
exp1 && exp2
where exp1 and exp2 are boolean expressions, both the boolean expressions are not always evaluated.

Answer: A

If the first expression is false, the result of the "&&" operation will always be false regardless of the second expression. The "&" operator on the other hand forces the evaluation of the second expression even if the first expression is false.

Enter details here

12.

consider the statement "x = (a > b) ? a : b"; then the value of x is 27, if a = 18 and b = 27.

Answer: A

the statement is equivalent to: if (a > b) x = a; else x = b;

Enter details here

13.

The operations y >> 3 and y >>> 3 produce the same result when y > 0.

Answer: A

The shift operation "y1 >>> y2" is identical to "y1 >> y2" for all positive values of y1. It shifts the bits in y1 to the right by y2 positions.

Enter details here

14.

All bitwise operations are carried out with the same level of precedence in Java.

Answer: B

All operations in Java, including the bitwise operations, are carried out with a definite precedence.

Enter details here

15.

Declarations must appear at the start of the body of a Java method.

Answer: B

They can appear anywhere within the body of the method.

Enter details here

Loading…