The == operator can be used to compare two String objects. The result is always true if the two strings are identical.
Answer: B
String objects must be compared using the "equals" method of one of the objects. Food for thought: will the == operator ever return true when two string objects are compared using it?
Objects of a subclass can be assigned to a super class reference.
Answer: A
Objects of a super class may not be assigned to a sub class reference. Food for thought: why is it so?
Objects of a super class can always be assigned to a subclass reference.
Answer: B
Objects of a subclass may be assigned to a super class reference. Food for thought: is there a loss in functionality when this is done?
An individual array element from an array of type int, when passed to a method is passed by value.
Answer: A
Individual elements of an array of this type are passed by value as a parameter to a method. Any changes to them in the method will not change the value of the array element
An array in the Java programming language has the ability to store many different types of values.
Answer: B
All elements of an erray must be of the same type. However, it is possible to declare an array of objects, which may of instances of different classes.
Variables declared inside a for loop are limited in scope to the loop.
Answer: B
Any variable declared within a block statement such as a for or if cannot be referenced outside the block.
For the [removed]y >= z && a == b) to be true, at least one of (y >= z) and (a == b) must be true.
Answer: B
For the result of a "&&" operation to be true, both operands must be true.
A break statement must always be present in the default case of a "switch" selection structure.
Answer: B
The break statement, which brings the computation out of the "switch" selection structure, is not required for the defalut case.
The "switch" selection structure must end with the default case.
Answer: B
The default case in a switch structure is optional and only used when none of the other cases match.
The [removed]y >= z && a == b) is evaluated by first evaluating the expression y >= z, and then evaluating a == b.
Answer: B
If y >= z is false, then there is no need to evaluate the second expression.