QUESTION SET APPROVED
◉ Given the following class definition, which of the following are
considered part of the class's public interface?
public class Motorcycle{ public static final int WHEEL_COUNT = 2;
private int rpmRating;
public void updatePrice(double increase) {...}
private String designCode() {...}
}
a) rpmRating and designCode
b) WHEEL_COUNT and designCode
c) WHEEL_COUNT and updatePrice
d) updatePrice and designCode Answer: c
◉ Given the following class definition, which of the following are
NOT considered part of the class's public interface?
public class CashRegister
{
,public static final double DIME_VALUE = 0.1;
private static int objectCounter;
public void updateDimes(int dimes) {...}
private boolean updateCounter(int counter) {...}
}
a) objectCounter and updateCounter
b) DIME_VALUE and objectCounter
c) DIME_VALUE and updateDimes
d) updateDimes and updateCounter Answer: a
◉ Given the following class definition, which of the following are
NOT considered part of the class's public interface?
public class Motorcycle{ public static final int WHEEL_COUNT = 2;
private int rpmRating;
public void updatePrice(double increase) {...}
private String designCode() {...}
}
a) rpmRating and designCode
b) WHEEL_COUNT and designCode
,c) WHEEL_COUNT and updatePrice
d) updatePrice and designCode Answer:
◉ Which of the following are considered members of a class?
a) Private instance variables and methods.
b) All instance variables and methods.
c) Non-static instance variables and methods.
d) Public instance variables and methods. Answer: b
◉ Which of the following statements about objects is correct?
a) An object defines only the methods for a class.
b) Every object has its own set of data and a set of methods to
manipulate the data.
c) An object is a sequence of instructions that performs a task.
d) All entities, even numbers, are objects. Answer: b
◉ The process of hiding object data and providing methods for data
access is called ____.
a) documentation
, b) encapsulation
c) implementation
d) initialization Answer: b
◉ The public constructors and methods of a class form the public
_____ of the class.
a) interface
b) initialization
c) implementation
d) encapsulation Answer: a
◉ Which of the following statements about classes is correct?
a) A class is an object that can be manipulated by a program.
b) A class describes a set of objects with the same behavior.
c) Class is another name for a method.
d) A class can contain only methods. Answer: b
◉ Which of the following statements about encapsulation is correct?