Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/articles/c-sharp-tutorials/)
-   -   C# interview questions (http://www.go4expert.com/articles/c-sharp-interview-questions-t3158/)

iamscottj 18Aug2010 16:58

Re: C# interview questions
Interesting interview questions. It helped me remember all the answers. Thanks a lot. Would like to see some .NET 3.0 or 4.0 questions too.

GilbertoCode 28Nov2010 01:10

Re: C# interview questions
Actually, Protected Internal can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly. Access from another assembly must take place within a class declaration that derives from the class in which the protected internal element is declared, and it must take place through an instance of the derived class type.

tom7nuge 16Jan2011 06:37

Great Post
great post. I like it

virender.ets 22Jan2011 16:46

Re: C# interview questions
It's great help to face the interview.

khadakbist 27Feb2011 19:33

Re: C# interview questions
Here some more good questions questpond dot com

the_nell_87 8Mar2011 17:06

Re: C# interview questions

10.Can you store multiple data types in System.Array?
While strictly true, the answer to that question is incorrect. There is nothing stopping you from declaring an array of objects, then populating it with a variety of different data types. For example, the following is perfectly legal:


object[] array = new object[] { 1, "abc", new Random() };
Of course, that's extremely bad practice, but the fact remains that you can do it.

srhone 19Mar2011 01:22

Re: C# interview questions
Class question "Can you allow a class to be inherited, but prevent the method from being over-ridden?" answer (Yes. Just leave the class public and make the method sealed.) is wrong. You cannot use the "sealed" modifier in a public class that is not over-riding the class that implements the method or property that you want to seal. If you want to stop someone from over-riding a method or property just do not add the "virtual" modifier to it

The following will raise an error. If you switched the GetPerson in the Person class to include the "virtual" modifier then it would work.
public class Person{
public string GetPerson(){

public class Member: Person{
override public string GetPerson(){

sbsl 23Sep2011 17:29

Re: C# interview questions

Originally Posted by Mutayyab Shah (Post 68415)
Anyone ans me that .what is different b/w mutable and immutable?

Mutable Objects: When you have a reference to an instance of an object, the contents of that instance can be altered
Immutable Objects: When you have a reference to an instance of an object, the contents of that instance cannot be altered

hitesh123 20Oct2011 17:51

Re: C# interview questions
great package of questions u have shared............. it will definately help c# bginner...

MarkC 24Jan2013 01:00

Re: C# interview questions

Likethe_nell_87, I think the answer in 10th question is not ok (Can you storemultiple data types in System.Array?).
If you havea this hierarchy: class Person {}; class Male : Person {}; class Female : Person {}; each Maleor Female object is also a Person object.
With an ArrayListobject, I can insert multiple types of the same hierarchy, and then convert theArrayList to an Array using the base type of Person. The following code works fine:

class Person { }
    class Male : Person { }
    class Female : Person { }
    class Program
        static void Main(string[] args)
            ArrayList al = newArrayList();
          al.Add(new Female());
          al.Add(new Male());
            Person auxp = new Person();
            Array a = al.ToArray(auxp.GetType());
            foreach (Person p in a)

So, in myopinion the answer is yes.

All times are GMT +5.5. The time now is 07:06.