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

Extra Credit Assignment 2 Software development What is the value stored in x in

ID: 3825103 • Letter: E

Question

Extra Credit Assignment 2

Software development

What is the value stored in x in following lines of code?
int x, y, z;
x = 0;
y = 1;
x = y = z = 8;
a) 0
b) 1
c) 9
d) 8

ANS:______________________

3. Which of the following is a method having same name as that of it’s class?
a) finalize
b) delete
c) class
d) constructor

ANS:___________________________

Which of these have highest precedence?
a) ()
b) ++
c) *
d) >>

ANS:________________________________

Which of these keywords can be used to prevent Method overriding?
a) static
b) constant
c) protected
d) final

       ANS:__________________________________

           

Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?
a) super(void);
b) superclass.();
c) super.A();
d) super();

ANS:___________________________________

Which of these class is superclass of every class in Java?
a) String class
b) Object class
c) Abstract class
d) ArrayList class

ANS:______________________________

Which of these keywords can be used to prevent inheritance of a class?
a) super
b) constant
c) Class
d) final

ANS:___________________________

Which of these class relies upon its subclasses for complete implementation of its methods?
a) Object class
b) abstract class
c) ArrayList class
d) None of the mentioned

4. Which of the following statements are incorrect?
a) static methods can call other static methods only.
b) static methods must only access static data.
c) static methods can not refer to this or super in any way.
d) when object of class is declared, each object contains its own copy of static variables.

ANS:________________

Which of these keywords is used to prevent content of a variable from being modified?
a) final
b) last
c) constant
d) static

ANS:_____________________

Explanation / Answer

Hi, I have answered first 5 Questions.

Please repost others in separate post.

Please let me know in case of any issue in first 5.

1)
What is the value stored in x in following lines of code?
int x, y, z;
x = 0;
y = 1;
x = y = z = 8;

Ans: d) 8

   Evaluation happen from right to left
   So, z = 8
       y = z
       x = y

2)
3. Which of the following is a method having same name as that of it’s class?
a) finalize
b) delete
c) class
d) constructor

Ans: d) constructor : constructor has same name as class name

3)

Which of these have highest precedence?
a) ()
b) ++
c) *
d) >>

Ans: a) ()

4)

Which of these keywords can be used to prevent Method overriding?
a) static
b) constant
c) protected
d) final

Ans: a) static and d)final
       final methods can't be overriden, because that's what final is designed to do: it's a sign saying "do not override this".

       static methods can't be overriden

5)
Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?
a) super(void);
b) superclass.();
c) super.A();
d) super();

Ans: d) super();

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote