This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Select wrong statement about destructor in C#?(a) A class can have one destructor only(b) Destructors cannot be inherited or overloaded(c) Destructors can have modifiers or parameters(d) All of the mentionedI got this question during an internship interview.This interesting question is from Destructors in Class topic in section Classes of C# |
|
Answer» The correct choice is (C) DESTRUCTORS can have MODIFIERS or parameters |
|
| 2. |
Operator used to free the memory when memory is allocated?(a) new(b) free(c) delete(d) none of the mentionedThis question was addressed to me at a job interview.This intriguing question originated from Destructors in Class topic in division Classes of C# |
|
Answer» Right option is (c) DELETE |
|
| 3. |
Which of the following statements are correct?(a) There is one garbage collector per program running in memory(b) There is one common garbage collector for all programs(c) To garbage collect an object set all references to it as null(d) Both There is one common garbage collector for all programs & To garbage collect an object set all references to it as nullI got this question in an interview.This intriguing question originated from Destructors in Class topic in division Classes of C# |
|
Answer» The CORRECT CHOICE is (d) Both There is ONE COMMON GARBAGE collector for all programs & To garbage collect an object set all references to it as null |
|
| 4. |
Name a method which has the same name as that of class and which is used to destroy objects also called automatically when application is finally on process of being getting terminated.(a) Constructor(b) Finalize()(c) Destructor(d) EndThe question was posed to me by my college director while I was bunking the class.The query is from Destructors in Class topic in section Classes of C# |
|
Answer» RIGHT CHOICE is (C) DESTRUCTOR Explanation: DEFINITION of the destructor. |
|
| 5. |
The method called by clients of a class to explicitly release any resources like network, connection, open files etc. When the object is no longer required?(a) Finalize()(b) End()(c) Dispose()(d) Close()This question was posed to me in semester exam.Enquiry is from Destructors in Class in division Classes of C# |
|
Answer» Correct OPTION is (c) Dispose() |
|
| 6. |
Which operator among the following signifies the destructor operator?(a) ::(b) :(c) ~(d) &The question was asked in unit test.Enquiry is from Destructors in Class topic in portion Classes of C# |
|
Answer» The CORRECT CHOICE is (C) ~ |
|