Sonepar
Sonepar

Senior Software Engineer

Creating and Comparing Person Objects

Medium
ROUND 1General KnowledgeCandidate Not Selected

Create a class named 'Person' with properties 'name' and 'age'. After creating two instances of 'Person', compare these objects using the .Equals method. Will it return true or false? Discuss how the .Equals method works, considering it inherits from the Object interface. Additionally, override the .Equals method and provide code for this override. Finally, write all possible test case scenarios to validate the override method functionality. Also, explain the behavior of null==null in C#.

This question was asked in

Sonepar Senior Software Engineer Interview Experience

The Sonepar interview process comprised one round focused on object-oriented programming concepts. Candidates were tasked with creating and comparing 'Person' objects while utilizing the .Equals method in C#. The questions required a comprehensive understanding of class structures, method overriding, and testing scenarios. Overall, the interview posed a moderate challenge, assessing both technical skills and problem-solving abilities.

AI Powered

Share Your Story

Share your interview in your own words — our AI handles the rest. Hardly takes 2 minutes.

Take Mock Interview

Prepare better with expert feedback

Want to Connect 1:1?

Connect with me 1:1 for career guidance, resume reviews, interviews, and more.

Show Your Love!

Connect with us on social media