User Tools

Site Tools


study_questions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

study_questions [2009/07/31 02:10] stephenstudy_questions [2017/01/01 20:05] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Study Questions ====== ====== Study Questions ======
  
-====== 70-528 Exam Study Questions ======+====== Exam 70-528 Study Questions ====== 
 + 
 +===== Chapter 1: Framework Fundamentals ===== 
 + 
 +==== Extension ==== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C1XQ1: What is the primary purpose of a delegate? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: To facilitate event handling. 
 + 
 +==== Lesson 3: Constructing Classes  ==== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C1L3Q1: To raise an event, what three elements must be provided? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  - A class that provides event data. 
 +  - An event delegate. 
 +  - A class that raises the event. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C1L3Q2: What object type should an event pass if it has no custom data? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //EventArgs// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C1L3Q3: If an event needs to pass custom data, what class should be derived from and what is the naming convention? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //EventArgs// should be derived from and the naming convention is //{EventName}EventArgs//
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C1L3Q4: What is the naming convention for a delegate for an event? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //{EventName}Handler// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C1L3Q5: What two things should be done to allow a class to raise an event? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  - A public event needs to be declared. 
 +  - A protected //On{EventName}// method should be created.
  
 ===== Chapter 2: Input/Output (I/O) ===== ===== Chapter 2: Input/Output (I/O) =====
 +
 +==== Lesson 1: Navigating the File System ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C2L1Q1: How do you enumerate the drives in a system? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call the //DriveInfo.GetDrives// method.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C2L1Q2: How do you enumerate the files in a particular directory? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Create a new //DirectoryInfo// object, specifying the directory in the constructor.
 +  - Call the //GetFiles// method on the //DirectoryInfo// object, which returns a collection of //FileInfo// objects.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C2L1Q3: How would you determine the size of a particular file in the file system? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Create a new //FileInfo// object, specifying the path to the file in the constructor.
 +  - Examine the //FileInfo//'s //Length// property.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C2L1Q4: How do you copy a file? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Create a new //FileInfo// object, specifying the path to the source file in the constructor.
 +  - Call the //FileInfo//'s //CopyTo// method, specifying the path to the destination file.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C2L1Q5: What are the high level steps required to monitor a directory for changes? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Create a //FileSystemWatcher// object.
 +  - Set the //Path// property.
 +  - Register for the event that you are interested in.
 +  - Set the //EnableRaisingEvents// property to true.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C2L1Q6: How do you create a //DriveInfo// object for a specific drive? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Create a new //DriveInfo// object, specifying the drive letter in the constructor.
  
 ==== Lesson 3: Compressing Streams ==== ==== Lesson 3: Compressing Streams ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C2L3Q1: What two classes are used to compress and decompress data? ** ** C2L3Q1: What two classes are used to compress and decompress data? **
 +
 +Follow up question: What is the difference between the two and what would you use each for?
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //GZipStream// and //DeflateStream//. Answer: //GZipStream// and //DeflateStream//.
  
-Follow-up QuestionWhat is the difference between the two and what would you use each for?+Follow up answer//GZipStream// conforms to the GZip standard by adding extra header information. //GZipStream// is best if inter-operation is required, //DeflateStream// has slightly better compression.
  
-Answer: //GZipStream// conforms to the GZip standard by adding extra header information. //GZipStream// is best if inter-operation is required, //DeflateStream/has slightly better compression.+/--== Answer Question separator ==-- */
  
 ** C2L3Q2: What is the data size limit of both compression methods? ** ** C2L3Q2: What is the data size limit of both compression methods? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: 4 GB (of uncompressed data). Answer: 4 GB (of uncompressed data).
 +
 +/* --== Answer Question separator ==-- */
  
 ** C2L3Q3: Which stream is passed to the constructor of a compression stream? ** ** C2L3Q3: Which stream is passed to the constructor of a compression stream? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 31: Line 168:
  
 ==== Lesson 1: Forming Regular Expressions ==== ==== Lesson 1: Forming Regular Expressions ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C3L1Q1: In a regular expression, what symbol matches the start of a line and what matches the end? ** ** C3L1Q1: In a regular expression, what symbol matches the start of a line and what matches the end? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Start = ^ (carat), end = $ Answer: Start = ^ (carat), end = $
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C3L1Q2: In a regular expression, what is a lazy quantifier and how is one specified? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: A lazy quantifier will match as little of the searched string as possible. A lazy quantifier is specified by adding a '?' symbol immediately after the quantifier.
  
 ===== Chapter 4: Collections and Generics ===== ===== Chapter 4: Collections and Generics =====
  
 ==== Lesson 1: Collecting Data Items ==== ==== Lesson 1: Collecting Data Items ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C4L1Q1: What needs to be done to a custom collection class to enable the use of the ''foreach'' statement? ** ** C4L1Q1: What needs to be done to a custom collection class to enable the use of the ''foreach'' statement? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //IEnumerator// needs to be implemented. Answer: //IEnumerator// needs to be implemented.
  
-** *C4L1Q2: How would you randomise a collection? **+/--== Answer Question separator ==-- */ 
 + 
 +** C4L1Q2: How would you randomise a collection? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Create a class that implements the //IComparer// interface and pass an instance of it to the collection's //Sort// method. Answer: Create a class that implements the //IComparer// interface and pass an instance of it to the collection's //Sort// method.
  
-** *C4L1Q3: Which non-generic collection is the most basic, general collection? **+/--== Answer Question separator ==-- */ 
 + 
 +** C4L1Q3: Which non-generic collection is the most basic, general collection? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //ArrayList//. Answer: //ArrayList//.
  
-** *C4L1Q4: Which class is used by default to sort a collection? **+/--== Answer Question separator ==-- */ 
 + 
 +** C4L1Q4: Which class is used by default to sort a collection? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //Comparer//. Answer: //Comparer//.
  
-===== Chapter 4Collections and Generics =====+ 
 + 
 +==== Lesson 3: Working with Dictionaries ==== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C4L3Q1When iterating over a //Hashtable//, what order are entries returned in, by default? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The order of the hash values. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C4L3Q2: What are the five non-generic, non-specialised dictionary collections, what is each used for and what is the generic equivalent? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * //Hashtable//, used for simple basic dictionaries, //Dictionary<>//
 +  * //SortedList//, used for dictionaries that are sorted by key, //SortedList<>// and //SortedDictionary//
 +  * //ListDictionary//, used for small dictionaries, //Dictionary<>//
 +  * //HybridDictionary//, used for dictionaries of unknown or varying size, //Dictionary<>//
 +  * //OrderedDictionary//, used where direct control of the order is required, //Dictionary<>//
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C4L3Q3: What type of object does a non-generic dictionary collection contain? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //DictionaryEntry// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091012 */ 
 + 
 +** C4L3Q4: Which list is a dictionary? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //SortedList//
  
 ==== Lesson 4: Using Specialized Collections ==== ==== Lesson 4: Using Specialized Collections ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C4L4Q1: What type of dictionary collection should be used for small collections (typically fewer than ten elements)? ** ** C4L4Q1: What type of dictionary collection should be used for small collections (typically fewer than ten elements)? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //ListDictionary// Answer: //ListDictionary//
 +
 +/* --== Answer Question separator ==-- */
  
 ** C4L4Q2: What type of dictionary collection should be used for large collections? ** ** C4L4Q2: What type of dictionary collection should be used for large collections? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //Hashtable// Answer: //Hashtable//
 +
 +/* --== Answer Question separator ==-- */
  
 ** C4L4Q3: What type of dictionary collection should be used if the size of the collection is unknown or will vary? ** ** C4L4Q3: What type of dictionary collection should be used if the size of the collection is unknown or will vary? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //HybridDictionary// Answer: //HybridDictionary//
 +
 +/* --== Answer Question separator ==-- */
  
 ** C4L4Q4: What type of dictionary collection should be used if ordering is required? ** ** C4L4Q4: What type of dictionary collection should be used if ordering is required? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //OrderedDictionary// Answer: //OrderedDictionary//
 +
 +/* --== Answer Question separator ==-- */
  
 ** C4L4Q5: How does a dictionary collection determine uniqueness? ** ** C4L4Q5: How does a dictionary collection determine uniqueness? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: It uses the //IEqualityComparer// passed into the constructor or, if none was passed, it uses the //GetHashCode// and //Equals// methods. Answer: It uses the //IEqualityComparer// passed into the constructor or, if none was passed, it uses the //GetHashCode// and //Equals// methods.
  
-** *C4L4Q6: What are the five specialised collections? **+/--== Answer Question separator ==-- */ 
 + 
 +** C4L4Q6: What are the five specialised collections and their generic equivalent? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  - //BitArray//, no generic equivalent. 
 +  - //BitVector32//, no generic equivalent. 
 +  - //StringCollection//, equivalent to //List<String>//
 +  - //StringDictionary//, equivalent to //Dictionary<String>//
 +  - //NameValueCollection//, equivalent to //Dictionary<>//
 + 
 +/* --== Answer Question separator ==-- */
  
-Answer//BitArray//, //BitArray32//, //StringCollection//, //StringDictionary// and //NameValueCollection//.+** C4L4Q7The //StringCollection// class is a specialised version of what class? **
  
-** *C4L4Q7: The //StringCollection// class is a specialised version of what class? **+/--== Question Answer separator ==-- */
  
 Answer: //ArrayList// Answer: //ArrayList//
  
-** *C4L4Q8: The //StringDictionary// class is a specialised version of what class? **+/--== Answer Question separator ==-- */ 
 + 
 +** C4L4Q8: The //StringDictionary// class is a specialised version of what class? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //Hashtable// Answer: //Hashtable//
  
-** *C4L4Q9: What can be created with the //CollectionsUtil// class? **+/--== Answer Question separator ==-- */ 
 + 
 +** C4L4Q9: What can be created with the //CollectionsUtil// class? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Case-insensitive //Hashtable//s and case-insensitive //SortedList//s. Answer: Case-insensitive //Hashtable//s and case-insensitive //SortedList//s.
  
-** *C4L4Q10: How do you create a culture-invariant collection? **+/--== Answer Question separator ==-- */ 
 + 
 +** C4L4Q10: How do you create a culture-invariant collection? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Pass //StringComparer.InvariantCulture// or //StringComparer.InvariantCultureIgnoreCase// to the constructor of the collection. Answer: Pass //StringComparer.InvariantCulture// or //StringComparer.InvariantCultureIgnoreCase// to the constructor of the collection.
  
-** *C4L4Q11: What is the difference between the //NameValueCollection// class and the //StringDictionary// class? **+/--== Answer Question separator ==-- */ 
 + 
 +** C4L4Q11: What is the difference between the //NameValueCollection// class and the //StringDictionary// class? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer:\\ Answer:\\
Line 106: Line 363:
   * //NameValueCollection// can store multiple values for each key.   * //NameValueCollection// can store multiple values for each key.
   * //NameValueCollection// values can be accessed by key index.   * //NameValueCollection// values can be accessed by key index.
- 
  
 ==== Lesson 5: Generic Collections ==== ==== Lesson 5: Generic Collections ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C4L5Q1: What are the six 'standard' generic collections that are type-safe versions of the other ones? ** ** C4L5Q1: What are the six 'standard' generic collections that are type-safe versions of the other ones? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //List//, //Dictionary//, //SortedList//, //SortedDictionary//, //Queue// and //Stack//. Answer: //List//, //Dictionary//, //SortedList//, //SortedDictionary//, //Queue// and //Stack//.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C4L5Q2: What is the additional generic collection that is not a version of the other ones? ** ** C4L5Q2: What is the additional generic collection that is not a version of the other ones? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //LinkedList// Answer: //LinkedList//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C4L5Q3: What are the three non-specialised, non-dictionary, non-generic collections and their generic equivalent? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * //ArrayList//, equivalent to //List<>//.
 +  * //Queue//, equivalent to //Queue<>//.
 +  * //Stack//, equivalent to //Stack<>//.
 +
 +==== Extension ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C4XQ1: What does the compiler do when an iterator is implemented? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Automatically generates the //Current//, //MoveNext// and //Dispose// methods of the //IEnumerable// interface.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C4XQ2: How do you implement an iterator? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Implement the //IEnumerable// interface.
 +  - Create a method called //GetEnumerator// which returns an //IEnumerator//.
 +  - Use the ''yield return'' statement to return each element.
 +  - If required, use the ''yield break'' to end the iteration.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C4XQ3: What are two ways that the default iterator functionality can be extended? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Named iterators can be created which allows a class to have multiple iteration techniques.
 +  - Parameterised iterators can be created which allows clients control over some or all of the iteration behaviour.
  
 ===== Chapter 5: Serialization ===== ===== Chapter 5: Serialization =====
Line 122: Line 432:
 ==== Lesson 1: Serializing Objects ==== ==== Lesson 1: Serializing Objects ====
  
-** *C5L1Q1: What are the three steps to serialise an object to binary format? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L1Q1: What are the three steps to serialise an object to binary format? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 130: Line 444:
   - Call the //BinaryFormatter//'s //Serialise// method, passing in the stream object and the object to be serialised.   - Call the //BinaryFormatter//'s //Serialise// method, passing in the stream object and the object to be serialised.
  
-** *C5L1Q2: What are the four steps to deserialise an object from binary data? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L1Q2: What are the four steps to deserialise an object from binary data? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 139: Line 457:
   - Call the //BinaryFormatter//'s //Deserialise// method, passing in the stream object and cast the result.   - Call the //BinaryFormatter//'s //Deserialise// method, passing in the stream object and cast the result.
  
-** *C5L1Q3: What needs to be done to a custom class to enable it to be serialised to binary? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L1Q3: What needs to be done to a custom class to enable it to be serialised to binary? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Add the //Serializable// attribute to the class. Answer: Add the //Serializable// attribute to the class.
  
-** *C5L1Q4: What needs to be done to a custom class to enable it to be serialised to SOAP? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L1Q4: What needs to be done to a custom class to enable it to be serialised to SOAP? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Add the //Serializable// attribute to the class. Answer: Add the //Serializable// attribute to the class.
  
-** *C5L1Q5: What needs to be done to prevent a member of a custom class from being serialised to binary? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L1Q5: What needs to be done to prevent a member of a custom class from being serialised to binary? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Add the //NonSerialized// attribute to the member. Answer: Add the //NonSerialized// attribute to the member.
  
-** *C5L1Q6: What needs to be done to prevent a member of a custom class from being serialised to SOAP? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L1Q6: What needs to be done to prevent a member of a custom class from being serialised to SOAP? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Add the //SoapIgnore// attribute to the member. Answer: Add the //SoapIgnore// attribute to the member.
  
-** *C5L1Q7: How can a non-serialised object be automatically initialised after deserialisation? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L1Q7: How can a non-serialised object be automatically initialised after deserialisation? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: The class should implement the //IDeserializationCallback// interface and implement the //IDeserializationCallback.OnDeserialization// method. Answer: The class should implement the //IDeserializationCallback// interface and implement the //IDeserializationCallback.OnDeserialization// method.
  
-** *C5L1Q8: How can an exception be prevented from being thrown if a member is missing from the serialisation data? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L1Q8: How can an exception be prevented from being thrown if a member is missing from the serialisation data? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Add the //OptionalField// attribute to the member. Answer: Add the //OptionalField// attribute to the member.
  
 ==== Lesson 2: XML Serialization ==== ==== Lesson 2: XML Serialization ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C5L2Q1: Which tool would you use to create a class that, when serialised, would produce an XML document that conformed to an XML schema? ** ** C5L2Q1: Which tool would you use to create a class that, when serialised, would produce an XML document that conformed to an XML schema? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Xsd.exe Answer: Xsd.exe
  
-** *C5L2Q2: What are the three steps to serialise data to XML? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L2Q2: What are the three steps to serialise data to XML? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
  
-  - Create a stream, //TextWriter//, or //XmlWriter// object to hold the serialised output. +  - Create or get a reference to a stream, //TextWriter//, or //XmlWriter// object to hold the serialised output. 
-  - Create an //XmlSerializer// object, passing it the type of object to be serialised.+  - Create or get a reference to an //XmlSerializer// object, passing it the type of object to be serialised.
   - Call the //XmlSerializer// object's //Serialize// method, passing the stream and the object to be serialised.   - Call the //XmlSerializer// object's //Serialize// method, passing the stream and the object to be serialised.
  
-** *C5L2Q3: What are the three steps to deserialise data from XML? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L2Q3: What are the three steps to deserialise data from XML? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
  
-  - Create a stream, //TextWriter//, or //XmlWriter// object to read the serialised input. +  - Create or get a reference to a stream, //TextReader//, or //XmlReader// object to read the serialised input. 
-  - Create an //XmlSerializer// object, passing it the type of object to be serialised.+  - Create or get a reference to an //XmlSerializer// object, passing it the type of object to be deserialised.
   - Call the //XmlSerializer// object's //Deserialize// method, passing the stream, and cast the result.   - Call the //XmlSerializer// object's //Deserialize// method, passing the stream, and cast the result.
  
-** *C5L2Q4: What needs to be done to ensure that a class can be serialised to XML? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L2Q4: What needs to be done to ensure that a class can be serialised to XML? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 193: Line 551:
   * Create a parameterless (or default) constructor.   * Create a parameterless (or default) constructor.
  
-** *C5L2Q5: By default, what are public class members are serialised as? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L2Q5: By default, what are public class members serialised as? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Hint: Attributes or elements. Hint: Attributes or elements.
Line 199: Line 561:
 Answer: Elements. Answer: Elements.
  
-** *C5L2Q6: What needs to be done to prevent a member of a custom class from being serialised to XML? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L2Q6: What needs to be done to prevent a member of a custom class from being serialised to XML? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Add the //XMLIgnore// attribute to the member. Answer: Add the //XMLIgnore// attribute to the member.
Line 205: Line 571:
 ==== Lesson 3: Custom Serialization ==== ==== Lesson 3: Custom Serialization ====
  
-** *C5L3Q1: How do you override the default serialisation functionality? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q1: How do you override the default serialisation functionality? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Implement the //ISerializable// interface and add the //Serializable// attribute to the class. Answer: Implement the //ISerializable// interface and add the //Serializable// attribute to the class.
  
-** *C5L3Q2: When should you not use the default serialisation functionality? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q2: When should you not use the default serialisation functionality? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: When the class has declarative or imperative security at the class level or on its constructors. Answer: When the class has declarative or imperative security at the class level or on its constructors.
  
-** *C5L3Q3: What should be implemented for the //ISerializable// interface? **+/--== Answer Question separator ==-- */
  
-AnswerThe //GetObjectData// method and the serialisation constructor.+** C5L3Q3What should be implemented for the //ISerializable// interface? **
  
-Follow Up Question: What happens if you forget the //GetObjectData// method?+Follow up question: What happens if you forget that which should be implemented for the //ISerializable// interface?
  
-Answer: Compiler error.+/* --== Question Answer separator ==-- */
  
-Follow Up QuestionWhat happens if you forget the serialisation constructor.+AnswerThe //GetObjectData// method and the serialisation constructor.
  
-Answerserialisation exception at runtime.+Follow up answerForgeting the //GetObjectData// method results in a compiler error. Forgeting the serialisation constructor results in a serialisation exception at runtime.
  
-** *C5L3Q4: What are the four serialisation events? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q4: What are the four serialisation events? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //Serializing//, //Serialized//, //Deserializing// and //Deserialized//. Answer: //Serializing//, //Serialized//, //Deserializing// and //Deserialized//.
  
-** *C5L3Q5: What are the four attributes used to specify which methods respond to each serialisation event? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q5: What are the four attributes used to specify which methods respond to each serialisation event? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //OnSerializing//, //OnSerialized//, //OnDeserializing// and //OnDeserialized//. Answer: //OnSerializing//, //OnSerialized//, //OnDeserializing// and //OnDeserialized//.
  
-** *C5L3Q6: Which event occurs first, //IDeserializationCallback.OnDeserialization// or //ISerializable//'s //OnDeserialization// event? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q6: Which event occurs first, //IDeserializationCallback.OnDeserialization// or //ISerializable//'s //OnDeserialization// event? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //IDeserializationCallback.OnDeserialization//. Answer: //IDeserializationCallback.OnDeserialization//.
  
-** *C5L3Q7: Which event occurs first, //ISerializable//'s //OnDeserialization// event or //IDeserializationCallback.OnDeserialization//? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q7: Which event occurs first, //ISerializable//'s //OnDeserialization// event or //IDeserializationCallback.OnDeserialization//? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //IDeserializationCallback.OnDeserialization//. Answer: //IDeserializationCallback.OnDeserialization//.
  
-** *C5L3Q8: What must a method have to respond to a serialisation event? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q8: What must a method have to respond to a serialisation event? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 249: Line 643:
   * The attribute that matches the serialisation event.   * The attribute that matches the serialisation event.
  
-** *C5L3Q9: Which of the serialisation types supports events? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q9: Which of the serialisation types supports events? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Hint: Either //BinaryFormatter//, //SoapFormatter// or custom serialisation. Hint: Either //BinaryFormatter//, //SoapFormatter// or custom serialisation.
Line 255: Line 653:
 Answer: //BinaryFormatter//. Answer: //BinaryFormatter//.
  
-** *C5L3Q10: How can you make context decisions during serialisation? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q10: How can you make context decisions during serialisation? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Inspect (or examine etc) the //StreamingContext// object passed to the //GetObjectData// method. Answer: Inspect (or examine etc) the //StreamingContext// object passed to the //GetObjectData// method.
  
-** *C5L3Q11: How can you make context decisions during deserialisation? **+/--== Answer Question separator ==-- */ 
 + 
 +** C5L3Q11: How can you make context decisions during deserialisation? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Inspect (or examine etc) the //StreamingContext// object passed to the serialisation constructor. Answer: Inspect (or examine etc) the //StreamingContext// object passed to the serialisation constructor.
Line 267: Line 673:
 ==== Lesson 2: Working with Images ==== ==== Lesson 2: Working with Images ====
  
-** *C6L2Q1: How can can a //System.Drawing.Image// class be instantiated? **+/--== Answer Question separator ==-- */ 
 + 
 +** C6L2Q1: How can a //System.Drawing.Image// class be instantiated? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 274: Line 684:
   * Create a //System.Drawing.Bitmap// or //System.Drawing.Imaging.Metafile// object.   * Create a //System.Drawing.Bitmap// or //System.Drawing.Imaging.Metafile// object.
  
-** *C6L2Q2: What two methods does //Bitmap// have that //Image// does not? **+/--== Answer Question separator ==-- */ 
 + 
 +** C6L2Q2: What two methods does //Bitmap// have that //Image// does not? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //GetPixel// and //SetPixel//. Answer: //GetPixel// and //SetPixel//.
  
-** *C6L2Q3: What must first be done to draw a rectangle on a //Image// or //Bitmap// object? **+/--== Answer Question separator ==-- */ 
 + 
 +** C6L2Q3: What must first be done to draw a rectangle on a //Image// or //Bitmap// object? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Create a //Graphics// object by calling the //Graphics.FromImage// method. Answer: Create a //Graphics// object by calling the //Graphics.FromImage// method.
  
-** *C6L2Q4: How can an image from a JPEG file be displayed in a Windows Forms application? **+/--== Answer Question separator ==-- */ 
 + 
 +** C6L2Q4: How can an image from a JPEG file be displayed in a Windows Forms application? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 290: Line 712:
   - Assign the //Image// or //Bitmap// object to the //BackgroundImage// property of the //PictureBox// control.   - Assign the //Image// or //Bitmap// object to the //BackgroundImage// property of the //PictureBox// control.
  
-** *C6L2Q5: How can an image from a JPEG file be displayed in a Windows Forms application, without using a //PictureBox// control? **+/--== Answer Question separator ==-- */ 
 + 
 +** C6L2Q5: How can an image from a JPEG file be displayed in a Windows Forms application, without using a //PictureBox// control? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 300: Line 726:
 ==== Lesson 3: Formatting Text ==== ==== Lesson 3: Formatting Text ====
  
-** *C6L3Q1: When using the //Graphics.DrawString// method, how do you set the vertical alignment to top, center or bottom? **+/--== Answer Question separator ==-- */ 
 + 
 +** C6L3Q1: When using the //Graphics.DrawString// method, how do you set the vertical alignment to top, center or bottom? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 311: Line 741:
   - Pass the //StringFormat// object to the //Graphics.DrawString// method.   - Pass the //StringFormat// object to the //Graphics.DrawString// method.
  
