Latest Version Already Passed
What is the correct way to call a constructor of the same class within another constructor?
✔✔A) `this();`
B) `super();`
C) `new this();`
D) `return this();`
Which access modifier allows a class member to be accessed only within the same package?
A) `private`
B) `protected`
✔✔C) Default (no modifier)
D) `public`
Which of the following statements about inheritance is true?
✔✔A) It allows a subclass to acquire the properties and behavior of a superclass
B) It prevents method overriding
C) It requires all methods to be `static`
1
,D) It restricts object creation
What happens if a class is declared `final`?
✔✔A) It cannot be extended by other classes
B) It cannot contain any methods
C) It must implement an interface
D) It can only contain static variables
What is the primary purpose of a class in Java?
A) To store only variables
✔✔B) To define objects with attributes and behaviors
C) To execute a program directly
D) To prevent objects from being created
Which of the following best describes an instance of a class?
A) A blueprint for creating methods
B) A function that runs on its own
✔✔C) An object that has its own unique values and behavior
2
, D) A method that belongs to a class
How do you create an object of a class named `Car`?
A) `Car = new Car();`
B) `Car.create();`
✔✔C) `Car myCar = new Car();`
D) `new Car();`
What does the `private` keyword do when applied to a class variable?
✔✔A) It restricts access to the variable within the same class
B) It allows the variable to be accessed by subclasses only
C) It makes the variable accessible from anywhere
D) It prevents the variable from being initialized
What is a static method?
✔✔A) A method that belongs to the class rather than an object
B) A method that can only be accessed by subclasses
C) A method that cannot be used in inheritance
3