Which keyword is used to declare a class that cannot be instantiated but serves as a blueprint for other classes?
final
abstract
interface
static
Which of the following is NOT a valid way to create a Stream in Java?
new Stream()
list.stream()
Stream.of(1, 2, 3)
Arrays.stream(array)
What is the time complexity of retrieving an element from a HashSet in Java, assuming the hash function distributes elements evenly?
O(log n)
O(n log n)
O(n)
O(1)
What is the time complexity of searching for an element in a well-implemented HashMap in the average case?
HashMap
What is the purpose of the StringBuilder class in Java?
StringBuilder
To efficiently build mutable strings.
To perform regular expression matching.
To store large text files.
To create immutable strings.
Which method is used to add elements to the end of a Queue in Java?
Queue
add()
push()
offer()
insert()
In the java.time API, which class represents a specific point in time, such as a timestamp?
java.time
LocalDateTime
LocalDate
LocalTime
Instant
Which interface must a class implement to be eligible for serialization in Java?
Serializable
Cloneable
Parcelable
Iterable
Which method is used to convert a Stream back to a List?
reduce(Collectors.toList())
collect(Collectors.toList())
map(Collectors.toList())
filter(Collectors.toList())
Which interface is used to create a type-safe heterogeneous container in Java?
Comparable
Iterator
Collection