Question: Question 1 An object's properties are also known as what? a. methods b. instance variables c. orientations d. messages e. class variables Question 2 What
Question 1
An object's properties are also known as what?
a. methods
b. instance variables
c. orientations
d. messages
e. class variables
Question 2
What is another name for an object?
a. a method
b. a variable
c. a data type
d. an instance of a class
e. a gadget
Question 3
Which of the following is the name of an instance variable in the CSC142Point class provided in this week's samples?
a. private
b. double
c. x
d. xCoord
e. Point
Question 4
How many constructors are defined in the CSC142Point class provided in this week's examples?
a. 3
b. 2
c. 1
d. 0
Question 5
Which of the following is the name of a query method in the CSC142Point class in this week's examples?
a. Point
b. double
c. distance
d. diffX
e. public
Question 6
Which of the following is the name of an update (mutator) method in the CSC142Point class in this week's examples?
a. getX
b. setPoint
c. void
d. public
e. newX
Question 7
Which method in the CSC142Point class returns a reference to a new CSC142Point object?
a. setX()
b. getX()
c. setPoint()
d. midPoint()
e. toString()
Question 8
Which of the following statements is FALSE?
a. A private method may be called from anywhere within the class in which it is declared.
b. A public attribute may be examined from anywhere in the program, but may not be changed.
c. The keyword void indicates that a method does not return any value.
Question 9 1 pts
Which of the following things does this statement do?
Color darkBrown = new Color( 120, 160, 0 );
a. declare a new variable
b. construct a new object
c. create a binding
d. All of the above
e. None of the above
Question 10
An object diagram represents what?
a. the makeup of a class
b. the state of memory at a particular point during the execution of a program
c. the collection of all possible objects
d. the same thing as a flowchart
Question 11
When drawing an object diagram, you evaluate a series of program statements to figure out how they change the contents of memory. Which of the following is a question you should ask as you evaluate each line of code?
a. Does the line of code declare a variable?
b. Does the line of code instantiate an object?
c. Does the line of code create a binding?
d. All of the above
e. None of the above
Question 12
Which of the following valid statements declares a variable?
/* 1 */ Oval dot = new Oval();
/* 2 */ dot.setColor( new Color( 0, 0, 255 ) );
/* 3 */ dot.setFilled();
/* 4 */ Oval circle;
/* 5 */ circle = dot;
a. 1
b. 1 and 2
c. 1 and 4
d. 1, 4 and 5
e. None of the above
Question 13
Which of the following valid statements creates (constructs) an object? [Read very carefully!]
/* 1 */ Oval dot = new Oval();
/* 2 */ dot.setColor( new Color( 0, 0, 255 ) );
/* 3 */ dot.setFilled();
/* 4 */ Oval circle;
/* 5 */ circle = dot;
a. 1
b. 1 and 2
c. 1 and 4
d. 1, 4 and 5
e. None of the above
Question 14
Which of the following valid statements creates a binding (assigns a value to a variable)?
/* 1 */ Oval dot = new Oval();
/* 2 */ dot.setColor( new Color( 0, 0, 255 ) );
/* 3 */ dot.setFilled();
/* 4 */ Oval circle;
/* 5 */ circle = dot;
a. 1
b. 1 and 4
c. 1 and 5
d. 1, 2, 3 and 5
e. None of the above
Question 15
Which of the following valid statements creates an alias?
/* 1 */ Oval dot = new Oval();
/* 2 */ dot.setColor( new Color( 0, 0, 255 ) );
/* 3 */ dot.setFilled();
/* 4 */ Oval circle;
/* 5 */ circle = dot;
a. 1
b. 2
c. 3
d. 4
e. 5
Question 16
What is an orphan?
a. another name for a void method
b. an object which has no references to it
c. a temporary variable used in a swap operation
d. a programming consultant with no contract
Question 17
What are the different views of a class?
Source code
UML Class Diagram
Javadoc comments
a. I
b. I & II
c. II & III
d. I, II, & III
Question 18
What does the keyword 'this' refer to when used in a statement in code?
a. the program in which the statement exists
b. the class in which the statement is located
c. the particular object executing the statement
d. the method in which the statement is located
e. None of the above
Question 19
Which of the following is the name of the client class; in this code?
public class Marge {
public Crayon favorite() {
Crayon fav = new Crayon();
return fav;
}
}
a. public
b. Crayon
c. Marge
d. favorite
e. generateCrayon
Question 20
Which is an access modifier?
a. public
b. new
c. this
d. String
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
