Question 83

This question is based on the following C++ code segment and class FUN:

This question is based on the following C++ code segment and class FUN: class FUN { int CODE ; public : FUN ( ); //Function1 FUN (int C); //Function2 FUN (FUN & F); //Function3 void DISP ( ); //Function4 ~FUN ( ); //Function5 }; void main ( ) { FUN F1 ; ______ // BLANK ______ } Which of the following is called a destructor of the class FUN ?
  1. AFUNCTION 1
  2. BFUNCTION 2
  3. CFUNCTION 3
  4. DFUNCTION 5
Show answerHide answer

Correct answer: (D) FUNCTION 5

Explanation

A destructor has the class name with a tilde and no arguments, so ~FUN() (Function 5) is the destructor.

From DSSSB TGT Computer Science Practice Set 5

This is question 83 of DSSSB TGT Computer Science Practice Set 5. 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.