Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 Which of the following things does this statement do? Color darkBrown

ID: 3882259 • Letter: Q

Question

Question 1

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 2

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 3

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 4

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 5

What are the different views of a class?

I. Source code

II. UML Class Diagram

III. Javadoc comments

A. I

B. I & II

C. II & III

D. I, II, & III

Explanation / Answer

Question 1
Which of the following things does this statement do?

Color darkBrown = new Color( 120, 160, 0 );   //Declares an object darkBrown of type Color, and defines using constructor.
So, the answer is: D. All of the above

Question 2
An object diagram represents what?
An object diagram is an instance of a class. They represent the static view of a system at a given point.
So, the answer is: B. the state of memory at a particular point during the execution of a program

Question 3
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?
As told earlier, the object diagram is the state of memory at a particular point during the execution.
Therefore, it should consider, the declare, instantiate, or bind a variable.
So, the answer is: D. All of the above

Question 4
Which of the following valid statements declares a variable?
/* 1 */ Oval dot = new Oval(); //Declares a variable dot of type Oval, and defines it.
/* 2 */ dot.setColor( new Color( 0, 0, 255 ) ); //Instantiates a method setColor with a new object of type Color.
/* 3 */ dot.setFilled(); //Calls a method setFilled().
/* 4 */ Oval circle;    //Declares a variable circle of type Oval.
/* 5 */ circle = dot;   //Assigns the variable dot, to another variable circle.
So, the answer is: C. 1 and 4

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote