Which keyword is used to exit a loop prematurely in Java?
break
return
exit
continue
In Java, what is an instance of a class?
A variable that stores data
A concrete, realized version of a class
A method that performs a specific action
A blueprint or template for creating objects
What is the primary purpose of a method in Java?
To control program flow
To store data
To perform a specific task
To define a class
Which of the following is NOT a valid access modifier in Java?
static
public
private
protected
If a method in Java is declared 'private,' where can it be accessed?
From any class in the application
From any class within the same package
Only from within the same class
From subclasses, even in different packages
Which Java keyword is used to make a decision between two blocks of code based on a condition?
if
while
switch
for
Which of the following is a characteristic of unchecked exceptions in Java?
The compiler requires you to handle them explicitly.
They are not required to be declared in a method's 'throws' clause.
They typically represent recoverable situations.
They are derived directly from the 'Error' class.
Which loop in Java is guaranteed to execute at least once, even if the condition is initially false?
enhanced for loop
for loop
do-while loop
while loop
Which keyword is used to explicitly throw an exception in Java?
throw
try
finally
catch
What is the base class for all checked exceptions in Java?
Throwable
Exception
RuntimeException
Error