Which of the following is true about the 'peek' operation?
It's a terminal operation that returns a new Stream
It's an intermediate operation that modifies the stream elements
It's a terminal operation that triggers stream processing
It's an intermediate operation primarily used for debugging
What will LocalDate.now().plusDays(1) return?
LocalDate.now().plusDays(1)
An error, as the plusDays() method does not exist.
plusDays()
The current date and time.
The date one day after the current date.
The date one day before the current date.
Which keyword is used to create a generic method in Java?
typeparam
No specific keyword is required
generic
template
Can a method be both generic and static in Java?
No, generic methods cannot be static.
Yes, but the type parameter should be declared before the method name.
Yes, but the type parameter should be declared after the 'static' keyword.
Yes, there are no restrictions.
Which List implementation in Java uses a dynamic array to store elements and provides fast access to elements by their index?
List
Vector
Stack
ArrayList
LinkedList
How can you access the value of an annotation's element at runtime?
By using the getDeclaredAnnotation() method
getDeclaredAnnotation()
By using the getAnnotation() method
getAnnotation()
By accessing the annotation element directly as a field of the annotated element
By casting the annotated element to the annotation type
What does the @Retention(RetentionPolicy.SOURCE) declaration signify for a custom annotation?
@Retention(RetentionPolicy.SOURCE)
The annotation is only applicable to source code and has no impact on compiled code.
The annotation is stored in the class file but is not available at runtime.
The annotation is discarded by the compiler and not included in the class file.
The annotation is available at runtime via reflection.
Which data structure is best suited for implementing a Last-In-First-Out (LIFO) order of elements in Java?
Map
Set
Queue
Which interface in the Java Collections Framework represents a group of objects where duplicates are not allowed?
Which method is used to forcefully stop the execution of a thread, although considered deprecated due to potential risks?
stop()
interrupt()
halt()
destroy()