• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

JAVA Chapter 6 Exam Questions and Answers

Document preview thumbnail
Preview 2 out of 8 pages

JAVA Chapter 6 Exam Questions and Answers

Content preview

JAVA Chapter 6 Exam Questions
and Answers

Q1: Overloaded methods always have the same _________.
a. a. method name.
b. b. return type.
c. c. number of parameters.
d. d. order of the parameters. - Answer-ANS: a. method name.

Q2: An overloaded method is one that
a. a. has a different name than another method, but the same parameters.
b. b. has the same name as another method, but different parameters (by number,
types or order of the types).
c. c. has the same name and parameters as a method defined in another class.
d. d. has the same name and parameters, but a different return type as another method.
- Answer-ANS: b. has the same name as another method, but different parameters (by
number, types or order of the types).

Q3: Which of the following methods are overloaded with respect to one another?

public int max ( int a, int b ) { ... }
public double max ( double a, double b ) { ... }
public int max ( int a, int b, int c ) { ... }
public double max ( double a, double b, double c ) { ... }

a. a. A and B are overloaded; C and D are overloaded.
b. b. A and C are overloaded; B and D are overloaded.
c. c. A, B and C are overloaded.
d. d. All these four methods are overloaded. - Answer-ANS: d. All these four methods
are overloaded.

Q4: Suppose method1 is declared as

void method1 ( int a, float b )

Which of the following methods correctly overloads method1?

a. a. void method2 ( int a, float b ).

, b. b. void method2 ( float a, int b ).
c. c. void method1 ( float a, int b ).
d. d. void method1 ( int b, float a ). - Answer-ANS: c. void method1 ( float a, int b ).

Q5: A Java class can have which of the following methods?

A. A. void foo( int a )
B. B. void foo( int a, int b )
C. C. void foo( double a )
D. D. void foo( double a, double b )
E. E. void foo( int b )

a. a. All of the above.
b. b. A, B, D, E.
c. c. A, B, C, D.
d. d. A, C, D, E. - Answer-ANS: c. A, B, C, D.

Q6: Method calls cannot be distinguished by ________.
a. a. method name.
b. b. return type.
c. c. parameter lists.
d. d. method signature. - Answer-ANS: b. return type.

Q7: In a class containing methods with the same name, the methods are distinguished
by:
a. a. Number of arguments.
b. b. Types of arguments.
c. c. Return type.
d. d. (a) and (b).
e. e. (b) and (c). - Answer-ANS: d. (a) and (b).



Q1: Information is passed to a method in:
a. a. the method name.
b. b. that method's return.
c. c. the method body.
d. d. the arguments to the method. - Answer-ANS: d. the arguments to the method.

2 Q2: Programs designed for maintainability are constructed from small simple pieces
or modules. Modules in Java are called:
a. a. methods.
b. b. classes.
c. c. arguments.
d. d. both methods and classes. - Answer-ANS: d. both methods and classes

2 Q3: A well-designed method

Document information

Uploaded on
July 12, 2025
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$13.49

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.
Scholarsstudyguide
3.8
(169)
Sold
853
Followers
476
Items
16410
Last sold
1 week 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