Question: 1, What is the .NET class that every other class is derived from? System System.Base System.Object System.Windows 2. If two classes of the same name
1, What is the .NET class that every other class is derived from?
2. If two classes of the same name occur in two different namespaces and both namespaces are used (included) what must be done when using the classes?
| | Just use the name of the class. The C# compiler will figure out by the context which is the correct class to use |
| | Provide a fully qualified path to the class that includes the name space and the name of the class. |
| | Right click on the class name in the code and select the correct class from the popup menu that appears. |
| | It is not possible to have two classes that are named the same thing in C#. |
3. For a method of a class to be overridden in a subclass which of the following must occur.
| | The method must be declared as virtual . |
| | The method must be declared as public . |
| | The method must be declared as do override . |
| | The method must be static. |
4. The class SmithKarenCreature inherits from the class Creature . An instance of SmithKarenCreature is created and referenced in the variable kCreature using the following code: SmithKarenCreature kCreature = new SmithKarenCreature();
A variable called creature of type Creature is declared and kCreature is cast as type Creature and assigned to creature using the following line of code:
Creature creature = (Creature)kCreature;
Which of the following is an alternative syntax to the above line of code?
| | Creature creature = Creature as kCreature; |
| | Creature creature = kCreature as Creature; |
| | Creature (SmithKarenCreature) creature = kCreature; |
| | Creature creature = (SmithKarenCreature as Creature) kCreature; |
5. Why does a syntax error occur when trying to declare a variable called 'lock'?
| | 'lock' is a reserved keyword |
| | 'lock' is a system attribute |