when you answer questions, please use the line numbers in the images below: Ques
ID: 3708719 • Letter: W
Question
when you answer questions, please use the line numbers in the images below:
Question 1
Question 1 options:
Which method does the program execution start with?
Fill in the blank below with the method name:
____________
Which class does the above method belong to?
_________________
Question 2 :
After line 4 in Circle2Test class is executed and before line 5 is executed, how many Circle2 objects are created?
________
Question 3
What are stored in variables first and second? Please read both options below carefully before making a choice.
Question 3 : --
Variable first contains the address (reference) of Circle object that is created the first and variable second contains the address (reference) of the Circle object that is created the second.
Variable first contains the Circle object that is created the first and variable second contains the Circle object that is created the second.
__A OR B____
Question 4
Question 4 : --
Now line 5 of the Circle2Test is executed. It is a method invocation to setRadius. Please enter the line number of the header of the method definition for this method in Circle2.java?
_________
When the method setRadius is invoked, a stack frame is set up for the method invocation and all local variables will be allocated on the frame. Is newRadius (the parameter) also considered a local variable? Please type yes or no in the blank below.
_________
What value is assigned to the parameter newRadius?
___________
Is radius on line 13 a local variable or an instance variable (an attribute of an object)? (Please type either local or instance in the blank below).
________________
Question 5
Question 5 options:
This is a continuation of the proceeding question. On line 13 of Circle2.java, newRadius is assigned to radius. Remember that radius is a abbreviation of this.radius. The variable this is an implicit parameter and it refers to the current object that the method is invoked on. There are two objects created so far, one is referred to by variable first in the main method and the other is referred to by variable second in the main method.
Remember that the current method invocation is from line 5 of Circle2Test.java. Please enter in the blank below whether variable this is assigned to variable first or variable second? (Please type either first or second in the blank below.)
___________
Just before line 13 is executed, what is the value of this.radius?
_______________
After line 13 is executed, what is the value of this.radius?
______________
After the method invocation returns, what happens to the frame where all local variables are located? Please type either deallocated or kept in memoryin the blank below.
________
After the method invocation returns, which line does the program return to in Circle2Test,java? Please type the line number in the blank below.
__________
Question 6
Question 6 options:
After program returns to line 5 in the main method, it then proceeds to line 6. Line 6 is also a method invocation to setRadius.
What value is assigned to the explicit parameter newRadius this time?
_____________
Is radius on line 13 a local variable or an instance variable (an attribute of an object)? (Please type either local or instance in the blank below).
____________
Question 7
Question 7 options:
This is a continuation of the proceeding question. On line 13 of Circle2.java, newRadius is assigned to radius. Remember that radius is a abbreviation of this.radius. The variable this is an implicit parameter and it refers to the current object that the method is invoked on. There are two objects created so far, one is referred to by variable first in the main method and the other is referred to by variable second in the main method.
Remember that the current method invocation is from line 6 of Circle2Test.java. Please enter in the blank below whether variable this is assigned to variable first or variable second? (Please type either first or second in the blank below.)
________________
Just before line 13 is executed, what is the value of this.radius?
__________
After line 13 is executed, what is the value of this.radius?
____________
After the method invocation returns, what happens to the frame where all local variables are located? Please type either deallocated or kept in memoryin the blank below.
___________
After the method invocation returns, which line does the program return to in Circle2Test,java? Please type the line number in the blank below.
______________
Question 8
Question 8 options:
After the program returns to line 6 in Circle2Test.java in the proceeding question, the program execution then proceeds to line 7. Line 7 is a method invocation to printCircle. Please enter the line number of the header of the method definition for this method in Circle2.java?
___________
Does this method have an explicit parameter? Please type yes or no in the blank below.
____________
Is radius on line 17 a local variable or an instance variable (an attribute of an object)? (Please type either local or instance in the blank below).
___________
Question 9
Question 9 options:
This is a continuation of the proceeding question. On line 17 of Circle2.java, radius is a abbreviation of this.radius. The variable this is an implicit parameter and it refers to the current object that the method is invoked on. There are two objects created so far, one is referred to by variable first in the main method and the other is referred to by variable second in the main method.
Remember that the current method invocation is from line 7 of Circle2Test.java. Please enter in the blank below whether variable this is assigned to variable first or variable second? (Please type either first or second in the blank below.)
__________
What's printed by line 17?
_________________
After the method invocation returns, what happens to the frame where all local variables are located? Please type either deallocated or kept in memoryin the blank below.
_______________
After the method invocation returns, which line does the program return to in Circle2Test,java? Please type the line number in the blank below.
_____________
Question 10
Question 10 options:
After the program returns to line 7 in Circle2Test.java in the proceeding question, the program execution then proceeds to line 8. Line 8 is also a method invocation. It is an invocation to printCircleInParameter. Please enter the line number of the header of the method definition for this method in Circle2.java?
_____________
Is printCircleInParameter a static method? Please type yes or no in the blank below.
____________
Is any other method in Circle2 a static method?
___________
Method printCircleInParameter has a parameter c. What's assigned to c when the method is invoked this time?
___________
What's printed by the method invocation?
_____________
Question 11
Question 11 options:
This is a continuation of the proceeding question. Is the method printCircleInParamenter invoked on an object? If yes, there will be an implicit parameter this and it refers to the current object that the method is invoked on. Again the question: Is the method printCircleInParamenter invoked on an object? Please type yes or no in the blank below.
_________
If we change c.radius to just radius (which is an abbreviation for this.radius), what type of error will be incurred? Please type compile error, run-time error, or logic error in the blank below. You can try that in Dr.Java
___________
After the method invocation returns, what happens to the frame where all local variables are located? Please type either deallocated or kept in memoryin the blank below.
____________
After the method invocation returns, which line does the program return to in Circle2Test,java? Please type the line number in the blank below.
__________
A)Variable first contains the address (reference) of Circle object that is created the first and variable second contains the address (reference) of the Circle object that is created the second.
B)Variable first contains the Circle object that is created the first and variable second contains the Circle object that is created the second.
__A OR B____
1 public class Circle2Test 2public static void main (String[ args) I Circle2 first - new Circle2 (5) Circle2 second - new Circle2 (10) first.setRadius (20) second.setRadius (100) first.printCircle Circle2.printCircleInParameter (second); 10Explanation / Answer
if you post more than 1 question, as per chegg guidelines I ahve to solve only first question.
Ques 1 : main()
The first method executed is the main mthod.
It belongs to class Circle2test.
Ques 2. Answer : 2
2 objects have been created.
Ques 3. Answer : (A) Variable first contains the address (reference) of Circle object that is created the first and variable second contains the address (reference) of the Circle object that is created the second.
The variables are actually the reference to the object.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.