1) What is public accessibility?
There are no access restrictions.
2) What is private accessibility?
Access is restricted to within the containing class.
3) Methods must declare a return type, what is the keyword used when nothing is returned from the method?
4) What are the two return types for main?
void and int
5) What is a reference and value parameter?
Reference parameters reference the original object whereas value parameters make a local copy and do not affect the original.
6) How do you refer to a member in the base class?
To refer to a member in the base class use:return base.NameOfMethod().
7) What does new do in terms of objects?
Initializes an object.
8) What is the difference between the new operator and modifier?
The new operator creates an instance of a class whereas the new modifier is used to declare a method with the same name as a method in one of the parent classes.
9) Can an interface have properties?
10) What is a nested class?
A class declare within a class.
11) What is a namespace?
A namespace declares a scope which is useful for organizing code and to distinguish one type from another.
12) Can nested classes use any of the 5 types of accessibility?
13) Does C# supports multiple inheritance?
In C#, a class can inherite only one class. But how ever multiple inheritance can be simulated by implementing more than one interfaces.
14) Can different assemblies share internal access?
'internal' accessibility refers that the member can be accessed within the same assembly.
15) Can you inherit from multiple interfaces?
Yes (Actually its not inheriting, its implementing).
16) What keyword would you use for scope name clashes?
this (me - for Vb.Net).
17) Can you have nested namespaces?
18) Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.
19) What is protected accessibility?
Access is restricted to types derived from the containing class.
20) What is internal accessibility?
Accessible from files within the same assembly.
21) What is protected internal accessibility?
Access is restricted to types derived from the containing class or from files within the same assembly.
22) What is the default accessibility for members of an interface?
(Note: No accessibility can be mentioned; even public.)
23) What is the default accessibility for members of a struct?
24) Class methods/members to should be marked with what keyword?
25) A class can have many mains, how does this work?
Only one of them is run, that is the one marked (public) static. (Note: no object need to call this method since it’s a static.)
26) If I have a constructor with a parameter, do I need to explicitly create a default constructor?
27) Can you use access modifiers with destructors?
28) What is boxing and unboxing?
Converting a value type (stack->heap) to a reference type (heap->stack), and vise-versa.
29) What is a pointer?
A pointer is a reference to a memory address.
30) In terms of references, how do == and != (not overridden) work?
They check to see if the references both point to the same object.
31) Can assignment operators be overloaded directly?
32) What operators cannot be overloaded?
=, ., ?:, ->, new, is, sizeof, typeof
33) What is early and late binding?
Late binding is using System.object instead of explicitly declaring a class (which is early binding).
34) Can base constructors can be private?