This is an old revision of the document!
Table of Contents
Study Questions - Audio Creation
CDEx Settings
Bitrate = 80 kbps
Mono
Quality = Very high (q = 0)
Questions To Be Recorded
C8L3Q1: How do you debug a service?
Answer: Install it, start it and then attach a debugger to the service's process.
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?
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.
C8L3Q3: What four things does the ServiceInstaller class define?
Answer: The service description, display name, service name and start type.
C8L3Q4: What does the ServiceProcessInstaller class define?
Answer: The service account settings.
C8L3Q5: What are the three start types for a service and which is the default?
Answer: Automatic, manual (default) and disabled.
C8L3Q6: What are the four types of accounts that can be used 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?
Answer:
- Local service (most secure)
- Network service
- Local system (most privileged)
- User (default)
C8L3Q7: What tool is used to manually install a service?
Answer: InstallUtil.exe.
Lesson 1: Configuration Settings
C9L1Q1: What are two most important classes used to deal with application settings and what namespace are they in?
Answer: Configuration and ConfigurationManager, which are in the System.Configuration namespace.
C9L1Q2: What are the four ConfigurationManager methods that open various configurations?
Answer:
- OpenExeConfiguration
- OpenMachineConfiguration
- OpenMappedExeConfiguration
- OpenMappedMachineConfiguration
C9L1Q3: What should you always do before opening a mapped configuration file and why?
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.
C9L1Q4: How can you specify which version of the .NET Framework an application should be run with?
Answer: Add a supportedRuntime entry in the startup section of the configuration file.
C9L1Q5: Which is obsolete, ConfigurationSettings or ConfigurationManager?
Answer: ConfigurationSettings
C9L1Q6: What are the two default properties of the ConfigurationManager class used to store configuration information?
Answer: AppSettings and ConnectionString.
C9L1Q7: What is the default file name for putting configuration settings in?
Answer: App.config.
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?
Answer: configuration → appSettings.
Follow up answer: The element name is 'add' and the two attributes should be 'key' and 'value'.
C9L1Q9: How would you read a setting called 'foo' from the application settings file?
Answer: Call ConfigurationManager.AppSettings[“foo”] and store the result in a String.
Lesson 2: Creating an Installer
C9L2Q1: What are the two specific predefined installers?
Answer: AssemblyInstaller and ComponentInstaller.
C9L2Q2: What methods should be overridden when creating a custom Installer class?
Follow up question: What two events can also be responded to?
Answer: Install, Commit, Rollback and Uninstall.
Follow up answer: Committing and Committed.
C9L2Q3: Other than overriding methods and responding to events, what else needs to be done to create a custom Installer class?
Answer: Add the RunInstallerAttribate to the custom class and set the runInstaller parameter to true.
Lesson 3: Using the .NET Framework 2.0 Configuration Tool
C9L3Q1: What are the code groups in the .NET Framework named after?
Answer: The evidence they provide.
Chapter 10: Instrumentation
Lesson 1: Logging Events
C10L1Q1: Which account have enough privileges to write to the Windows event log?
Answer: The Local System account.
C10L1Q2: Which logs are available by default in the Windows event log mechanism?
Answer: Application, Security and System.
Lesson 2: Debugging and Tracing
C10L2Q1: How can you programmatically signal a break to the debugger?
Answer: Call the Debugger.Log.
Chapter 2
PragC2Q1: When does software maintenance begin and why?
Answer: Software maintenance begins as soon as coding starts, because things keep changing (requirements and our understanding of them, environments, knowledge etc.)
PragC2Q2: What is the DRY principle?
Answer: Don't Repeat Yourself.
“Every piece of knowledge must be a single unambiguous, authoritative representation with in a system.”
PragC2Q3: What are the four categories of duplication?
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.
PragC2Q4: What is a technique for avoiding or reducing imposed duplication?
Answer: Code generation.
Amy Update Only
C5L2Q2: What are the three steps to serialise data to XML?
Answer:
- Create or get a reference to a stream, TextWriter, or XmlWriter object to hold the serialised output.
- 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.
C5L2Q3: What are the three steps to deserialise data from XML?
Answer:
- Create or get a reference to a stream, TextReader, or XmlReader object to read the serialised input.
- 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.