Exam 6: A First Look at Classes

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

Look at the following statement. import java.util.Scanner; This is an example of

Free
(Multiple Choice)
4.7/5
(36)
Correct Answer:
Verified

B

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

Free
(True/False)
4.7/5
(48)
Correct Answer:
Verified

True

When a local variable in an instance method has the same name as an instance field, the instance field hides the local variable.

Free
(True/False)
4.8/5
(29)
Correct Answer:
Verified

False

A UML diagram does not contain:

(Multiple Choice)
4.8/5
(38)

For the following code, which statement is NOT true? Public class Sphere { Private double radius; Public double x; Private double y; Private double z; }

(Multiple Choice)
5.0/5
(42)

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

(True/False)
4.8/5
(44)

A class's responsibilities include:

(Multiple Choice)
4.9/5
(45)

Instance methods do not have this key word in their headers:

(Multiple Choice)
4.9/5
(37)

A constructor is a method that:

(Multiple Choice)
4.9/5
(36)

One or more objects may be created from a(n):

(Multiple Choice)
4.9/5
(44)

Which of the following is NOT involved in finding the classes when developing an object-oriented application?

(Multiple Choice)
4.9/5
(36)

What does the following UML diagram entry mean? + setHeight(h : double) : void

(Multiple Choice)
4.9/5
(41)

Which of the following statements will create a reference, str, to the string, "Hello, world"? (1) String str = new String("Hello, world"); (2) String str = "Hello, world";

(Multiple Choice)
4.8/5
(40)

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 int getOrderAmount() { Return orderAmount; } Public int getOrderDisc() { Return orderDisc; } } Public class CustomerOrder { Public static void main(String[] args) { Int ordNum = 1234; Double ordAmount = 580.00; Double discountPer = .1; Order order; Double finalAmount = order.getOrderAmount() - Order.getOrderAmount() * order.getOrderDisc(); System.out.printf("Final order amount = $%,.2f\n", FinalAmount); } }

(Multiple Choice)
4.9/5
(30)

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

(True/False)
4.8/5
(40)

Class objects normally have ________ that perform useful operations on their data, but primitive variables do not.

(Multiple Choice)
4.9/5
(30)

You should not define a class field that is dependent upon the values of other class fields:

(Multiple Choice)
5.0/5
(40)

Which of the following are classes from the Java API?

(Multiple Choice)
4.8/5
(42)

After the header, the body of the method appears inside a set of:

(Multiple Choice)
4.9/5
(35)

The scope of a private instance field is:

(Multiple Choice)
4.9/5
(30)
Showing 1 - 20 of 58
close modal

Filters

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