-** *C6L3Q2: When using the //Graphics.DrawString// method, how do you set the horizontal alignment to left, center or right? **+/--== Answer Question separator ==-- */ 
 + 
 +** C6L3Q2: When using the //Graphics.DrawString// method, how do you set the horizontal alignment to left, center or right? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 323: Line 757:
  
 ===== Chapter 7: Threading ===== ===== Chapter 7: Threading =====
 +
 +==== Extension ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7XQ1: What is the difference between the way the CLR deals with unhandled exceptions in the .NET Framework 1.1 verses 2.0? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: In 1.0, a backstop is provided for unhandled exceptions that occur on the following types of thread:
 +
 +  * A thread from the thread pool.
 +  * A thread created with the //Thread.Start// method.
 +  * A finaliser thread.
 +
 +In 2.0, these exceptions are left to proceed naturally.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7XQ2: The .NET Framework 2.0 provides a backstop for what three types of unhandled exceptions? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * A //ThreadAbortException// thrown because of an //Abort// call.
 +  * An //AppDomainUnloadException// thrown because the application domain is being unloaded.
 +  * An internal exception thrown by the CLR or host process.
  
 ==== Lesson 1: Creating Threads ==== ==== Lesson 1: Creating Threads ====
  
-** *C7L1Q1: What are the steps to create a new thread that does not require data passed to it? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L1Q1: What are the steps to create a new thread that does not require data passed to it? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 334: Line 800:
   - Call the //Thread// object's //Start// method.   - Call the //Thread// object's //Start// method.
  
-** *C7L1Q2: What are the steps to create a new thread that requires data passed to it? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L1Q2: What are the steps to create a new thread that requires data passed to it? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 342: Line 812:
   - Call the //Thread// object's //Start// method and pass the data to go to the new thread.   - Call the //Thread// object's //Start// method and pass the data to go to the new thread.
  
-** *C7L1Q3: What method signature does a //ThreadStart// have? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L1Q3: What method signature does a //ThreadStart// delegate have? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: It takes no parameters and returns //void//. Answer: It takes no parameters and returns //void//.
  
-** *C7L1Q4: What method signature does a //ParameterizedThreadStart// have? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L1Q4: What method signature does a //ParameterizedThreadStart// delegate have? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: It takes an //Object// as a parameter and returns //void//. Answer: It takes an //Object// as a parameter and returns //void//.
  
-** *C7L1Q5: How should a thread be stopped? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L1Q5: How should a thread be stopped? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: By calling its //Abort// method. Answer: By calling its //Abort// method.
  
-** *C7L1Q6: What happens when you call a thread's //Abort// method? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L1Q6: What happens when you call a thread's //Abort// method? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: The threading system __prepares__ to throw a //ThreadAbortException//. Answer: The threading system __prepares__ to throw a //ThreadAbortException//.
  
-** *C7L1Q7: What two methods can be used to prevent data corruption when a thread is aborted? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L1Q7: What two methods can be used to prevent data corruption when a thread is aborted? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //BeginCriticalRegion// and //EndCriticalRegion//. Answer: //BeginCriticalRegion// and //EndCriticalRegion//.
  
-** *C7L1Q8: What is contained in the execution context of a thread? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L1Q8: What is contained in the execution context of a thread? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Answer:
Line 370: Line 864:
   * Transaction information   * Transaction information
  
-** *C7L1Q9: How do you prevent new threads from getting the execution context? **+/--== Answer Question separator ==-- */
  
-AnswerCall the //ExecutionContext.SurpressFlow// before the new thread is created and call the //ExecutionContext.RestoreFull// afterwards.+** C7L1Q9How do you prevent new threads from getting the execution context? **
  
-** *C7L1Q10: Why would you want to prevent new threads from getting the execution context? **+/--== Question Answer separator ==-- */ 
 + 
 +Answer: Call the //ExecutionContext.SurpressFlow// before the new thread is created and call the //ExecutionContext.RestoreFlow// afterwards. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C7L1Q10: Why would you want to prevent new threads from getting the execution context? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: It is faster. Answer: It is faster.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q11: What should the //Thread.ThreadState// property be used for? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Debugging only and not thread synchronisation.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q12: Which thread state can a thread not return to once it has left it? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Unstarted//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q13: Which thread state can a thread not leave once it has entered it? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Stopped//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q14: Which thread state is a newly created thread in? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Unstarted//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q15: What happens to a thread's state when another thread calls //Thread.Start// on it? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: At first, nothing. Then, when the thread __responds__ to the call and actually starts running, it changes to //Running//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q16: What happens to a thread's state when another thread calls //Thread.Suspend// on it? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Thread.Suspend// is depreciated and should not be used. But if it is, at first the thread's state changes to //SuspendRequested//. Then, when the thread __responds__ to the call, it changes to //Suspended//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q17: What happens to a thread's state when another thread calls //Thread.Abort// on it? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: At first the thread's state changes to //AbortRequested//. Then, when the thread __responds__ to the call, it changes to //Aborted//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q18: What can trigger a thread to change its state to //Running//? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * The thread responds to a //Thread.Start// call.
 +  * Another thread calls //Thread.Resume// which is depreciated and should not be used.
 +  * TODO: there may be a third.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C7L1Q19: How can a thread enter the //WaitSleepJoin// state? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * The thread calls //Monitor.Wait// on another object.
 +  * The thread calls //Thread.Sleep//.
 +  * The thread calls //Thread.Join// on another thread.
  
 ==== Lesson 2: Sharing Data ==== ==== Lesson 2: Sharing Data ====
  
-** *C7L2Q1: What class can be used to atomically increment a variable? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L2Q1: What class can be used to atomically increment a variable? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //Interlocked//. Answer: //Interlocked//.
  
-** *C7L2Q2: What five atomic operations can the //Interlocked// class preform? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L2Q2: What five atomic operations can the //Interlocked// class perform? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Add, Increment, Decrement, Exchange and Read. Answer: Add, Increment, Decrement, Exchange and Read.
  
-** *C7L2Q3: What are the three kernel object that allow thread synchronisation across AppDomains or process boundaries? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L2Q3: What are the three kernel object that allow thread synchronisation across application domains or process boundaries? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Mutex, Semaphore and Event. Answer: Mutex, Semaphore and Event.
  
-** *C7L2Q4: What would you use to control access to a resource across AppDomains or process boundaries? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L2Q4: What would you use to control access to a resource across application domains or process boundaries? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: A Mutex. Answer: A Mutex.
  
-** *C7L2Q5: What would you use to restrict access to a resource across AppDomains or process boundaries to a certain number of processes? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L2Q5: What would you use to restrict access to a resource across application domains or process boundaries to a certain number of processes? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: A Semaphore. Answer: A Semaphore.
  
-** *C7L2Q6: What would you use to signal processes across AppDomains or process boundaries? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L2Q6: What would you use to signal processes across application domains or process boundaries? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: An Event. Answer: An Event.
Line 406: Line 1012:
 ==== Lesson 3: The Asynchronous Programming Model ==== ==== Lesson 3: The Asynchronous Programming Model ====
  
-** *C7L3Q1: What does APM stand for? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q1: What does APM stand for? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Asynchronous Programming Model Answer: Asynchronous Programming Model
  
-** *C7L3Q2: What type does the method //BeginRead// (part of the APM) return? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q2: What type does the method //BeginRead// (part of the APM) return? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //IAsyncResult// Answer: //IAsyncResult//
  
-** *C7L3Q3: What are the three APM rendezvous models? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q3: What are the three APM rendezvous models? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Wait-until-done, polling and callback. Answer: Wait-until-done, polling and callback.
  
-** *C7L3Q4: When using the APM, when is an exception that occurs on an asynchronous thread thrown? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q4: When using the APM, when is an exception that occurs on an asynchronous thread thrown? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: When the //EndXXX// method is called. Answer: When the //EndXXX// method is called.
  
-** *C7L3Q5: To add a piece of work to be processed by the thead pool, what method should be called and what should be passed to it? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q5: To add a piece of work to be processed by the thead pool, what method should be called and what should be passed to it? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: The //ThreadPool.QueueUserWorkItem// method should be called, a //WaitCallback// object and a data object to be processed should be passed. Answer: The //ThreadPool.QueueUserWorkItem// method should be called, a //WaitCallback// object and a data object to be processed should be passed.
  
-** *C7L3Q6: What information does the method //ThreadPool.GetMaxThreads// give? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q6: What information does the method //ThreadPool.GetMaxThreads// give? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: The maximum number of threads and the maximum __completion ports__. Answer: The maximum number of threads and the maximum __completion ports__.
  
-** *C7L3Q7: What information does the method //ThreadPool.GetMinThreads// give? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q7: What information does the method //ThreadPool.GetMinThreads// give? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: The minimum number of threads and the minimum __completion ports__. Answer: The minimum number of threads and the minimum __completion ports__.
  
-** *C7L3Q8: Which are there typically more of, threads managed by the thread pool or completion ports? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q8: Which are there typically more of, threads managed by the thread pool or completion ports? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Completion ports Answer: Completion ports
  
-** *C7L3Q9: What method can be used to utilise the thread pool to fire a callback when a kernal-level synchronisation object signals it has been released? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q9: What method can be used to utilise the thread pool to fire a callback when a kernal-level synchronisation object signals it has been released? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //ThreadPool.RegisterWaitForSingleObject// Answer: //ThreadPool.RegisterWaitForSingleObject//
  
