Computer Science, asked by Namratabharambe, 1 month ago

1
Multiple Choice Questions :
Which of this keyword must be used to inherit a class?
a super
b) this
c) extent
A class member declared protected becomes a member of subclass of which type?
2
d) extends
a) public member b) private member
c) protected member d) static member
3.
Which of these is correct way of inheriting class A by class B?
a) class B + class A {}
b) class B inherits class A {}
c) class B extends A {}
d) class B extends class A {}
4.
What is not type of inheritance?
a) Single inheritance
b) Double inheritance
c) Hierarchical inheritance
d) Multiple inheritance
5.
Using which of the following, multiple inheritance in Java can be implemented?
a) Interfaces
b) Multithreading c) Protected methods d) Private methods
. All classes in Java are inherited from which class?
a) java.lang.class b) java.class.inherited c) java.class.object d) java.lang. Object
In order to restrict a variable of a class from inheriting to subclass, how variable should be
declared?
a) Protected b) Private
c) Public
d) Static
If super class and subclass have same variable name, which keyword should be used to use​

Answers

Answered by unicorn276
2

Answer:

Explanation:

A derived class can access all the non-private members of its base class. Thus base-class members that should not be accessible to the member functions of derived classes should be declared private in the base class. Constructors, destructors and copy constructors of the base class.A derived class can access all the non-private members of its base class. Thus base-class members that should not be accessible to the member functions of derived classes should be declared private in the base class. Constructors, destructors and copy constructors of the base class.

Answered by dreamrob
0

Answer:

1) Which of this keyword must be used to inherit a class?

d) extends

2) A class member declared protected becomes a member of subclass of which type?

b) private member

3) Which of these is correct way of inheriting class A by class B?

c) class B extends A {}

4) What is not type of inheritance?

b) Double inheritance

5) Using which of the following, multiple inheritance in Java can be implemented?

a) Interfaces

6) All classes in Java are inherited from which class?

d) java.lang.Object

7) In order to restrict a variable of a class from inheriting to subclass, how variable should be  declared?

b) Private

8) If super class and subclass have same variable name, which keyword should be used to use super class?

a) super

Similar questions