Question 95Asked in Bihar STET 2025 Paper II Computer Science, 3 Nov 2025, Shift 2 (2:00 PM) + 1 more paper

What is the purpose of a destructor in OOP?ओओपी में एक विनाशक का उद्देश्य क्या है?

ओओपी में एक विनाशक का उद्देश्य क्या है?
  1. ATo create instances of classesकक्षाओं के उदाहरण बनाने के लिए
  2. BTo handle exceptionsअपवादों को संभालने के लिए
  3. CTo free up resources when an object is destroyedकिसी वस्तु के नष्ट होने पर संसाधनों को मुक्त करना
  4. DTo define default values for propertiesगुणों के लिए डिफ़ॉल्ट मान निर्धारित करना
Show answerHide answer

Correct answer: (C) To free up resources when an object is destroyedकिसी वस्तु के नष्ट होने पर संसाधनों को मुक्त करना

Explanation

A destructor runs automatically when an object is destroyed and releases its resources, such as memory, files or network connections.Destructor ऑब्जेक्ट नष्ट होने पर अपने आप चलता है और उसके संसाधन, जैसे मेमोरी, फाइलें या नेटवर्क कनेक्शन, मुक्त करता है।

From Bihar STET 2025 Paper II Computer Science PYQ, 3 Nov 2025, Shift 2 (2:00 PM)

This is question 95 of Bihar STET 2025 Paper II Computer Science PYQ, 3 Nov 2025, Shift 2 (2:00 PM). 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.

Asked in 2 papers