Top 250+ Solved Java Programming MCQ Questions Answer

From 166 to 180 of 285

Q. Which class cannot have a subclass in java

a. abstract class

b. parent class

c. final class

d. None of above

  • c. final class

Q. Which is the keyword used to inherit a class to another?

a. Inherits

b. extends

c. implements

d. import

  • b. extends

Q. The use of final keyword with method definition

a. Supports method overriding

b. implements dynamic method dispatch

c. Prevents method overriding

d. none of these

  • c. Prevents method overriding

Q. Identify the type of inheritance when two or more subclasses inherit the properties of a super class.

a. Multiple inheritance

b. Single inheritance

c. Multilevel inheritance

d. Hierarchical inheritance

  • d. Hierarchical inheritance

Q. The keyword used inside a class to refer to its immediate super class is

a. super

b. parent

c. base

d. none of these

  • a. super

Q. Which of the following is true in the case of abstract class

a. Abstract constructors cannot be created.

b. Abstract classes can not be inherited.

c. An abstract class contains only abstract methods.

d. All of the above.

  • a. Abstract constructors cannot be created.

Q. Which of these keywords are used to define an abstract class?

a. abst

b. abstract

c. Abstract

d. abstract class

  • b. abstract

Q. If a class inheriting an abstract class does not define all of its function then it will be known as?

a. abstract

b. A simple class

c. Static class

d. None of the mentioned

  • a. abstract

Q. Which of these is not a correct statement?

a. Every class containing abstract method must be declared abstract.

b. Abstract class defines only the structure of the class not its implementation.

c. Abstract class can be initiated by new operator.

d. Abstract class can be inherite

  • c. Abstract class can be initiated by new operator.

Q. Which method defined in Integer class can be used to convert a whole number in string type to primitive int type.

a. valueOf()

b. intValue()

c. parseInt()

d. getInteger()

  • c. parseInt()

Q. The method sqrt() is defined in the class

a. System

b. Root

c. Math

d. Arithmetic

  • c. Math

Q. A primitive data type can be passed as an argument into a method

a. By value

b. by reference

c. both a & b

d. none of these

  • a. By value

Q. Which of these is used as default for a member of a class if no access specifier is used for it?

a. private

b. public

c. public, within its own package

d. protected

  • c. public, within its own package

Q. Which of these keywords is used to refer to member of base class from a sub class?

a. upper

b. super

c. this

d. None of the mentioned

  • b. super

Q. 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 {}

  • c. class B extends A {}
Subscribe Now

Get All Updates & News