Filters
Question type

Study Flashcards

What is stored by a reference variable?


A) A binary encoded decimal
B) A memory address
C) An object
D) A string

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

The term "default constructor" is applied to the first constructor written by the author of a class.

A) True
B) False

Correct Answer

verifed

verified

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

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

Instance methods should be declared static.

A) True
B) False

Correct Answer

verifed

verified

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

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Given the following code, what will be the value of finalAmount when it is displayed? Public class Order { Private int orderNum; Private double orderAmount; Private double orderDiscount; Public Order(int orderNumber, double orderAmt, Double orderDisc) { OrderNum = orderNumber; OrderAmount = orderAmt; OrderDiscount = orderDisc; } Public double finalOrderTotal() { Return orderAmount - orderAmount * OrderDiscount; } } Public class CustomerOrder { Public static void main(String[] args) { Order order; Int orderNumber = 1234; Double orderAmt = 580.00; Double orderDisc = .1; Order = new Order(orderNumber, orderAmt, orderDisc) ; Double finalAmount = order.finalOrderTotal() ; System.out.printf("Final order amount = $%,.2f\n", FinalAmount) ; } }


A) 528.00
B) 580.00
C) 522.00
D) There is no value because the object order has not been created.

E) B) and D)
F) B) and C)

Correct Answer

verifed

verified

Most programming languages that are in use today are:


A) procedural
B) logic
C) object-oriented
D) functional

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

When you are working with a ________, you are using a storage location that holds a piece of data.


A) primitive variable
B) reference variable
C) numeric literal
D) binary number

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

A constructor:


A) always accepts two arguments
B) has return type of void
C) has the same name as the class
D) always has an access specifier of private

E) None of the above
F) A) and B)

Correct Answer

verifed

verified

An access specifier indicates how the class may be accessed.

A) True
B) False

Correct Answer

verifed

verified

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

E) B) and D)
F) All of the above

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

E) A) and B)
F) B) and D)

Correct Answer

verifed

verified

A method that stores a value in a class's field or in some other way changes the value of a field is known as a mutator method.

A) True
B) False

Correct Answer

verifed

verified

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 definition
D) using the private access specifier on the class fields

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

In UML diagrams, this symbol indicates that a member is public.


A) /
B) @
C) -
D) +

E) C) and D)
F) All of the above

Correct Answer

verifed

verified

The following package is automatically imported into all Java programs.


A) java.java
B) java.default
C) java.util
D) java.lang

E) A) and C)
F) All of the above

Correct Answer

verifed

verified

Showing 41 - 58 of 58

Related Exams

Show Answer