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

Consider the following two statements : (1) A publicly derived is a subtype of base class

Consider the following two statements : (1) A publicly derived is a subtype of base class (2) Inheritance provides for code ruse Which one of the following statements is correct?
  1. ABoth the statements (1) and (2) are correct
  2. BNeither of the statement (1) and (2) are correct
  3. CStatement (1) is correct and (2) is incorrect
  4. DStatement (1) is incorrect and (2) is correct
Show answerHide answer

Correct answer: (A) Both the statements (1) and (2) are correct

Explanation

Inheritance provides for code reuse, and public inheritance creates a subtype: a publicly derived class is a subtype of its base class. Both statements are correct.

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

This is question 5 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.