Monday, March 11, 2013

c# Interview Questions (Junior Developer)


  • What is the difference between a value type and a reference type?
  • When checking true false evaluations what is the difference between "&" and "&&"?
  • Is  datetime a value type or a reference type?
  • Is there any way to assign null to an int?
  • How to get a distinct list from an array?
  • What is boxing?
  • What are generics and did you ever use them? What are the advantages of using generics?
  • What is the difference between a hashtable and a dictionary?
  • Can a dictionary have duplicate keys? Which structure can you use that allows duplicate keys?
  • What does sealed mean and give an example of a c# system class that is sealed
  • Can an abstract class have a constructor?
  • Can a private member be virtual?
  • can an abstract method be declared virtual?
  • If you had to refactor code – what steps would you take?
  • What are some advantages of a singleton over a static class?
  • Can you inherit a static class?
  • Can a static constructor have a parameter?
  • Please explain garbage collection in .net
  • Which interface do you need to implement to use
    •                 “using” keyword
      • IDisposable
    •                 Foreach loops
      • IEnumerable or IEnumerable<T>
    •                 Custom sorting
      • IComparable<T>
  • Is there any way to find out the value of a private member of a class?
  • Can a static procedure be recursive?
  • An abstract class can have a public constructor? A private contructor?
  • Whats the order of contructors with an inherited class? Static constructors?
  • What is the difference between finalize and dispose?
  • Are constructors inherited from base classes? 
  • in c# can you change the access level of a derived overwritten procedure protected to public?
  • if you have a derived class what difference is there between declaring "new" or "override" in a procedure?
  • if a base class has a protected member, can the child class override to public?
    • in c# - cannot change access modifiers when overriding 'protected' inherited member
  • can you declare a protected class in a namespace
    • no -Elements defined in a namespace cannot be explicitly declared as private, protected, or protected internal
  • Can you declare a class to be private?
    • Only with nested classes
  • what is the default accessor for a class? for a class member?
  • var something = 100.50F; what is the type of something?
  • what is the difference between a const and a readonly value?
  • what is the difference between typeof, GetType(), and is?
  • what is the difference between ref and out?
  • what is the difference between as and casting?
  • what is the purpose of partial classes?
  • if your argument is a reference type , does it make a difference if you use the ref keyword?
  • what is the difference between Equals ,ReferenceEquals and "=="
  • what is the value of y here:        int y = x ?? -1;
  • How would you remove duplicate entries in an array?
  • what is the value of 5/2 in c#?
  • can you share namespaces over projects?
  • Does array.Clone() create a deep or shallow copy?
  • does this compile?
    •     {
    •                 string s = "gdfgd";
    •             }
    •             {
    •                 string s = "gdfgd";
    •             }
    •         }

No comments:

Post a Comment