Which keyword is used to declare a class that cannot be instantiated but serves as a blueprint for other classes?
final
static
interface
abstract
Which of these is NOT a valid retention policy for a custom annotation in Java?
DEPLOYMENT
RUNTIME
CLASS
SOURCE
Which annotation is used to indicate that a method from a superclass is being overridden?
@Override
@OverrideMethod
@Overload
@Implement
Which interface in the Java Collections Framework represents an ordered collection of elements, allowing duplicates?
Queue
Set
Map
List
Which type of collection is inherently thread-safe and specifically designed for concurrent access in Java?
HashSet
ArrayList
TreeMap
ConcurrentHashMap
Which of the following is true about the 'peek' operation?
It's a terminal operation that triggers stream processing
It's a terminal operation that returns a new Stream
It's an intermediate operation primarily used for debugging
It's an intermediate operation that modifies the stream elements
Which method in the String class is used to compare two strings lexicographically ignoring case?
String
compareToIgnoreCase()
equalsIgnoreCase()
compareTo()
equals()
What is the difference between StringBuilder and StringBuffer in Java?
StringBuilder
StringBuffer
StringBuilder is mutable, StringBuffer is immutable.
There is no difference, they are aliases for the same class.
StringBuilder is thread-safe, StringBuffer is not thread-safe.
StringBuilder is not thread-safe, StringBuffer is thread-safe.
Which List implementation in Java uses a dynamic array to store elements and provides fast access to elements by their index?
Vector
LinkedList
Stack
What type of inner class is defined without a name and is typically used for creating one-off event handlers?
Local class
Static inner class
Nested class
Anonymous class