-** *C7L3Q10: What is the namespace of the preferred //Timer// class? **+/--== Answer Question separator ==-- */ 
 + 
 +** C7L3Q10: What is the namespace of the preferred //Timer// class? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //System.Threading.Timer// Answer: //System.Threading.Timer//
 +
 +===== Chapter 8: Application Domains and Services =====
 +
 +==== Lesson 1: Creating Application Domains ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L1Q1: What are application domains used for? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: To keep assemblies separate within a single process.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L1Q2: What manages application domains? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The .NET framework runtime.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L1Q3: What manages processes? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The operating system.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L1Q4: What can host an application domain? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The .NET framework runtime **or** an assembly.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L1Q5: How do you create an application domain? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call //AppDomain//'s **static** //CreateDomain// method.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L1Q6: How do you load an assembly into an application domain? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call the //ExecuteAssembly// or //ExecuteAssemblyByName// method on the **instance** of the //AppDomain// object.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L1Q7: How do you close an application domain? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call //AppDomain//'s **static** //Unload// method and pass a reference to the application domain to be closed.
 +
 +==== Lesson 2: Configuring Application Domains ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L2Q1: The //Evidence// object has a constructor that requires two arrays. What goes in each array? **
 +
 +Follow up question: Although either or both can be null, which is more likely to be null?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Host evidence and assembly evidence.
 +
 +Follow up answer: Assembly evidence.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L2Q2: At what two stages can evidence be specified for an assembly running in an application domain? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: When the application domain is created and when the assembly is executed.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L2Q3: Which existing //AppDomain// objects are affected by changing the properties of an //AppDomainSetup// instance? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: None (tricky). Changing the properties of an //AppDomainSetup// instance only affects new //AppDomain// objects that are created with it.
 +
 +==== Lesson 3: Creating Windows Services ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L3Q1: How do you debug a service? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Install it, start it and then attach a debugger to the service's process.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L3Q2: When creating a service, which methods should you override and which are optional? **
 +
 +Follow up question: What should you also do if you override any optional method?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The methods //OnStart// and //OnStop// should be overridden. The methods //OnPause//, //OnContinue// and //OnShutdown// are optional.
 +
 +Follow up answer: If //OnPause// and/or //OnContinue// are overriden, set //ServiceBase.CanPauseAndContinue// to true. If //OnShutdown// is overriden set //ServiceBase.CanShutdown// to true.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L3Q3: What four things does the //ServiceInstaller// class define? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The service description, display name, service name and start type.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L3Q4: What does the //ServiceProcessInstaller// class define? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The service account settings.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L3Q5: What are the three start types for a service and which is the default? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Automatic, manual (default) and disabled.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L3Q6: What are the four types of accounts that can be used in a security context for a Windows service? **
 +
 +Follow up question: Which is the default, which is the most secure and which is the most privileged?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Local service (most secure)
 +  * Network service
 +  * Local system (most privileged)
 +  * User (default)
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C8L3Q7: What tool is used to manually install a service? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: InstallUtil.exe.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090922 */
 +
 +** C8L3Q8: What are three methods for starting a Windows service? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Server Explorer.
 +  * Services Control Manager.
 +  * Programmatically using the //ServiceController// class.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090922 */
 +
 +** C8L3Q9: What exception will a //ServiceController// object throw if the service name does not exist on the machine? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //InvalidOperationException//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090922 */
 +
 +** C8L3Q10: What class is used to interact with Windows services? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ServiceController//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20091012 */
 +
 +** C8L3Q11: What should a service name be and how is it set? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: A service name should be unique and is set by modifying the //ServiceBase.ServiceName// property in Visual Studio's service Designer.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20091012 */
 +
 +** C8L3Q12: What must a service's //OnStart// method do? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Return.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20091012 */
 +
 +** C8L3Q13: What are three ways to stop or start a service? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Use Computer Management's Services snap-in.
 +  * Use the //Net// command from a command line.
 +  * Programmatically, by using the //ServiceProcess.ServiceController// class.
 +
 +===== Chapter 9: Installing and Configuring Applications =====
 +
 +==== Lesson 1: Configuration Settings ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q1: What are the two most important classes used to deal with application settings and what namespace are they in? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Configuration// and //ConfigurationManager//, which are in the //System.Configuration// namespace.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q2: What are the four //ConfigurationManager// methods that open various configurations? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * //OpenExeConfiguration//
 +  * //OpenMachineConfiguration//
 +  * //OpenMappedExeConfiguration//
 +  * //OpenMappedMachineConfiguration//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q3: What should you always do before opening a mapped configuration file and why? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Check for the existence of the file, because if it is missing no error will be generated - instead all the configuration settings will be null.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q4: How can you specify which version of the .NET Framework an application should be run with? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Add a //supportedRuntime// entry in the //startup// section of the configuration file.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q5: Which is obsolete, //ConfigurationSettings// or //ConfigurationManager//? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ConfigurationSettings//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q6: What are the two default properties of the //ConfigurationManager// class used to store configuration information? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //AppSettings// and //ConnectionString//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q7: What is the default file name for putting configuration settings in? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //App.config//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q8: What is the XML path for custom application settings in the //App.config// file? **
 +
 +Follow up question: What is the element name and what should its two attributes be?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //configuration// -> //appSettings//.
 +
 +Follow up answer: The element name is 'add' and the two attributes should be 'key' and 'value'.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L1Q9: How would you read a setting called 'foo' from the application settings file? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call //ConfigurationManager.AppSettings//["foo"] and store the result in a //String//.
 +
 +==== Lesson 2: Creating an Installer ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L2Q1: What are the two specific predefined installers? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //AssemblyInstaller// and //ComponentInstaller//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L2Q2: What methods should be overridden when creating a custom //Installer// class? **
 +
 +Follow up question: What two events can also be responded to?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Install//, //Commit//, //Rollback// and //Uninstall//.
 +
 +Follow up answer: //Committing// and //Committed//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L2Q3: Other than overriding methods and responding to events, what else needs to be done to create a custom //Installer// class? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Add the //RunInstallerAttribute// to the custom class and set the //runInstaller// parameter to true.
 +
 +==== Lesson 3: Using the .NET Framework 2.0 Configuration Tool ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C9L3Q1: What are the code groups in the .NET Framework named after? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The evidence they provide.
 +
 +===== Chapter 10: Instrumentation =====
 +
 +==== Lesson 1: Logging Events ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L1Q1: Which account or accounts have enough privileges to write to the Windows event log? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The Local System account.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L1Q2: Which logs are available by default in the Windows event log mechanism? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Application, Security and System.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090923 */
 +
 +** C10L1Q3: What should never be done with any event log object? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It should never be passed to less trusted code.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090923 */
 +
 +** C10L1Q4: What is required to create an event source and why? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Administrative privileges is required because all logs, including security, must be searched to determine whether the event source is unique.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090924 */
 +
 +** C10L1Q5: Which versions of Windows do not support event logs? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Windows 98 and Windows Me.
 +
 +==== Lesson 2: Debugging and Tracing ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q1: How can you programmatically signal a break to the debugger? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call the //Debugger.Break// method.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q2: How do you prevent a member from appearing in the variable watch window while debugging? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Add a //DebuggerBrowsable// attribute to the member and pass in //DebuggerBrowserState.Never//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q3: How do you specify what text will appear in the Value column of the variable watch window for a custom class while debugging? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Add a //DebuggerDisplay// attribute to the member.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q4: What does the //DebuggerDisplay// attribute do? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Specifies what should be displayed in the Value column of the variable watch window while debugging.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q5: What does the //DebuggerHidden// attribute do? **
 +
 +Follow up question: How is it different from the //DebuggerStepThrough// attribute?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It causes the debugger to step through the code for the class, method or property it decorates, and causes the debugger to ignore any breakpoints in the code.
 +
 +Follow up answer: The //DebuggerStepThrough// attribute will **not** cause debugger to ignore any breakpoints in the code.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q6: What does the //DebuggerStepThrough// attribute do? **
 +
 +Follow up question: How is it different from the //DebuggerHidden// attribute?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It causes the debugger to step through the code for the class, method or property it decorates, but the debugger will still break at any breakpoints in the code.
 +
 +Follow up answer: The //DebuggerHidden// attribute will cause debugger to ignore any breakpoints in the code.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q7: How do you prevent the debugger from breaking inside a class, method or property, even if there is a breakpoint? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Add a //DebuggerHidden// attribute to the class, method or property.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q8: How do you prevent the debugger from breaking inside a class, method or property, but still stop on any breakpoints? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Add a //DebuggerStepThrough// attribute to the class, method or property.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L2Q9: How do you add a //DebuggerHidden// or //DebuggerStepThrough// attribute to a property? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Decorate either or both of the accessor methods with the attribute.
 +
 +==== Lesson 3: Monitoring Performance ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L3Q1: What is the difference between the //Trace// class and the //Debug// class? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The //Trace// class is implemented in both the release and debug builds, whereas //Debug// is only implemented in debug builds.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L3Q2: What are the four primary methods of getting a reference to a process or processes? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The //GetCurrentProcess//, //GetProcessById//, //GetProcessByName// and //GetProcesses//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L3Q3: How do you start an external executable from .NET code? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call the //Process.Start// method.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L3Q4: How do you start an external executable with command line arguments from .NET code? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Create or get a reference to a //ProcessStartInfo// object, set the //Arguments// property and pass it to the //Process.Start// method.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L3Q5: What object type should secure text be stored in? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //SecureString//
 +
 +==== Lesson 4: Detecting Management Events ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L4Q1: What are the four most important members of the //System.Management// namespace? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ManagementQuery//, //EventQuery//, //ObjectQuery// and //ManagementObjectQuery//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L4Q2: What does //WMI// stand for? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Windows Management Instrumentation.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L4Q3: What are the two steps to retrieve information from the WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Create a //ManagementObjectSearcher// object and pass the query into the constructor.
 +  - Obtain a //ManagementObjectCollection// object by calling the //ManagementObjectSearcher//'s //Get// method.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L4Q4: What needs to be selected from to enumerate the logical drives? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Win32_LogicalDisk//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L4Q5: What needs to be selected from to enumerate the network adapters? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Win32_NetworkAdapterConfiguration//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L4Q6: What needs to be selected from to enumerate the Windows Services? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Win32_Service//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C10L4Q7: What class would be used to respond a change in the WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ManagementEventWatcher//
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q8: What industry standard does the WMI use to represent systems, processes, networks, devices and enterprise components? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Common Information Model
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q9: The WMI architecture consists of what three tiers? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Client software components.
 +  * The object manager.
 +  * Provider software components.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q10: What three things can applications use the WMI for? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Enumerating or retrieving a collection of instance property data.
 +  * Querying for selected instance data.
 +  * Subscribing to events.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q11: What can the WMI instrumentation be used for? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Applications can create their own class and instances with properties and methods that store data about themselves to WMI.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q12: What class or classes are used when gathering WMI class information? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ManagementObject// and //ManagementClass//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q13: What class or classes are used when querying for data with WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //SelectQuery//, //ManagementObjectSearcher//, //WqlObjectQuery// and //ObjectQuery//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q14: What class or classes are used when querying for data asynchronously with WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ManagementObjectCollection// and //ManagementOperationObserver//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q15: What class or classes are used when executing methods with WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ManagementBaseObject//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q16: What class or classes are used when executing methods asynchronously with WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ManagementOperationObserver//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q17: What class or classes are used when receiving events from WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //WqlEventQuery// and //ManagementEventWatcher//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q18: What class or classes are used when receiving events asynchronously from WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //EventArrivedEventArgs//, //EventArrivedEventHandler//, //CompletedEventArgs// and //CompletedEventHandler//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q19: What class or classes are used when connecting to a remote computer with WMI? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ConnectionOptions// and //ManagementScope//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q20: What class or classes are used when creating data providers with WMI instrumentation? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Instance//, //InstrumentationClassAttribute// and //InstrumentedAttribute//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q21: What class or classes are used when creating event providers with WMI instrumentation? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //BaseEvent// and //Instrumentation//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090921 */
 +
 +** C10L4Q22: What class or classes are used when registering a provider with WMI instrumentation? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ManagementInstaller//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090922 */
 +
 +** C10L4Q23: What does the //ObjectQuery// class do? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It represents a management query that returns instances or classes.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090922 */
 +
 +** C10L4Q24: What does the //ManagementObjectSearcher// class do? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It retrieved a collection of management objects based on a specifies query.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090922 */
 +
 +** C10L4Q25: What does the //ManagementObjectCollection// class do? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It represents different collections of management objects retrieved through WMI.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090922 */
 +
 +** C10L4Q26: Objects contained in a //ManagementObjectCollection// are derived from what type? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ManagementBaseObject//.
  
 ===== Chapter 11: Application Security ===== ===== Chapter 11: Application Security =====
 +
 +==== Lesson 1: Understanding Code Access Security ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L1Q1: What does CAS stand for? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Code Access Security.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L1Q2: What is the relationship between evidence, code groups and permission sets? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The evidence that an assembly has determines what code group or groups it belongs to. The code group or groups determines what permission set or sets it gets.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L1Q3: What are the two types of evidence? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Host evidence and assembly evidence.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L1Q4: What are the three CAS policy levels and which one would you most commonly use? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Enterprise, machine and user. Machine policy is the most commonly used.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L1Q5: What must an assembly have before its trust can be increased? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: A strong name.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L1Q6: As a developer, the permission set assigned to the My_Computer_Zone should be changed from what to what? **
 +
 +Follow up question: Why should it be changed?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: From "Full Trust" to "Everything".
 +
 +Follow up answer: Full Trust completely skips all CAS statements in code. The Everything permission set has similar permissions, but it does not skip CAS statements.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L1Q7: What is the command line utility for maintaining CAS settings? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Caspol.exe - **C**ode **A**ccess **S**ecurity **POL**icy tool.
 +
  
 ==== Lesson 2: Using Declarative Security to Protect Assemblies ==== ==== Lesson 2: Using Declarative Security to Protect Assemblies ====
  
-** *C11L2Q1: What does the Microsoft term 'RequestOptional' mean in English? **+/--== Answer Question separator ==-- */ 
 + 
 +** C11L2Q1: What does the Microsoft term 'RequestOptional' mean in English? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: 'Refuse all except'. Answer: 'Refuse all except'.
  
-** *C11L2Q2: What does the Microsoft term 'RequestMinimum' mean in English? **+/--== Answer Question separator ==-- */ 
 + 
 +** C11L2Q2: What does the Microsoft term 'RequestMinimum' mean in English? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: 'Require minimum'. Answer: 'Require minimum'.
  
-** *C11L2Q3: What is the English term 'refuse all except' called in Microsoft language? **+/--== Answer Question separator ==-- */ 
 + 
 +** C11L2Q3: What is the English term 'refuse all except' called in Microsoft language? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: 'RequestOptional'. Answer: 'RequestOptional'.
  
-** *C11L2Q4: What is the English term 'require minimum' called in Microsoft language? **+/--== Answer Question separator ==-- */ 
 + 
 +** C11L2Q4: What is the English term 'require minimum' called in Microsoft language? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: 'RequestMinimum'. Answer: 'RequestMinimum'.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L2Q5: What are the three //SecurityAction//s? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //RequestMinimum//, //RequestOptional// and //RequestRefuse//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L2Q6: CAS declarations are only significant in what type of assemblies? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Partially trusted assemblies.
 +
 +==== Lesson 3: Using Declarative and Imperative Security to Protect Methods ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q1: How many declarative CAS security actions are available for assemblies and how many are available for methods? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Three for assemblies, six for methods.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q2: What are the three declarative CAS security actions for assemblies? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //RequestMinimum//, //RequestOptional// and //RequestRefuse//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q3: What are the six declarative CAS security actions for methods? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Assert//, //Demand//, //Deny//, //InheritanceDemand//, //LinkDemand//, and //PermitOnly//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q4: What is the difference between the //Demand// CAS security action and the //LinkDemand// CAS security action? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Demand// checks the security of __all__ the callers, //LinkDemand// only checks the security of the __immediate__ caller.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q5: Which class is used to specify what to check for in a declarative permission statement and which is used in an imperative permission statement? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Declarative permission statements use //SecurityAction//, imperative permission statements use //CodeAccessPermission//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q6: How should a method __check__ if it has a particular CAS permission? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call the //System.Security.SecurityManager.IsGranted// method.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q7: Which two security actions __reduce__ CAS permissions for a method and what is the difference between the two? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Deny// and //PermitOnly//. //Deny// removes only the specified permission, //PermitOnly// removes __all except__ the specified permission.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q8: Which two security actions __reduce__ CAS permissions for an assembly and what is the difference between the two? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //RequestRefuse// and //RequestOptional//. //RequestRefuse// removes only the specified permission, //RequestOptional// removes __all except__ the specified permission.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q9: What are the three security actions that are applicable to assembles and what are their equivalent security actions that are applicable to classes and methods? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * //RequestRefuse// (assembly) is equivalent to //Deny// (class and methods).
 +  * //RequestOptional// (assembly) is equivalent to //PermitOnly// (class and methods).
 +  * //RequestMinimum// (assembly) is equivalent to //Demand// (class and methods).
 +
 +/* --== Answer Question separator ==-- */
 +
 +** <del>C11L3Q10: What is the meaning of life?</del> **
 +
 +/* --== Question Answer separator ==-- */
 +
 +<del>Answer: 42</del>
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C11L3Q11: As the security action //Assert// can only be used once in a method, how can multiple CAS permissions be asserted? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Add the permissions to a //PermissionSet// object and assert that.
  
 ===== Chapter 12: User and Data Security ===== ===== Chapter 12: User and Data Security =====
  
 ==== Lesson 1: Authenticating and Authorizing Users ==== ==== Lesson 1: Authenticating and Authorizing Users ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q1: What are the three properties of //PrinciplePermission//? ** ** C12L1Q1: What are the three properties of //PrinciplePermission//? **
 +
 +/* --== Question Answer separator ==-- */
  
 Authenticated, Name, Role. Authenticated, Name, Role.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q2: What does RBS stand for? ** ** C12L1Q2: What does RBS stand for? **
 +
 +/* --== Question Answer separator ==-- */
  
 Role-Base Security Role-Base Security
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q3: What two things must be defined to make a declarative permission statement? ** ** C12L1Q3: What two things must be defined to make a declarative permission statement? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
  
   * //SecurityAction//, typically //Demand//   * //SecurityAction//, typically //Demand//
   * one or more //PrinciplePermission// properties.   * one or more //PrinciplePermission// properties.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q4: Which type of RBS security demand restricts entire methods? ** ** C12L1Q4: Which type of RBS security demand restricts entire methods? **
 +
 +/* --== Question Answer separator ==-- */
  
 Hint: Declarative or imperative? Hint: Declarative or imperative?
  
-Declarative.+Answer: Declarative. 
 + 
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q5: Which type of RBS security demand is more granular? ** ** C12L1Q5: Which type of RBS security demand is more granular? **
 +
 +/* --== Question Answer separator ==-- */
  
 Hint: Declarative or imperative? Hint: Declarative or imperative?
  
-Imperative.+Answer: Imperative. 
 + 
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q6: What must be done before making an RBS demand? ** ** C12L1Q6: What must be done before making an RBS demand? **
  
-Set the principle policy.+/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Set the principle policy. 
 + 
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q7: What must be implemented for a custom principle class based on //IIdentity// ? ** ** C12L1Q7: What must be implemented for a custom principle class based on //IIdentity// ? **
  
-//AuthenticationType//, //IsAuthenticated// and //Name//.+/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //AuthenticationType//, //IsAuthenticated// and //Name//. 
 + 
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q8: What must be implemented for a custom principle class based on //IPrinciple// ? ** ** C12L1Q8: What must be implemented for a custom principle class based on //IPrinciple// ? **
  
-Constructor, the //Identity// property, the //IsInRole// method.+/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Constructor, the //Identity// property, the //IsInRole// method. 
 + 
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q9: Scenario question ** ** C12L1Q9: Scenario question **
  
 Question: You must restrict access to a method based on a user’s group memberships in the local user database. You want to use the most secure method possible. Which technique will you use? Question: You must restrict access to a method based on a user’s group memberships in the local user database. You want to use the most secure method possible. Which technique will you use?
 +
 +/* --== Question Answer separator ==-- */
  
 Hint: //WindowsPrincipal.IsInRole// or //WindowsIdentity.IsInRole// or Imperative RBS demands or Declarative RBS demands. Hint: //WindowsPrincipal.IsInRole// or //WindowsIdentity.IsInRole// or Imperative RBS demands or Declarative RBS demands.
  
 Answer: Declarative RBS demands. Answer: Declarative RBS demands.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q10: Scenario question ** ** C12L1Q10: Scenario question **
  
 Question: You must restrict access to a method that is directly called by a Windows event. It will be based on a user’s group memberships in the local user database. If the user lacks sufficient access, you want to log an event and display a message to the user. You want to use the most secure method possible. Which technique will you use? Question: You must restrict access to a method that is directly called by a Windows event. It will be based on a user’s group memberships in the local user database. If the user lacks sufficient access, you want to log an event and display a message to the user. You want to use the most secure method possible. Which technique will you use?
 +
 +/* --== Question Answer separator ==-- */
  
 Hint: //WindowsPrincipal.IsInRole// or //WindowsIdentity.IsInRole// or Imperative RBS demands or Declarative RBS demands. Hint: //WindowsPrincipal.IsInRole// or //WindowsIdentity.IsInRole// or Imperative RBS demands or Declarative RBS demands.
  
 Answer: Imperative RBS demands. Answer: Imperative RBS demands.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L1Q11: Scenario question ** ** C12L1Q11: Scenario question **
  
 Question: You are writing a method for a console application that lists options available to a user based on his group memberships. Which technique should you use? Question: You are writing a method for a console application that lists options available to a user based on his group memberships. Which technique should you use?
 +
 +/* --== Question Answer separator ==-- */
  
 Hint: //WindowsPrincipal.IsInRole// or //WindowsIdentity.IsInRole// or Imperative RBS demands or Declarative RBS demands. Hint: //WindowsPrincipal.IsInRole// or //WindowsIdentity.IsInRole// or Imperative RBS demands or Declarative RBS demands.
Line 533: Line 2199:
 ==== Lesson 2: Using Access Control Lists ==== ==== Lesson 2: Using Access Control Lists ====
  
-** *C12L2Q1: What does DACL stand for? **+/--== Answer Question separator ==-- */ 
 + 
 +** C12L2Q1: What does DACL stand for? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Discretionary Access Control List. Answer: Discretionary Access Control List.
  
-** *C12L2Q2: What does SACL stand for? **+/--== Answer Question separator ==-- */ 
 + 
 +** C12L2Q2: What does SACL stand for? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Security Access Control List. Answer: Security Access Control List.
  
-** *C12L2Q3: What is the difference between DACLs and SACLs? **+/--== Answer Question separator ==-- */ 
 + 
 +** C12L2Q3: What is the difference between DACLs and SACLs? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: DACLs restrict access, SACLs audit (or log) access. Answer: DACLs restrict access, SACLs audit (or log) access.
  
-** *C12L2Q4: What do DACLs contain? **+/--== Answer Question separator ==-- */ 
 + 
 +** C12L2Q4: What do DACLs contain? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: ACEs (Access Control Entries) Answer: ACEs (Access Control Entries)
  
-** *C12L2Q5: Scenario question **+/--== Answer Question separator ==-- */ 
 + 
 +** C12L2Q5: Scenario question **
  
 Scenario: Mary is a member of the managers group, which has delete access to a resource. She is also a member of the accountants group, which has modify access to the resource. Scenario: Mary is a member of the managers group, which has delete access to a resource. She is also a member of the accountants group, which has modify access to the resource.
  
 Question: What access to the resource does Mary have? Question: What access to the resource does Mary have?
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Both delete and modify access. Answer: Both delete and modify access.
  
-** *C12L2Q6: Scenario question **+/--== Answer Question separator ==-- */ 
 + 
 +** C12L2Q6: Scenario question **
  
 Scenario: Mary is a member of the managers group, which has **grant** read access to a resource. She is also a member of the accountants group, which has **deny** read access to the resource. Scenario: Mary is a member of the managers group, which has **grant** read access to a resource. She is also a member of the accountants group, which has **deny** read access to the resource.
  
 Question: What access to the resource does Mary have? Question: What access to the resource does Mary have?
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: None. Answer: None.
  
-** *C12L2Q7: Scenario question **+/--== Answer Question separator ==-- */ 
 + 
 +** C12L2Q7: Scenario question **
  
 Scenario: Mary is not a member of any group that is in any of the ACEs for a resource. Scenario: Mary is not a member of any group that is in any of the ACEs for a resource.
  
 Question: What access to the resource does Mary have? Question: What access to the resource does Mary have?
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: None. Answer: None.
  
-** *C12L2Q8: What are the standard file and folder permissions? **+/--== Answer Question separator ==-- */
  
-Answer//FulControl//, //Modify//, //ReadAndExecute//, //ListDirectory//, //Read//, and //Write//.+** C12L2Q8What are the standard file and folder permissions? **
  
-** *C12L2Q9: What system resources can be secured using DACLs, SACLs and ACEs? **+/--== Question Answer separator ==-- */
  
-Answer: Filesfolders (or directories)registry keyscryptographic keysEvent Wait handles, mutexes, and semaphores.+Answer: //FullControl////Modify////ReadAndExecute////ListDirectory////Read//, and //Write//.
  
 +/* --== Answer Question separator ==-- */
 +
 +** C12L2Q9: What system resources can be secured using DACLs, SACLs and ACEs? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Files, folders (or directories), registry keys, cryptographic keys, Event Wait handles, mutexes, and semaphores.
  
 ==== Lesson 3: Encrypting and Decrypting Data ==== ==== Lesson 3: Encrypting and Decrypting Data ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L3Q1: What is the preferred symmetric encryption class? ** ** C12L3Q1: What is the preferred symmetric encryption class? **
  
-Answer//RijndaelManaged// ('Rijndael' is pronounced 'Rhine Dahl'.)+Follow up QuestionWhat is the preferred encryption algorithm also known as?
  
-Follow-up Question: What is the Rijndael encryption algorithm also known as?+Another Follow up Question: What is the next most preferred encryption algorithm?
  
-Answer: Advanced Encryption Standard (AES).+/* --== Question Answer separator ==-- */
  
-Another Follow-up QuestionWhat is the next most prefered encryption algorithm?+Answer//RijndaelManaged// ('Rijndael' is pronounced 'Rhine Dahl'.)
  
-Answer: TripleDES (not DES).+Follow up Answer: Advanced Encryption Standard (AES). 
 + 
 +Another Follow up Answer: TripleDES (not DES). 
 + 
 +/* --== Answer Question separator ==-- */
  
 ** C12L3Q2: What is the common, older, crappier symmetric encryption algorithm? ** ** C12L3Q2: What is the common, older, crappier symmetric encryption algorithm? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Data Encryption Standard (DES). Answer: Data Encryption Standard (DES).
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L3Q3: What class is used to convert a password into a key? ** ** C12L3Q3: What class is used to convert a password into a key? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //Rfc2898DeriveBytes// ('R-F-C-some numbers-derive-bytes' is ok) Answer: //Rfc2898DeriveBytes// ('R-F-C-some numbers-derive-bytes' is ok)
  
-** C12L3Q4: What are the two implementations of the //AsymmetricAlgorithm// base class? **+/--== Answer Question separator ==-- */
  
-Answer: //RSACryptoServiceProvider// and //DSACryptoServiceProvider//.+** C12L3Q4What are the two implementations of the //AsymmetricAlgorithm// base class and what is each used for? **
  
-Follow-up question: What is each used for?+/* --== Question Answer separator ==-- */
  
-Answer: //RSACryptoServiceProvider// is for asynchronous encryption and decryption; //DSACryptoServiceProvider// is for digitally signing messages.+Answer: //RSACryptoServiceProvider// and //DSACryptoServiceProvider////RSACryptoServiceProvider// is for asynchronous encryption and decryption; //DSACryptoServiceProvider// is for digitally signing messages. 
 + 
 +/* --== Answer Question separator ==-- */
  
 ** C12L3Q5: What two methods are used to convert strings to byte arrays? ** ** C12L3Q5: What two methods are used to convert strings to byte arrays? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //System.Text.Encoding.Unicode.GetBytes// and //System.Text.Encoding.Unicode.GetString//. Answer: //System.Text.Encoding.Unicode.GetBytes// and //System.Text.Encoding.Unicode.GetString//.
  
-** C12L3Q6: Which of the following classes requires both the encryptor and decryptor to have the same key? **+/--== Answer Question separator ==-- */
  
-//RSACryptoServiceProvider// (No)//RijndaelManaged// (Yes)//TripleDES// (Yes)//DSACryptoServiceProvider// (No)//DES// (Yes)//RC2// (Yes)+** C12L3Q6: Which of the following classes are synchronous and which are asynchronous? ** 
 + 
 +  * //RSACryptoServiceProvider// 
 +  * //RijndaelManaged// 
 +  * //TripleDES// 
 +  * //DSACryptoServiceProvider// 
 +  * //DES// 
 +  * //RC2// 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * //RSACryptoServiceProvider// (Asynchronous) 
 +  * //RijndaelManaged// (Synchronous) 
 +  * //TripleDES// (Synchronous) 
 +  * //DSACryptoServiceProvider// (Asynchronous) 
 +  * //DES// (Synchronous) 
 +  * //RC2// (Synchronous) 
 + 
 +/* --== Answer Question separator ==-- */
  
 ** C12L3Q7: What must be synchronized between the encryptor and decryptor when using symmetric encryption? ** ** C12L3Q7: What must be synchronized between the encryptor and decryptor when using symmetric encryption? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: The key, the IV (Initial Value) and the Mode. Answer: The key, the IV (Initial Value) and the Mode.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C12L3Q8: What are the two keyed hashing algorithms? ** ** C12L3Q8: What are the two keyed hashing algorithms? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //HMACSHA1// and //MACTripleDES//. Answer: //HMACSHA1// and //MACTripleDES//.
  
 ===== Chapter 13: Interoperation ===== ===== Chapter 13: Interoperation =====
 +
 +==== Extension ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090915 */
 +
 +** C13XQ1: What are the eight integer based COM data types and their .NET equivalent types? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * bool -> //Int32//
 +  * byte -> //Byte//
 +  * char -> //SByte//
 +  * small -> //SByte//
 +  * short -> //Int16//
 +  * long -> //Int32//
 +  * int -> //Int32//
 +  * Hyper -> //Int64//
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090915 */
 +
 +** C13XQ2: What are the four non-integer numeric COM data types and their .NET equivalent types? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * float -> //Single//
 +  * double -> //Double//
 +  * DECIMAL -> //Decimal//
 +  * CURRENCY -> //Decimal//
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090915 */
 +
 +** C13XQ3: What are the three other important COM data types and their .NET equivalent types? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * void * -> //IntPtr//
 +  * HRESULT -> //Int16// or //IntPtr//
 +  * VARIANT -> //Object//
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090915 */
 +
 +** C13XQ4: What are the five COM data types that are equivalent to //String//? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: BSTR, LPSTR, LPWSTR, char *, wchar_t *
  
 ==== Lesson 1: Using COM Objects ==== ==== Lesson 1: Using COM Objects ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L1Q1: What does RCW stand for? ** ** C13L1Q1: What does RCW stand for? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Runtime Callable Wrapper. Answer: Runtime Callable Wrapper.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L1Q2: COM components must be what before being used? ** ** C13L1Q2: COM components must be what before being used? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Registered, then imported. Answer: Registered, then imported.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L1Q3: What is used to register a COM component? ** ** C13L1Q3: What is used to register a COM component? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Regsvr32 Answer: Regsvr32
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L1Q4: What is used to import a COM component? ** ** C13L1Q4: What is used to import a COM component? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Visual Studio or Type Library Importer Tool. Answer: Visual Studio or Type Library Importer Tool.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L1Q5: When calling VB interop code, what should C# pass for optional parameters? ** ** C13L1Q5: When calling VB interop code, what should C# pass for optional parameters? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //Type.Missing// Answer: //Type.Missing//
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L1Q6: What are the four shortcomings of COM interop? ** ** C13L1Q6: What are the four shortcomings of COM interop? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Static members, parameterised constructors, inheritance, portability. Answer: Static members, parameterised constructors, inheritance, portability.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q7: When generating metadata from a type library, what is the resulting assembly called? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: An interop assembly.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q8: What are the four options for generating an interop assembly containing type metadata? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Visual Studio.
 +  * Type Library Importer (Tlbimp.exe).
 +  * The //TypeLibConverter// class.
 +  * Custom wrappers.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q9: What can the //TypeLibConverter// class do that the Type Library Importer can not? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It can convert an in-memory type library to metadata.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q10: What are the four high level steps to expose a COM component to the .NET Framework? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Import a type library as an assembly.
 +  - Create COM types in managed code.
 +  - Compile an interop project.
 +  - Deploy an interop application.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q11: How are COM types that are defined in an assembly used differently from other managed types? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: They aren't used differently (tricky).
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q12: How is compiling an interop project different from compiling a managed project? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It isn't different (tricky).
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q13: What three things does an interop application contain? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * A .NET client assembly.
 +  * One or more interop assemblies.
 +  * One or more registered COM components.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q14: Where should private assemblies be installed? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The same directory as the application.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q15: What must a shared assembly have and where is it installed? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It must have a strong name and be installed in the Global Assembly Cache (GAC).
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L1Q16: What is a primary interop assembly? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: A unique, vendor-supplied, strong named, interop assembly that contains type definitions (as metadata) of types implemented with COM.
 +
 +==== Lesson 2: Exposing .NET Components to COM ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q1: When .NET components are consumed by COM, what handles the marshalling between .NET and COM? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The COM Callable Wrapper (CCW).
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q2: How do you hide a public .NET class from COM? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Give it a //ComVisible// attribute and pass in false.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q3: What are the four options for generating a type library for COM? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Type Library Exporter (Tlbexp.exe)
 +  * Using the //TypeLibConverter// class.
 +  * Assembly Registration Tool (Regasm.exe)
 +  * .NET Services Installation Tool (Regsvcs.exe)
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q4: What are the five guidelines for qualifying .NET types for interoperation? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Classes should implement interfaces explicitly.
 +  * Managed types must be public.
 +  * Methods, properties, fields and events must be public.
 +  * Types must have a public default constructor to be activated from COM.
 +  * Types can not be abstract.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q5: What public parts of a class are not exposed to COM clients? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Parameterised constructors, static methods and constant fields.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q6: What does the Assembly Registration tool do and what .NET class provides the equivalent functionality? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The Assembly Registration tool generates a type library and then registers it so that COM clients can use the .NET class transparently, or it can unregister an assembly. The equivalent class is //RegistrationServices//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q7: What is the difference between the Type Library Exporter and the Assembly Registration tool? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The Type Library Exporter generates a type library but does not register it. The Assembly Registration tool does both.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q8: How do you use the Type Library Exporter to generate a subset of the types defined in an assembly? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: You can't - the entire assembly is converted at once (tricky).
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q9: How can an interop assembly be activated from any COM client? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: After registering it, install it in the Global Assembly Cache (GAC).
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q10: When using the Assembly Registration tool, what does the ''/tlb'' option do? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It causes the Assembly Registration tool to generate a type library in addition to registering the types.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L2Q11: When should the ''/tlb'' option of the Assembly Registration tool not be used? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: If the assembly was produced by the Type Library Importer.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090914 */
 +
 +** C13L2Q12: What are the three actions that the .NET Services Installation tool performs? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * Loads and registers an assembly.
 +  * Generates, registers and installs a type library into a specified COM+ 1.0 application.
 +  * Configures services that you have added programmatically to your class.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090914 */
 +
 +** C13L2Q13: What must an assembly have before it can be used by the .NET Services Installation tool? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: A strong name.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20090914 */
 +
 +** C13L2Q14: What two security considerations does the .NET Services Installation tool have? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * It can not register components with methods protected by a demand or link demand for the //StrongNameIdentityPermission// or the //PublisherIdentityPermission//.
 +  * You must have administrative privileges on the local computer to use the .NET Services Installation tool.
  
 ==== Lesson 3: Using Unmanaged Code ==== ==== Lesson 3: Using Unmanaged Code ====
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L3Q1: A Runtime Callable Wrapper is used for what? ** ** C13L3Q1: A Runtime Callable Wrapper is used for what? **
 +
 +/* --== Question Answer separator ==-- */
  
 Hint: External libraries or P/Invokes? Hint: External libraries or P/Invokes?
  
 Answer: External libraries. Answer: External libraries.
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L3Q2: When using P/Invoke calls, which type is best for passing text? ** ** C13L3Q2: When using P/Invoke calls, which type is best for passing text? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: //StringBuilder// Answer: //StringBuilder//
 +
 +/* --== Answer Question separator ==-- */
  
 ** C13L3Q3: How do you specify what unmanaged type a property should be? ** ** C13L3Q3: How do you specify what unmanaged type a property should be? **
 +
 +/* --== Question Answer separator ==-- */
  
 Answer: Add a //MarshalAs// attribute and specify an //UnmanagedType//. Answer: Add a //MarshalAs// attribute and specify an //UnmanagedType//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L3Q4: What attribute is used to specify a library when creating a P/Invoke? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //DllImport//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L3Q5: What attribute is used to determine what order members of a structure are stored in memory? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //StructLayoutAttribute//
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C13L3Q6: What are the three methods for determining what order members of a structure are stored in memory and how are they specified? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Auto, sequential and explicit. An instance of //LayoutKind// is passed to the attribute //StructLayout//.
 +
 +===== Chapter 14: Reflection =====
 +
 +==== Lesson 1: Understanding Reflection ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L1Q1: What are the four parts of an assembly? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Assembly metadata (or manifest), type metadata, code and resources.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L1Q2: What is the relationship between assemblies, modules and types? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: An assembly can contain one or more modules (although typically just one). A module can contain one or more types. An assembly can not directly contain a type (or types must be contained in a module).
 +
 +==== Lesson 2: Assembly Attributes ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L2Q1: How do you get a reference to the current assembly? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call the //Assembly.GetExecutingAssembly// method.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L2Q2: Using reflection, how can you get a collection of all the attributes that a class has? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call the //Assembly.GetCustomAttributes// method, which will return an array.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L2Q3: What happens when the revision part of the version number in the //AssemblyVersionAttribute// is set to an asterisk? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It will be replaced with a random number by the compiler.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L2Q4: What happens when the build part of the version number in the //AssemblyVersionAttribute// is set to an asterisk? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: It will be replaced with an automatically incrementing number by the compiler.
 +
 +==== Lesson 3: Reflecting Types ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L3Q1: How do you create a //Type// object based on a particular object? **
 +
 +Follow up question: How do you create a //Type// object based on a particular class?
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Call the object's //GetType// method.
 +
 +Follow up answer: Use the //typeof// keyword.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L3Q2: If a //string// has been cast into a variable of type //object//, what will calling the method //GetType// on the variable return? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: A //Type// object that represents the __string__ class.
 +
 +==== Lesson 5: Creating Code at Runtime ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C14L5Q1: Which class is used to create a dynamic assembly? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //AppDomain//.
  
 ===== Chapter 15: Mail ===== ===== Chapter 15: Mail =====
Line 676: Line 2857:
 ==== Lesson 1: Sending Mail ==== ==== Lesson 1: Sending Mail ====
  
-** C15L1Q1: What exception will be thrown if you call //SmtpClient.Send// and ... **+/--== Answer Question separator ==-- */
  
-  the server hostname has not been defined? Answer: //InvalidOperationException//+** C15L1Q1What exception will be thrown if you call //SmtpClient.Send// and the server hostname is defined but the server cannot be found? **
-  * the server hostname is defined but the server cannot be found? Answer: //SmtpException// with an inner //WebException//+
-  the SMTP server reports that the recipient is invalid? Answer: //SmtpFailedRecipientException//+
-  any other problem occurs? Answer: //SmtpException//.+
  
-** C15L1Q2: Which method would you call to send an e-mail message and wait for the transmission to complete before proceeding? **+/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //SmtpException// with an inner //WebException//
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C15L1Q2: What exception will be thrown if you call //SmtpClient.Send// and any other problem occurs? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //SmtpException//
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C15L1Q3: What exception will be thrown if you call //SmtpClient.Send// and the server hostname has not been defined? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //InvalidOperationException//
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C15L1Q4: What exception will be thrown if you call //SmtpClient.Send// and the SMTP server reports that the recipient is invalid? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: //SmtpFailedRecipientException//
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** C15L1Q5: Which method would you call to send an e-mail message and wait for the transmission to complete before proceeding? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //SmtpClient.Send// Answer: //SmtpClient.Send//
  
-** C15L1Q3: Which method would you call to send an e-mail message and __not__ wait for the transmission to complete before proceeding? **+/* --== Answer Question separator ==-- */ 
 + 
 +** C15L1Q6: Which method would you call to send an e-mail message and __not__ wait for the transmission to complete before proceeding? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: //SmtpClient.SendAsync// Answer: //SmtpClient.SendAsync//
  
-** C15L1Q4: How do you talk to the SMTP server securely? **+/--== Answer Question separator ==-- *
 + 
 +** C15L1Q7: How do you talk to the SMTP server securely? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Set //SmtpClient.EnableSsl// to true. Answer: Set //SmtpClient.EnableSsl// to true.
 +
 +===== Chapter 16: Globalization =====
 +
 +==== Lesson 1: Using Culture Information ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C16L1Q1: What are the three culture categories? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Invariant, neutral and specific.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** C16L1Q2: How can a string comparison be made that is specific to a culture and can use the //CompareOptions// class? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - Create or get a reference to an //CultureInfo// object.
 +  - Get a reference to the //CompareInfo// property of the //CultureInfo// object.
 +  - Call the //Compare// method on the //CompareInfo// object and pass in the two strings to be compared and any //CompareOtions// required. 
 +
 +====== Web Exam 70-528 Study Questions ======
 +
 +===== Chapter 1: Introducing the ASP.NET 2.0 Web Site =====
 +
 +==== Lesson 1: Understanding The Players ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** WebC1L1Q1: What are the four main HTTP methods? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Get, post, put and delete.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** WebC1L1Q2: What are the five common MIME types? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Text, image, audio, video and application.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** WebC1L1Q3: What is the difference between where form data is stored in a GET request and a POST request? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: In a GET request, the form data is put in the query string. In a POST request, the data is put in the message body.
 +
 +==== Lesson 2: Creating a Web Site ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** WebC1L2Q1: What are the three sections of an in-line ASPX file? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Page directives, code, layout.
 +
 +==== Lesson 3: Working with Web Configuration Files ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** WebC1L3Q1: What are the five levels, in order, of the ASP.NET configuration hierarchy? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Global machine, root default web, web site, web application, sub-directory.
 +
 +==== Lesson 4: Using ASP.NET Trace ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** WebC1L4Q1: What is the virtual page that displays trace information? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Trace.axd.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** WebC1L4Q2: What are the two methods of configuring the trace facility? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Using the Website Administration Tool and editing the web.config file.
 +
 +===== Chapter 2: Adding and Configuring Server Controls =====
 +
 +==== Lesson 1: Using a Server Control ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** WebC2L1Q1: How should the source of bloat in the //ViewState// be identified? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: By using the trace facility.
 +
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20117012 */
 +
 +** WebC2L1Q2: What must an HTML server control be located inside to operate correctly? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: A form element that has the //runat="server"// attribute.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20117012 */
 +
 +** WebC2L1Q3: What are the three methods of setting the properties of an HTML control? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Source view, design view and programmatically in code.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20117012 */
 +
 +** WebC2L1Q4: In which event on what object should dynamically created controls be created? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The Init event on the page object.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20117012 */
 +
 +** WebC2L1Q5: What order are events from a web page raised on the server side? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The event that caused the postback is processed last.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20117012 */
 +
 +** WebC2L1Q6: What property on a control should be set to minimize the size of the //ViewState// data? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The //EnableViewState// should be set to //false//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20117012 */
 +
 +** WebC2L1Q7: What are the five main page events, in the order they occur? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Page_PreInit//, //Page_Init//, //Page_Load//, //Page_PreRender// and //Page_Unload//
 +
 +==== Lesson 2:  Exploring Common Web Server Controls ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20117012 */
 +
 +** WebC2L2Q1: What are two differences between the //Literal// control and the //TextBox// control? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  * The //Literal// control does not support styles, themes, and skins.
 +  * The //Literal// control does not inherit from //WebControl//.
 +
 +===== Chapter 3: Exploring Specialized Server Controls =====
 +
 +==== Lesson 1: Exploring Specialized Web Server Controls ====
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110823 */
 +
 +** WebC3L1Q1: What are the three modes of the //Literal// control? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //PassThrough//, //Encode// and //Transform//.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110823 */
 +
 +** WebC3L1Q2: What is the advantage of using the //Table//, //TableRow// and //TableCell// controls over using straight HTML markup? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: The ability to add rows and cells programmatically.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110824 */
 +
 +** WebC3L1Q3: What web control should be used if clicking on an image is required? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //ImageButton// or //ImageMap//.
  
 ====== IT Questions ====== ====== IT Questions ======
  
-** *ITQ1: What is the definition of third normal form? **+/--== Answer Question separator ==-- */ 
 + 
 +** ITQ1: What is the definition of third normal form? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: "Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key." Answer: "Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key."
  
-** *ITQ2: What is Brooks' Law? **+/--== Answer Question separator ==-- */ 
 + 
 +** ITQ2: What is Brooks' Law? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: "Adding resources to a late project makes it later." Answer: "Adding resources to a late project makes it later."
 +
 +/* --== Answer Question separator ==-- */
 +
 +** ITQ3: What is the Unicode number for the snowman character? **
 +
 +<html>
 +<span style="font-size:60px">&#9731;<span>
 +</html>
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: 2603 (Hex).
 +
 +/* --== Answer Question separator ==-- */
 +
 +** ITQ4: What are Robert Martin's three laws of Test Driven Development? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer:
 +
 +  - You are not allowed to write a line of production code until you have written a failing unit test.
 +  - You are not allowed to write more of the unit test than is sufficient to fail.
 +  - You are not allowed to write more production code than is sufficient to pass the test.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** ITQ5: What is Conway's Law? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: "Organisations which design systems are constrained to produce designs which are copies of the communication structures of these organisations." - Melvin Conway, 1968.
 +
 +/* --== Answer Question separator ==-- */
 +
 +** ITQ6: What is the difference between //Cast// and //Convert// in T-SQL? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: //Cast// is ANSI compliant. //Convert// is specific to SQL Server and allows some formatting options.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20091017 */
 +
 +** ITQ7: What type of URL should destructive or data modifying operations be put behind and why? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: They should be put behind HTTP-POST requests because web-crawlers and search engines are not supposed to follow them.
 +
 +/* --== Answer Question separator ==-- */
 +
 +/* Added 20110708 */
 +
 +** ITQ8: What should be looked for in a code review? **
 +
 +/* --== Question Answer separator ==-- */
 +
 +Answer: Correctness (only).
  
 ====== Fractal Questions ====== ====== Fractal Questions ======
  
-** *FractalQ1: What should be done first if a layer is too 'busy' or has a lot of noise? **+/--== Answer Question separator ==-- */ 
 + 
 +** FractalQ1: What should be done first if a layer is too 'busy' or has a lot of noise? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Lower the bailout parameter on the formula tab. Answer: Lower the bailout parameter on the formula tab.
  
-** *FractalQ2: What should be done if a layer has 'black holes'? **+/--== Answer Question separator ==-- */ 
 + 
 +** FractalQ2: What should be done if a layer has 'black holes'? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Increase the Maximum Iterations parameter on the formula tab. Answer: Increase the Maximum Iterations parameter on the formula tab.
Line 717: Line 3241:
 ====== Life Questions ====== ====== Life Questions ======
  
-** *LifeQ1: Whose fault should you always assume it is? **+/--== Answer Question separator ==-- */ 
 + 
 +** LifeQ1: Whose fault should you always assume it is? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Your own fault. Answer: Your own fault.
  
-** *LifeQ2: Went things are shit, what question should you ask? **+/--== Answer Question separator ==-- */
  
-Answer: "What can I do about it?"+** LifeQ2: When things are shit, what question should you ask? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: "What can **I** do about it?" 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** LifeQ3: What is the effect / affect usage mnemonic? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: VANE - **V**erb **A**ffect **N**oun **E**ffect 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090915 */ 
 + 
 +** LifeQ4: If you are afraid of being embarrassed or laughed at, what will your art always be? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Embarrassing and laughable. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** LifeQ5: What two things should every person with a job be doing? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * The very best they can at their job. 
 +  * Looking for a better job.
  
 ====== The Pragmatic Programmer ====== ====== The Pragmatic Programmer ======
  
-** *PragPreQ1: What is the most basic characteristic of a Pragmatic Programmer? **+===== Preface ===== 
 + 
 +/--== Answer Question separator ==-- */ 
 + 
 +** PragPreQ1: What is the most basic characteristic of a Pragmatic Programmer? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: They care about their craft. Answer: They care about their craft.
  
-** *PragPreQ2: What are the five lesser characteristics of a Pragmatic Programmer? **+/--== Answer Question separator ==-- */ 
 + 
 +** PragPreQ2: What are the five lesser characteristics of a Pragmatic Programmer? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: Early adopter / fast adapter, Inquisitive, Critical thinker, Realistic, and Jack of all trades. Answer: Early adopter / fast adapter, Inquisitive, Critical thinker, Realistic, and Jack of all trades.
  
-** *PragPreQ3: How does one become a Pragmatic Programmer? **+/--== Answer Question separator ==-- */ 
 + 
 +** PragPreQ3: How does one become a Pragmatic Programmer? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: THINK! about one's work and continuously make many small improvements. Answer: THINK! about one's work and continuously make many small improvements.
  
-** *PragC1Q1: What is the 'Broken Window Theory' and how does it apply to software development? **+===== Chapter 1 ===== 
 + 
 +/--== Answer Question separator ==-- */ 
 + 
 +** PragC1Q1: What is the 'Broken Window Theory' and how does it apply to software development? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 Answer: ... Answer: ...
  
