Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 13 pages
Exam (elaborations)

COMP 1131 - Modules 5, 6, 7 Question and answers already passed 2025

Document preview thumbnail
Preview 2 out of 13 pages

COMP 1131 - Modules 5, 6, 7 Question 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 typ

Content preview

COMP 1131 - Modules 5, 6, 7 Question
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.

Document information

Uploaded on
August 13, 2025
Number of pages
13
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$16.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
LEWISSHAWN55
2.9
(11)
Sold
96
Followers
46
Items
7346
Last sold
6 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions