Which keyword is used to exit a loop prematurely in Java?
exit
return
break
continue
What are fields in a Java class?
Constructors used to create objects
Variables that hold the state of an object
Methods that belong to the class
Keywords reserved by the Java language
What is recursion in the context of Java methods?
Calling a method from a different class
A method calling itself within its own definition
Overloading a method with different parameters
Returning multiple values from a method
Which of the following is NOT a valid way to declare an array in Java?
int arr[];
int arr[] = new int[5];
int[] arr;
int []arr;
What is the base case in a recursive function?
The return statement of the function.
The initial call to the function.
The most complex part of the recursion.
The condition that stops the recursion.
Which of these is a valid way to call a method named 'calculateArea' in Java?
calculateArea;
Area.calculate()
calculateArea()
call calculateArea()
What is the default value of an element in an array of type double?
double
0
0.0
undefined
null
What is the base class for all checked exceptions in Java?
Throwable
Error
Exception
RuntimeException
Which operator is used for string concatenation in Java?
/
What is essential to prevent infinite recursion in a Java method?
A return statement in all code paths
Using a different method name for each recursive call
A conditional statement that terminates the recursion
A loop within the recursive method