Question 23Asked in UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)

Which of the following is/are correct with reference to abstract class and interface?

Which of the following is/are correct with reference to abstract class and interface? (1) A class can inherit only one Abstract class but may inherit several interfaces (2) An Abstract class can provide complete and default code but an interface has no code Codes :
  1. A(1) is true
  2. B(2) is true
  3. CBoth (1) and (2) are true
  4. DNeither (1) nor (2) is true
Show answerHide answer

Correct answer: (C) Both (1) and (2) are true

Explanation

An interface is an empty shell: there are only the signatures of the methods, which do not have a body, so statement (2) is true. A class can extend only a single class, whereas it can implement multiple interfaces, so statement (1) is true.

From UGC NET Computer Science PYQ, December 2015 (Paper II & III, Selected Questions)

This is question 23 of UGC NET Computer Science PYQ, December 2015 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.