Exam 3: Using Methods, Classes and Objects

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What is the difference between a mutator method and an accessor method? Provide an example of each.

(Essay)
4.8/5
(39)

Access specifiers are sometimes called access____.

(Multiple Choice)
4.8/5
(31)

A method header is also called a(n) _____.

(Multiple Choice)
4.8/5
(31)
Match each term with the correct statement below.
Premises:
Unreachable statements that can never execute
Responses:
mutator method
formal parameters
method's signature
Correct Answer:
Verified
Premises:
Responses:
Unreachable statements that can never execute
mutator method
(Matching)
4.7/5
(35)

Parentheses in a method declaration contain parameters that are "dropped into" the method.

(True/False)
4.8/5
(36)

A(n) ____ constructor is one that requires no arguments.

(Multiple Choice)
4.8/5
(42)

Methods used with object instantiations are called ____ methods.

(Multiple Choice)
4.8/5
(30)

Any class can contain an unlimited number of methods.

(True/False)
4.8/5
(32)

An application's main() method must have a void return type.

(True/False)
5.0/5
(29)
Match each term with the correct statement below.
Premises:
Method that retrieves a value
Responses:
method's signature
dead code
class user
Correct Answer:
Verified
Premises:
Responses:
Method that retrieves a value
method's signature
(Matching)
4.9/5
(38)

Which of the following is NOT an initial value assigned to an object's data field by a default constructor?

(Multiple Choice)
4.9/5
(35)

Normally, you declare constructors to be ____so that other classes can instantiate objects that belong to the class.

(Multiple Choice)
4.9/5
(39)

public class Employee {    private int empNum;    private double empSalary; ​    public void setEmpNum(int emp)    {       empNum = emp;    }     public void setEmpSalary(double sal)    {       empSalary = sal;    } } Given the class defined in the code above, write the Java statements that will create a new employee instance called employee15 and assign an empNum of 15 and empSalar y of 500.00 to that employee instance.

(Essay)
4.8/5
(35)

What are the four components of a method header?

(Essay)
4.9/5
(40)

Methods that retrieve values are called ____ methods.

(Multiple Choice)
4.9/5
(39)

The name of the ____ is always the same as the name of the class whose objects it constructs.

(Multiple Choice)
4.8/5
(42)

Every object is a _____ of a more general class.

(Multiple Choice)
4.7/5
(35)

The ____ method executes first in an application, regardless of where you physically place it within its class.

(Multiple Choice)
4.8/5
(33)

How do you use a value returned from a method? Provide an example.

(Essay)
4.8/5
(40)

Does a programmer need to write every class he or she uses? Why or why not?

(Essay)
4.7/5
(41)
Showing 41 - 60 of 79
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)