arrow
arrow
arrow
Which function is used to perform some action when the object is to be destroyed?
Question



Which function is used to perform some action when the object is to be destroyed?

A.

Constructor

B.

Destructor

C.

Overloader

D.

Allocator

E.

None of the above

Correct option is B

A destructor is a special function in object-oriented programming that is called automatically when an object goes out of scope or is explicitly deleted. It is used for cleanup actions like deallocating resources.
Important Key Points:
1. Destructors have the same name as the class, preceded by a ~ in languages like C++.
2. Destructors do not take parameters or return values.
Knowledge Booster:
· Constructor: Used to initialize an object.
· Overloader: A feature to define multiple behaviors for the same operator or function.
· Allocator: Responsible for memory allocation but not cleanup.

Free Tests

Free
Must Attempt
Video Solutions

RBI Assistant Pre 2026 Full Mock Test -01

languageIcon English
  • pdpQsnIcon100 Questions
  • pdpsheetsIcon100 Marks
  • timerIcon60 Mins
languageIcon English
Free
Must Attempt
Video Solutions

RBI Asst Prelims 2026 : Reasoning Section Test 01

languageIcon English
  • pdpQsnIcon35 Questions
  • pdpsheetsIcon35 Marks
  • timerIcon20 Mins
languageIcon English
Free
Must Attempt
Video Solutions

RBI Office Attendant 2026 Full Mock Test - 01

languageIcon English
  • pdpQsnIcon120 Questions
  • pdpsheetsIcon120 Marks
  • timerIcon90 Mins
languageIcon English
test-prime-package

Access ‘IBPS RRB SO IT Officer (Scale-II)’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
354k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow