Review Questions

   


1:

What is the full name of the class defined inside these two namespaces?

 namespace BliposSoft {     namespace RocketSimulation     {         class Rocket         {             ...         }     } } 
2:

A programmer in an uncontrolled moment of vanity gave the following name to a class:

 ThisIsTheBestRocketClassInTheWholeWideWorldAndTheWholeWideBliposAsWell 

The claim in the name is true, so you need to use this class extensively in your program, but you don't want to write the long name. How can this be avoided?

3:

The following class is found in a compilation unit that will be part of a DLL assembly.

 class Bicycle {     double CalculateAirResistance()     {         ...     }     double WheelRotationsPerMinute()     {         ...     } } 

The access modifiers in front of the class and the two methods are missing. Which access modifiers should we put in front of the class and the methods to:

  1. Allow all of the class and both methods to be used in another assembly.

  2. Prohibit any part of the class to be used in another assembly, but allow the methods to be used within their own assembly.

  3. Allow the CalculateAirResistance method to be accessed from another assembly, but not the WheelRotationsPerMinute method.

  4. Allow all of the class to be used in another assembly along with CalculateAirResistance, while WheelRotationsPerMinute must only be accessed from within the class.

4:

You are working for a software company called BikeTech that is planning to write a class library containing the classes from the three main compartments in the company: Bicycle Design, Health and Fitness, and Computer Mapping. Use C# code to illustrate the overall namespace layout you would suggest for this class library.

5:

Three different compilation units contain each of the following namespace definitions:

Compilation unit 1:

 namespace MyCompany {     public class Bicycle     {         ...     } } 

Compilation unit 2:

 namespace MyCompany.Design {     public class Drawer     {         ...     } } 

Compilation unit 3:

 namespace MyCompany.Design.Tools {     public class Cutter     {         ...     } } 

The compilation units are to be compiled into the same assembly. Instead of having three compilation units, write one compilation unit with namespace definitions matching those contained in the three displayed compilation units. Use the nested C# namespace definition format that looks like the following:

 namespace <outer_namespace> {     namespace <inner_namespace>     {         etc. 
6:

You have written two source files called Bicycle.cs and Person.cs. You want to compile them and create a DLL assembly called healthlib.dll. You must also reference the following two assemblies to the compiler for this compilation: mathlib.dll and anatomylib.dll. Write the compiler command you would give to the compiler.

7:

What can you use Ildasm for?


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net