and answers already passed 2025
When applied to instance variables, the ________________ visibility modifier
enforces encapsulation. - correct answer ✔Private
Any private variables are "hidden" and cannot be referenced directly from
outside a class.
A method that has multiple definitions is an _____________ method. - correct
answer ✔Overloaded method
There are times when it is appropriate to return data from a method of a type
that is inconsistent with the return type specified in the method header. T/F -
correct answer ✔Java requires that any value returned by a method match
the declared return type.
The correct answer is 'False'.Java requires that any value returned by a
method match the declared return type.
The correct answer is 'False'.
A programmer is required to define a constructor for every class. T/F - correct
answer ✔Java will produce a default constructor if no other constructors are
coded.
The correct answer is 'False'.
An object can be thought of as a blueprint for a set of classes. T/F - correct
answer ✔The reverse is true—a class is the blueprint for a set of objects.
The correct answer is 'False'.
, Which of the following types of methods do not have any return type (not even
a void return type)? - correct answer ✔Constructors do not have a return
type, since they return an object of the class for which the constructor is
already named.
The correct answer is: constructors
A ______________ diagram helps us visualize the contents of and
relationships among the classes of a program. - correct answer ✔UML Class
Diagram
A return statement is not required at the end of every method. T/F - correct
answer ✔A void method does not return any value, so its execution just ends
with the last statement in the method.
The correct answer is 'True'.
If a service is so complex that it cannot reasonably be implemented using one
method, it is often helpful to decompose it to make use of _________ support
methods. - correct answer ✔Private.
Private methods can only be called by other methods within the class, so they
are often called "helper" methods and are used to break up a large
complicated method into several smaller methods.
A _________ variable is shared among all instances of a class. - correct
answer ✔Static
A static variable is also called a class variable ... only one copy exists that is
shared by all objects of a class.