Question 16Asked in Bihar STET 2025 Paper II Computer Science, 3 Nov 2025, Shift 1 (9:00 AM)

What is the purpose of a constructor in OOP?ओओपी में एक कंस्ट्रक्टर का उद्देश्य क्या है?

ओओपी में एक कंस्ट्रक्टर का उद्देश्य क्या है?
  1. ATo destroy objectsवस्तुओं को नष्ट करना
  2. BTo create instances of abstract classesअमूर्त वर्गों के उदाहरण बनाने के लिए
  3. CTo initialize object propertiesऑब्जेक्ट गुणों को प्रारंभ करना
  4. DTo define abstract methodsअमूर्त विधियों को परिभाषित करना
Show answerHide answer

Correct answer: (C) To initialize object propertiesऑब्जेक्ट गुणों को प्रारंभ करना

Explanation

A constructor is a special method that runs automatically when an object is created and sets the initial values of its properties. Destroying objects is the job of a destructor.कंस्ट्रक्टर एक विशेष मेथड है जो ऑब्जेक्ट बनते ही अपने आप चलती है और उसकी प्रॉपर्टी के शुरुआती मान तय करती है। ऑब्जेक्ट नष्ट करने का काम डिस्ट्रक्टर का है।

From Bihar STET 2025 Paper II Computer Science PYQ, 3 Nov 2025, Shift 1 (9:00 AM)

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