Ch6 STUDY

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following are classes from the Java API? A. Scanner B. Random C. PrintWriter D. All of the above

all of the above

One or more objects may be created from a(n): A. field B. class C. method D. instance

class

The following package is automatically imported into all Java programs. A. java.java B. java.default C. java.util D. java.lang

java.lang

Class objects normally have ____ that perform useful operations on their data, but primitive variables do not. A. fields B. instances C. methods D. relationships

methods

The scope of the 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

the instance methods and methods outside the class

In UML diagrams, this symbol indicates that a member is public: A. / B. @ C. - D. +

+

T/F: An object can store data

T

Instance methods do not have this key word in their headers" A. public B. static C. private D. protected

static

Which of the following is not involved in finding the classes when developing when an object-oriented application? A. describe the problem domain B. identify all the nouns C. write the code D. refine the list of nouns to include only those that are relevant to the problem

write the code

In the UML diagram, this symbol indicates that a member is private: A. * B. # C. - D. +

-

Java allows you to create objects of this class in the same way you would create primitive variables. A. Random B. String C. PrintWriter D. Scanner

String

T/F: A class is not an object, but a description of an object.

T

T/F: An access specifier indicates how the class may be accessed.

T

What is stored by a reference variable? A. a binary encoded decimal B. a memory address C. an object D. a string

a memory address

Look at the following statement. import java.util.*; This is an example of: A. a wildcard import B. an explicit import C. unconditional import D. conditional import

a wildcard import

Look at the following statement. import java.util.Scanner; This is an example of: A. a wildcard import B. an explicit import C. unconditional import D. conditional import

an explicit import

A class's responsibilities include: A. the things a class is responsible for doing B. the things a class is responsible for knowing C. both A and B D. neither A and B

both A and B

After the header, the body of the method appears inside a set of: A. brackets, [] B. parentheses, () C. braces, {} D. double quotes, " "

braces, {}

In your textbook the general layout of a UML diagram is a box that is divided into 3 sections. The top section has the ____; the middle section holds ______; the bottom section holds ______. A. class name; attributes or fields; methods B. class name; object name; methods C. object name; attributes or fields; methods D. object name; methods; attributes or fields

class name; attributes or fields; methods

In the cookie cutter metaphor, think of the ____ as a cookie cutter and _____ as the cookies. A. object; classes B. class; objects C. class; fields D. attribute; methods

class; objects

This refers to the combining of data and code into a single object. A. data hiding B. abstraction C. object D. encapsulation

encapsulation

It is common practice in object-oriented programming to make all of a class's A. methods private B. fields private C. fields public D. fields and methods public

fields private

A class specifies the ____ and ____ that a particular type of object has. A. relationships; methods B. fields; object names C. fields; methods D. relationships; object names

fields; methods

A constructor: A. always accept 2 arguments B. has return type of void C. has the same name as the class D. always has an access specifier of private

has the same name as the class

Overloading means 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

have the same name but different parameter lists

Quite often you have to use this statement to make a group of classes available to program. A. import B. use C. link D. assume

import

You should not define a class field that is dependent upon the values of other class fields: A. in order to avoid having the stale data B. because it is redundant C. because it should be defined in another class D. in order to keep it current

in order to avoid having stale data

Another term for an object of a class is: A. access specifier B. instance C. member D. method

instance

When an object is created, the attributes associated with the object are called: A. instance fields B. instance methods C. fixed attributes D. class instances

instance fields

Methods that operate on object's fields are called: A. instance variables B. instance methods C. public methods D. private methods

instance methods

A UML diagram does not contain: A. the class name B. the method names C. the field names D. object names

object names

Most programming languages that are in use today are: A. procedural B. logic C. object-oriented D. functional

object-oriented

This is a group of related classes. A. archive B. package C. collection D. attachment

package

A constructor is a method that: A. returns an object of the class B. never receives any arguments C. with the name Class name.constructor D. performs initialization or setup operations

performs initialization or setup operations

When you are working with a ____, you are using a storage location that holds a piece of data. A. primitive variable B. a reference variable C. numeric literal D. binary number

primitive variable

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 C. inside the parentheses of a method header D. the method in which they are defined

the instance methods of the same class

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

the object's memory address

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

they have different parameter lists


Conjuntos de estudio relacionados

04.02 Honors Marine Biodiversity and Biotechnology

View Set

Unit 10. Vocab. B. Choose the correct work.

View Set

Unit 6 Study Guide Accounting II

View Set