Boolean Logic & Conditional Statements
What outcome can be expected from invoking .equals()
on a custom class without overriding it from Object class?
It will cause a compile-time error unless .equals() has been explicitly implemented.
Instances with identical field values will always return true upon comparison with .equals().
It will check for reference equality between two instances of a class rather than logical content equality.
It will compare all fields within both objects to ensure complete content equality.
If you need to frequently compare and insert objects while maintaining their natural order without additional sorting steps, which data structure is most suitable?
Vector
PriorityQueue
TreeMap
HashSet
What is returned by compareTo when the calling String object comes before the argument lexicographically?
A negative integer
False
A positive integer
True
What will be the result when calling x.equals(y)
given that x
and y
reference different instances of an object with identical state?
SAME INSTANCE ADDRESS
DIFFERENT INSTANCE STATES
Potential true if equals has been overridden appropriately.
FALSE
For what scenario is a PriorityQueue most appropriate when working with a collection of comparable objects needing dynamic retrieval based on priority?
When we need constant-time lookup based on an identifier key-value pair relationship.
When insertion order must be retained and duplicates are allowed within the collection.
When rapid iteration over non-ordered unique elements is required throughout the processing lifecycle.
When objects must be processed based on some priority rather than insertion order.
What principle best explains why having public methods accessing private fields within a class enhances encapsulation?
Polymorphism is less effective as it requires classes to share common properties.
Implementing interfaces allows for multiple inheritance of types by enabling a class to implement multiple interfaces.
Modularity segregates functionality into distinct sections but doesn't necessarily conceal data within those sections.
Information hiding ensures internal data representation remains concealed while allowing controlled external interaction through public interfaces.
When sorting a list of objects implementing Comparable with inconsistent compareTo logic, which behavior is likely observed?
An ArrayIndexOutOfBoundsException occurs during sorting.
Sorting will result in ascending numerical order based on object hashes.
The sort order may appear random or violate transitivity.
All elements will be considered equal by the sorting algorithm.

How are we doing?
Give us your feedback and let us know how we can improve
What does the equals() method do?
It checks if two objects have the same characteristics.
There is no such method.
It compares whether two objects refer to the same exact object.
It checks if two objects are different instantiations.
In Java, if two objects of the same class have different instance variable values, how does the equals()
method determine if they are equal?
It compares the contents of the objects based upon conditions defined within the equals()
method.
It verifies that both objects have exactly identical code in their class definitions.
It counts the total number of variables and methods to ensure they match between objects.
It checks whether both objects occupy the same location in memory.
What result can be expected when calling .compareTo()
on a String object if it comes lexically before another String being compared?
Zero
Exception thrown due to lexicographical order mismatch
Negative integer value
Positive integer value