What keyword is used to declare a variable that cannot be reassigned after initialization?
final
Name the four pillars of Object‑Oriented Programming (OOP)
Encapsulation, Abstraction, Inheritance, Polymorphism
This interface represents a collection that maintains elements in the order they were inserted
List
What is the term for a method that is shared by multiple threads?
Synchronization
What does JVM stand for?
Java Virtual Machine
What will be the output?
System.out.println("5" + 3);
53
What keyword refers to the immediate parent class and is used to access parent class methods or constructors?
super
Which collection stores unique elements and does not allow duplicate values?
Set/Hashset
Which interface should be implemented to create a task for a thread in Java?
Runnable
What is the term for the process that reclaims memory used by objects no longer in use?
Garbage Collection
What is the difference between == and .equals() when comparing strings?
== checks reference equality,
.equals() checks value equality
Which OOP principle allows a class to have more than one method with the same name, but different parameters?
Overloading
Which java collection type stores key-value pairs without allowing duplicate keys?
Map/HashMap
What method is called to start a thread in Java?
start()
What JVM feature allows you to run Java programs on different hardware architectures and operating systems without modification?
Bytecode
What is the output of this code?
int[] arr = {1, 2, 3};
System.out.println(arr[3]);
ArrayIndexOutOfBoundsException
What is it called when a subclass provides a specific implementation of a method that is already defined in its superclass?
Overriding
Which class in Java provides a high-performance, thread-safe queue implementation?
ConcurrentLinkedQueue
What is the term for two threads trying to acquire locks on each other, leading to a program freeze?
Deadlock
Which JVM component is responsible for converting bytecode into machine code at runtime?
JIT Compiler
Why does this code produce a compilation error?
int x = null;
int is a primitive type and cannot be assigned null
What design pattern ensures that a class has only one instance, provides a global point of access to it, and prevents instantiation via constructors?
Singleton
Which collection class implements a red-black tree, providing guaranteed log(n) time cost for the contains, add, and remove operations?
TreeSet
What keyword is used to indicate that a variable's value may be modified by multiple threads and ensures that the most up-to-date value of a variable is always visible to all threads?
volatile
What command-line tool can be used to monitor the JVM's garbage collection logs?
-verbose:gc