What are method parameters used for?
To control the method's access level
To pass data into a method
To define the method's return type
To declare variables within a method
What is the result of the expression '10 % 3' in Java?
0
3
1
3.33
What is the role of methods in a Java class?
To define the blueprint for creating objects
To store data associated with an object
To perform actions or operations on an object's data
To control the visibility of class members
Why is method overloading useful?
To enhance code flexibility
All of the above
To improve code readability
To avoid code repetition
Which component of the Java Development Kit (JDK) is responsible for converting Java source code (.java files) into bytecode (.class files)?
Integrated Development Environment (IDE)
Java Compiler (javac)
Java Virtual Machine (JVM)
Java Runtime Environment (JRE)
What is the time complexity of the get() method for an ArrayList?
get()
O(1)
O(n log n)
O(n)
O(log n)
What is a potential risk of poorly implemented recursion?
StackOverflowError.
All of the above.
Slower execution speed.
Increased memory usage.
What is the difference between a class and an object in Java?
A class is a blueprint, while an object is a physical entity.
There is no difference; they are interchangeable terms.
A class is a variable type, while an object is a function.
A class defines properties and behavior, while an object is an instance of a class.
Can you overload a method in Java by changing only the return type?
Yes
No
Which access modifier allows a subclass in a different package to access a member of its superclass?
protected
default
public
private