Review Questions

   


1:

How can you make the code between #if and #endif of the following lines be included in the compilation

 #if TRIALEDITION     <Some code> #endif 
2:

Is the second line in the following two lines of code valid? Why or why not?

 using System; #define 
3:

Add the necessary preprocessor directives and identifiers to the following lines of code, so that <Code part 1> is excluded from the compilation and <Code part 2> is included.

 ... #if     <Code part 1> #endif ... #if     <Code part 2> #endif ... 
4:

What is the major difference between standard comments and program documentation?

5:

What does a documentation comment consist of? Give an example.

6:

Which command must you give to the compiler to let it transform the documentation comments into a separate XML document?

7:

What is the main purpose of attributes?

8:

Can any attribute be used to decorate any code element?

9:

Name a couple of .NET's predefined attributes and briefly describe what they are used for.

10:

As mentioned earlier, .NET contains an attribute called XmlArrayAttribute; it exists in the System.Xml.Serialization namespace. Which of the following annotations are correct (there can be more than one). (Assume the line using System.Xml. Serialization; is included at the beginning of the source):

  1. [System.Xml.Serialization.XmlArrayAttribute]

  2. [XmlArrayAttribute]

  3. [XmlArray]

  4. [Xml]

  5. [Array]

11:

What is an attribute's positional parameter? Give an example.

12:

Suppose your source code contains a method with the following header:

 public void StartOperation() {     ... } 

Which attribute can you use to prevent any methods from calling this method? Provide the necessary annotation.

13:

Can you use the same procedure as in question 12 to prevent any calls to the following method? Why or why not?

 public int Sum(int x, int y) {     ... } 
14:

What is a named parameter?


   


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