-{{tag>reference mcts study exam}}+/* --== Answer Question separator ==-- */ 
 + 
 +** PragC1Q2: What type of soup should you make when being a catalyst for change? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Hint: Stone soup or frog soup. 
 + 
 +Answer: Stone soup. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC1Q3: Great software today is often preferable to what? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Perfect software tomorrow. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC1Q4: Perfect software tomorrow is often less preferable to what? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Great software today. 
 + 
 +===== Chapter 2: A Pragmatic Approach ===== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q1: When does software maintenance begin and why? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Software maintenance begins as soon as coding starts, because things keep changing (requirements and our understanding of them, environments, knowledge etc.) 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q2: What is the //DRY// principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Don't Repeat Yourself. 
 + 
 +//"Every piece of knowledge must be a single unambiguous, authoritative representation with in a system."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q3: What are the four categories of duplication? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Hint: The four //i//'s of duplication. 
 + 
 +Answer: 
 + 
 +  * //Imposed// - Developers feel they have no choice - the environment appears to require duplication. 
 +  * //Inadvertent// - Developers don't realise they are duplicating information. 
 +  * //Impatient// - Developers get lazy and duplicate because it seems easier. 
 +  * //Interdeveloper// - Multiple people on a team (or different teams) duplicate information. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q4: What is a technique for avoiding or reducing imposed duplication? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Code generation. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q5: What is Meyer's //Uniform Access principle//? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"All services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation."// 
 + 
 +or 
 + 
 +//"Class properties are good."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q6: What are two techniques for avoiding or reducing inadvertent duplication? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Normalise the data and don't store what can be calculated. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q7: What should be done if the //DRY// principle needs to be violated for performance reasons? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Ensure the violation is not exposed to the outside world by keeping it contained with in the class. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q8: How do you avoid impatient duplication? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Discipline. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q9: What adage relates to impatient duplication? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"Short cuts make for long delays."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q10: What is orthogonality? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Independence or decoupling. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q11: What are the two major benefits of orthogonality? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Increased productivity and reduced risk. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q12: How can you get an informal measurement of how orthogonal a team is? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Determine how many people __need__ to be involved in discussing each change that is requested. The less people, the more orthogonal and better off the team is. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q13: How can low orthogonality affect a team? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Confusion over responsibilities leading to bickering. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q14: What are three techniques to maintain orthogonality? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Keep code decoupled. 
 +  * Avoid global data. 
 +  * Avoid similar functions. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q15: How is orthogonality related to unit testing? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * If the unit test does not require much set up, the unit has a good amount of orthogonality. 
 +  * If the unit test has to bring in a big chunk of the system to set up the test, the unit has little orthogonality. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q16: What is code that glows in the dark? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Tracer code. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q17: What are the four aspects of code that tracer code should share with production code and what is the one aspect that it should not? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +Shared: error checking, structuring, documentation and self-checking. 
 + 
 +Not shared: Full functionality. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q18: What are the five advantages of tracer code? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Users get to see something early. 
 +  * Develops a build structure to work in. 
 +  * Creates an integration platform. 
 +  * Creates something to demonstrate. 
 +  * Creates a better feel for progress. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q19: What is the difference between tracer code and prototyping? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Prototyping generates disposable code. Tracer code is lean but complete and forms part of the skeleton of the final system. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q20: What are seven types of things that are good to prototype? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Risky, untried, critical, unproven, experimental, doubtful or uncomfortable things. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q21: What are six parts of a system that are good to prototype? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * The architecture. 
 +  * New functionality in an existing system. 
 +  * The structure or contents of external data. 
 +  * Third-party tools or components. 
 +  * Performance issues. 
 +  * The user interface. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC2Q22: What are four aspects of coding that can, when appropriate, be ignored while prototyping? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Correctness, completeness, robustness and style. 
 + 
 +===== Chapter 3: The Basic Tools ===== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC3Q1: What are the three benefits of plain text? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Insurance against obsolescence 
 +  * Leverage 
 +  * Easier testing 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** PragC3Q2: What are three situations that make tracing statements invaluable? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Concurrent processes 
 +  * Real-time systems 
 +  * Event-based applications 
 + 
 +===== Chapter 5: Bend or Break ===== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090929 */ 
 + 
 +** PragC5Q1: What is the Law of Demeter? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Any method of an object should call only methods belonging to: 
 + 
 +  * itself, 
 +  * any parameters that were passed into the method, 
 +  * any object it created, or 
 +  * any directly held component objects. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090929 */ 
 + 
 +** PragC5Q2: What is the response set of a class? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The number of functions directly invoked by methods of the class. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** PragC5Q3: What us Levy's Eight Law? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer:  
 + 
 +"No amount of genius can overcome a preoccupation with detail." 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** PragC5Q4: What type of diagram can be used to determine temporal coupling? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: A UML activity diagram. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** PragC5Q5: What should be analysed to improve concurrency? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Workflow. 
 + 
 +===== Chapter 6: While You Are Coding ===== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** PragC6Q1: What are three examples of programming by coincidence? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Accidents of implementation. 
 +  * Accidents of context. 
 +  * Implicit assumptions. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** PragC6Q2: What should you do if something __seems__ to work? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Make sure it isn't just a coincidence. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** PragC6Q3: What is the problem with the building metaphor of software development? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Buildings are not normally refactored. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** PragC6Q4: What are four reasons for refactoring? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Duplication (violation of the DRY principle). 
 +  * Non-orthogonal design. 
 +  * Outdated knowledge. 
 +  * Performance. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** PragC6Q5: What are Martin Fowler's three tips on refactoring? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Don't refactor and add functionality at the same time. 
 +  * Make sure there are good tests beforehand. 
 +  * Take short, deliberate steps. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091012 */ 
 + 
 +** PragC6Q6: What four capabilities should a test harness include? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * A standard way to specify setup and clean up. 
 +  * A method for selecting individual tests or all available tests. 
 +  * A means of analysing output for expected (or unexpected) results. 
 +  * A standardised form of failure reporting. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091012 */ 
 + 
 +** PragC6Q7: What should be done at the end of any debugging session? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Formalise any ad hoc tests into unit tests. 
 + 
 +====== Professional ASP.NET MVC 1.0 ====== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100620 */ 
 + 
 +** MvcC1Q1: What are the six top-level directories, created by default when a new ASP.NET MVC project is created? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Controllers, Models, Views, Scripts, Content and App_Data. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100620 */ 
 + 
 +** MvcC1Q2: Where does ASP.NET MVC store its routing rules? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: In the Global.asax file. 
 + 
 +====== Article 1: Design Principles and Design Patterns, Robert C. Martin ====== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P2Q1: What are the four primary symptoms of rotting design? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Rigidity (changes cascade) 
 +  * Fragility (breaks whenever it is changed) 
 +  * Immobility (inability to reuse software from other projects or part of the system) 
 +  * Viscosity (easier for the engineers to break the design with hacks rather than preserve it) 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P4Q1: What kind of requirements changes cause design rot? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Changes that introduce new and unplanned for __dependencies__. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P4Q2: What technique can be used to prevent degradation of the dependency architecture? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Dependency firewalls. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P4Q3: What is the Open Closed Principle and who came up with it? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"A module should be open for extension, but closed for modification."// - Bertrand Meyer 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P5Q1: What is the key to the OCP? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Abstraction. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P8Q1: What is the Liskov Substitution Principle and who came up with it? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"Subclasses should be substitutable for their base classes."// - Barbara Liskov 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P8Q2: What is the canonical example of the subtleties of the LSP? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The Circle / Ellipse dilemma. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P12Q1: Violations of the LSP are also what? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Violations of the OCP. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +** Art1P12Q2: What is the Dependency Inversion Principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"Depend on abstractions. Do not depend on concretions."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P12Q3: Which principle states the goal of object orientated architecture and which states the primary mechanism? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The goal is stated by the Open Closed Principle and the primary mechanism is stated by the Dependency Inversion Principle. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P14Q1: Where is the most common places that designs depend on concrete classes? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: When instances are created. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P14Q2: What is the Interface Segregation Principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"Many client specific interfaces are better than one general purpose interface."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P16Q1: What means of organising a design has larger granularity than classes? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Packages. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P16Q2: What are the three principles of package architecture? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * The Release Reuse Equivalency Principle 
 +  * The Common Closure Principle 
 +  * The Common Reuse Principle 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P17Q1: What is the Release Reuse Equivalency Principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"The granule of reuse is the granule of release."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P17Q2: What is the Common Closure Principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"Classes that change together, belong together."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P17Q3: What is the Common Reuse Principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"Classes that aren't reused together should not be grouped together."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P18Q1: Which package architecture principle or principles tends to advantage reusers and which tends to advantage maintainers? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Reusers are advantaged by the Release Reuse Equivalency Principle and the Common Reuse Principle. Maintainers are advantaged by the Common Closure Principle. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P18Q2: Which package architecture principle or principles tends to make packages large which tends to make them small? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The Common Closure Principle tends to make large packages and the Common Reuse Principle tends to make small packages. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P18Q3: Which package architecture principle or principles would architects tend to use in the early life of a system and which would they tend to use when the system has matured? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: In early life, the Common Closure Principle tends to be used. When the system has matured the Release Reuse Equivalency Principle and the Common Reuse Principle tend to be used. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P18Q4: What are the three principles of package coupling? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * The Acyclic Dependencies Principle 
 +  * The Stable Dependencies Principle 
 +  * The Stable Abstraction Principle 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P18Q5: What is the Acyclic Dependencies Principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"The dependencies between packages must not form cycles."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P21Q1: What are two methods for breaking a cycle in a package dependency structure? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Add a new package. 
 +  * Add a new interface that has all the methods that one package is dependant on and is implemented by the other package. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** Art1P21Q2: What design pattern should be used when a client type class directly depends on a server type class? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: An Abstract Server. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** Art1P21Q3: What is the Abstract Server design pattern and what is its advantage? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: An Abstract Server is an abstract interface between a client and a server. Its advantage is that the abstract interface becomes a "hinge point" that design can flex around. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P22Q1: Which package would an interface very often go in? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The package that uses it, rather than the package that implements it. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P22Q2: What is the Stable Dependencies Principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"Depend in the direction of stability."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P23Q1: What is a package that has three other packages depending on it said to be? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Responsible to those three other packages. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P23Q2: What is a package that depends on nothing said to be? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: An independent package. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P23Q3: What is a package that has no other packages depending on it said to be? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: An irresponsible package. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P23Q4: What is a package that has three other packages depending on it said to be? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: A dependant package. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P23Q5: What is a package that is independent and responsible to other packages said to be? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: A stable package. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P23Q6: What is an irresponsible, dependant package said to be? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: An instable package. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090917 */ 
 + 
 +** Art1P24Q1: What is the Stable Abstraction Principle? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +//"Stable packages should be abstract packages."// 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P24Q2: What is afferent coupling? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The number of classes outside the package that depend on classes inside the package. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P24Q3: What is efferent coupling? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The number of classes outside the package that classes inside the package depend on. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P24Q4: What is the formula for determining the instability of a package? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Instability equals efferent coupling divided by afferent coupling plus efferent coupling. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P26Q1: What is the formula for determining the abstractness of a package? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Abstractness equals the number of abstract classes in the package divided by the total number of classes. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P26Q2: What type of packages occupy the zone of uselessness? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Instable, abstract packages. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P26Q3: What type of packages occupy the zone of pain? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Stable, concrete packages. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20090925 */ 
 + 
 +** Art1P26Q4: What is the formula for determining the distance a package is from the main sequence? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The absolute value of the abstractness plus instability minus one. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** Art1P29Q1: What design pattern should be used when inserting an abstract interface is not feasible? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Adapter. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20091007 */ 
 + 
 +** Art1P29Q2: What is the Adapter design pattern? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The Adapter is an object that implements the abstract interface to delegate to the server. Every method of the adapter simply translates and then delegates. 
 + 
 +====== 59 Seconds - Think a little, change a lot, Professor Richard Wiseman ====== 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecHappinessQ1: What is materialism mainly driven by? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Low self-esteem. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecHappinessQ2: How does one buy happiness? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: By buying experiences, not goods. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecHappinessQ3: What are three ways to feel more happy? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Smile, sit up and act happy. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecPersuasionQ1: What are the three steps to giving a great job interview? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Likeability is more important than academic achievements and work experience. 
 +  * Reveal weaknesses early and strengths late. Retain something strong for the end. 
 +  * Don't overreact to mistakes - the interviewer probably didn't notice. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecPersuasionQ2: What is the Spontaneous Trait Transference Effect? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: When criticising someone else, observers will attribute the negative traits to the speaker. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecPersuasionQ3: What is the Franklin Effect? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Getting someone to do you a favour will increase the chance of them liking you. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecPersuasionQ4: What is the Pratfall Effect? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: The occasional mistake can make you more likeable. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecPersuasionQ5: What should you do if you require assistance in the street? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Pick out a friendly face in the crowd. Clearly tell them what is happening and what they need to do. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecMotivationQ1: What is the rule to beat procrastination? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: Work on the activity for "just a few minutes"
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecMotivationQ2: What are the four key techniques to achieve a goal? ** 
 + 
 +/* --== Question Answer separator ==-- */ 
 + 
 +Answer: 
 + 
 +  * Have a plan. 
 +  * Tell friends a family. 
 +  * Doublethink. Focus on the benefits //and// potential setbacks. 
 +  * Reward each step of the way. 
 + 
 +/* --== Answer Question separator ==-- */ 
 + 
 +/* Added 20100106 */ 
 + 
 +** 59SecMotivationQ3: What visualisation technique should be used to provide motivation to achieve goals and how does it work? ** 
 + 
 +/* --== Question Answer separator ==-- */
  
 +Answer: Doublethink. Imagine both the potential benefits from achieving the goal //and// the potential setbacks that may occur along the way.
  
 +{{tag>reference mcts study_questions exam}}
study_questions.1249006245.txt.gz · Last modified: 2017/01/01 19:53 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki