No, the above code will not create multiple instances but rather they will point to the same memory instance. If the compiler finds the same value in memory he points the variable to the same instance rather than creating a new one.
The below two code snippets will create multiple memory instances of the variable.
You can check if they point to the same memory instance or multiple instances by using “ReferenceEqual” which belongs to “object” type. It returns true if the objects point to the same instance.
You can also visit our site for more .NET interview question with answers at www.questpond.com
You can also see this link c# interview question video: - What kind of questions are asked in .NET interviews?