Chapter 6

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

When an object is created, the attributes associated with the object are called __________.

Instance fields

Shadowing is the term used to describe where the field name is hidden by the name of a local or parameter variable. T or F

T

When an object is passed as an argument to a method, the object's address is passed into the method's parameter variable. TRUE FALSE

True

A class specifies the __________ and __________ that a particular type of object has. a. relationships, methods c. fields, methods b. fields, object names d. relationships, object names

C. Fields, Methods

Which symbol indicates that a member is public in a UML diagram? a. - b. * c. # d. +

A. +

Methods that operate on an object's fields are called __________. a. instance methods c. private methods b. instance variables d. public methods

A. Instance methods

The scope of a private instance field is __________. a. the instance methods of the same class b. inside the class but not inside any method in that class c. inside the parentheses of a method header d. the method in which it is defined

A. The instance methods of the class

Another term for an object of a class is a(n) __________. a. access specifier c. member b. instance d. method

B. instance

When an object is passed as an argument to a method, what is passed into the method's parameter variable? a. the class name c. the values for each field b. the object's memory address d. the method names

B>

A group of related classes is called a(n) __________. a. archive c. collection b. package d. attachment

A. archive

The term "no-arg constructor" is applied to any constructor that does not accept arguments T or F

T

When you work with a __________, you are using a storage location that holds a piece of data. a. primitive variable c. numeric literal b. reference variable d. binary number

A.

Instance methods do not have the __________ key word in their headers. a. public b. static c. private d. protected

B. static

The __________ package is automatically imported into all Java programs. a. java.java c. java.util b. java.default d. java.lang

D

One or more objects may be created from a(n) __________. a. field b. method c. instance d. class

D. class

It is common practice in object-oriented programming to make all of a class's __________. a. fields private c. fields public b. methods private d. fields and methods public

A> fiel

A constructor __________. a. always accepts two arguments c. has the return type of void b. has the same name as the class d. always has a private access specifier

B. has the same name as the class

Java allows you to create objects of the __________ class in the same way you would create primitive variables. a. Random c. PrintWriter b. String d. Scanner

B. string

Overloading means that multiple methods in the same class __________. a. have the same name but different return types b. have different names but the same parameter list c. have the same name but different parameter lists d. perform the same function

C.

You should not define a class that is dependent on the values of other class fields __________. a. in order to keep it current b. because it is redundant c. in order to avoid having stale data d. because it should be defined in another class

C. in order to avoid having stale data

Class objects normally have __________ that perform useful operations on their data, but primitive variables do not. a. fields c. methods b. relationships d. instances

C. methods

A constructor is a method that __________. a. returns an object of the class b. never receives any arguments c. performs initialization or setup operations d. removes the object from memory

C. performs initialization or setup operations

A UML diagram does not contain __________. a. the class name c. the field names b. the method names d. the object names

D

The scope of a public instance field is __________. a. only the class in which it is defined b. inside the class but not inside any method c. inside the parentheses of a method header d. the instance methods and methods outside the class

D.

Which symbol indicates that a member is private a UML diagram? a. - b. * c. # d. +

D. -

A method that gets a value from a class's field but does not change it is known as a mutator method. TRUE FALSE

False

Instance methods do not have the key word static in their headers. T or F

T

A constructor is a method that is automatically called when an object is created. TRUE FALSE

True

A method that gets a value from a class's field but does not change it is known as a mutator method. TRUE FALSE

True

Instance methods do not have the key word static in their headers. TRUE FALSE

True

The scope of a private instance field is __________. a. the instance methods of the same class b. inside the class but not inside any method in that class c. inside the parentheses of a method header d. the method in which it is defined

a. the instance methods of the same class

What does the following UML diagram entry mean? + setHeight(h : double) : void a. a public method with a parameter of data type double that does not return a value b. a private field called setHeight that is a double data type c. a private method with no parameters that returns a double data type d. a public field called setHeight that is a double data type

A. a public method with a parameter of data type double that does not return a value

The following statement is an example of __________. import java.util.*; a. an explicit import statement b. an unconditional import statement c. a wildcard import statement d. a conditional import statement

A. an explicit import statement

After the header, the body of the method appears inside a set of __________. a. braces, { } c. brackets, [ ] b. parentheses, ( ) d. double quotes, " "

A. braces { }

A(n) __________ can be thought of as a blueprint that can be used to create a type of __________. a. object, class c. cookie, cake b. class, object d. object, method

B

Two or more methods in a class may have the same name as long as __________. a. they have different return types b. they have different parameter lists c. they have different return types but the same parameter list d. You cannot have two methods with the same name.

B

A reference variable stores a(n) __________. a. binary encoded decimal c. object b. memory address d. string

B.

Methods that operate on an object's fields are called __________. a. instance variables c. public methods b. instance methods d. private methods

B.

To indicate the data type of a variable in a UML diagram, you enter __________. a. the variable name followed by the data type b. the variable name followed by a colon and the data type c. the class name followed by the variable name followed by the data type d. the data type followed by the variable name

B.

Which of the following is not involved in identifying the classes to be used when developing an object-oriented application? a. a description of the problem domain b. the code c. a refined list of nouns that include only those relevant to the problem d. all the nouns are identified

B. the code

Data hiding (which means that critical data stored inside the object is protected from code outside the object) is accomplished in Java by __________. a. using the public access specifier on the class methods b. using the private access specifier on the class methods c. using the private access specifier on the class fields d. using the private access specifier on the class definition

C. using the private access specifier on the class fields

Instance methods should be declared static. TRUE FALSE

False

The public access specifier for a field indicates that the field may not be accessed by statements outside the class. TRUE FALSE

False


Set pelajaran terkait

Round 4 (Valley Forge and Saratoga)

View Set

MGMT 10, MGMT 13, MGMT 11, MGMT 12

View Set

Med Surg: Chapter 44: Nursing Management: Patients With Oncologic Disorders of the Brain and Spinal Cord

View Set

LearningCurve Module 16. Adulthood

View Set

Theatre 2010- Butler- TAOT Ch. 5 & 9

View Set