<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7893310777906730197</atom:id><lastBuildDate>Wed, 11 Nov 2009 12:34:00 +0000</lastBuildDate><title>.NET Code Catto Blogger Blog</title><description>&lt;a href="http://www.ChrisCatto.com/"&gt;Chris Catto.com's Lovin' Life&lt;/a&gt;     |||||    &lt;a href="http://chriscatto.blogspot.com/"&gt;.NET Code Catto's Blog Home&lt;/a&gt;</description><link>http://chriscatto.blogspot.com/</link><managingEditor>noreply@blogger.com (Catto)</managingEditor><generator>Blogger</generator><openSearch:totalResults>73</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Catto" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-768964287258072034</guid><pubDate>Fri, 02 Oct 2009 02:13:00 +0000</pubDate><atom:updated>2009-10-01T22:13:18.402-04:00</atom:updated><title>SW FLA Code Camp .NET Exam Cram</title><description>&lt;p&gt;Hey Now Everybody,&lt;/p&gt;  &lt;p&gt;Saturday is our SW Florida Code Camp &amp;amp; I’m presenting my session .NET Exam Cram. It’s going to be based on exam 70-536 which is the .NET Foundations exam. Also we’ll discuss topics that we’ll use everyday. This session will be great for beginners to guru’s. These topics will make us more efficient in our everyday tasks, also we’ll discuss positive personal productivity. The session is scheduled for &lt;/p&gt;  &lt;p&gt;Room 124 @ 4:15pm Saturday Oct. 3rd 2009. &lt;/p&gt;  &lt;p&gt;There will also be a surprise free give away to one lucky person. If you can’t make the session much of the content is outlined below:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://chriscatto.blogspot.com/2009/07/windows-7-top-features-win7.html" target="_blank"&gt;Windows 7&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://chriscatto.blogspot.com/2008/10/browsers-linksbookmarks-toolbar.html" target="_blank"&gt;Browsers&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/06/firefox-35-your-default-browser.html" target="_blank"&gt;FireFox 3.5&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/01/ie8-rc1-top-features-adjustments.html" target="_blank"&gt;IE8&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2008/09/browsers-google-chrome.html" target="_blank"&gt;Chrome&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Safari    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/09/opera-10-worlds-fastest-browser-has.html" target="_blank"&gt;Opera&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://chriscatto.blogspot.com/2009/09/rss-drinking-from-fire-hose.html" target="_blank"&gt;RSS&lt;/a&gt;    &lt;br /&gt;Hotkeys – Keyboarding (&lt;a href="http://chriscatto.blogspot.com/2009/09/keyboarding-catto-home-keys-in-2000s.html" target="_blank"&gt;Catto Home Keys&lt;/a&gt;)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/02/alt-tab-task-switcher-voted-1-hotkey.html" target="_blank"&gt;ALT + TAB&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/02/opening-application-hotkeys-2-hotkeys.html" target="_blank"&gt;Opening Apps&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/02/tab-key-is-rated-3-hotkey-ever.html" target="_blank"&gt;Tab Key&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/02/browser-hotkeys-4-hotkey-of-all-time.html" target="_blank"&gt;Browser Hotkeys&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/02/outlook-mail-hotkeys-5-hotkey-of.html" target="_blank"&gt;Outlook&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/02/windows-key-hotkeys-rated-7.html" target="_blank"&gt;Windows Key&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/09/microsoft-visual-studio-hotkey.html" target="_blank"&gt;Visual Studio&lt;/a&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://chriscatto.blogspot.com/2009/08/sql-server-management-studio-hotkeys.html" target="_blank"&gt;SQL Server Management Studio&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;a href="http://chriscatto.blogspot.com/2009/09/memory-management-my-pc-can-run-better.html" target="_blank"&gt;Memory Management &lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://cid-fcd76d83e3546d69.skydrive.live.com/self.aspx/Catto%20Public%20Sky%20Drive%20Folder/MCTS%20Catto%20Exam%20Notes%2070%20536%20v17.doc?wa=wsignin1.0&amp;amp;sa=116320153" target="_blank"&gt;MCTS 70-536 Summary Word Document ~70 pages&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;As for the code camp in general it’s just a really fun all day training &amp;amp; networking technology event. Special thanks to &lt;a href="http://twitter.com/swfldev" target="_blank"&gt;John Dunagan&lt;/a&gt; along with others for putting the event together. &lt;/p&gt;  &lt;p&gt;As Always all comments welcome!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.ChrisCatto.com" target="_blank"&gt;Catto&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-768964287258072034?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/10/sw-fla-code-camp-net-exam-cram.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-648298646649085927</guid><pubDate>Thu, 01 Oct 2009 01:59:00 +0000</pubDate><atom:updated>2009-09-30T22:12:32.957-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET Code</category><title>RSS - Drinking from the Fire-Hose</title><description>&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;RSS - Drinking from the Fire Hose&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Hey Now-  &lt;br /&gt;  &lt;br /&gt;RSS can greatly improve your performance by allowing you to efficiently obtain information. RSS is a technology most people such as my Mom does not know about or use &amp;amp; at the same time many obsessive computer users (geeks) such as myself enjoy using it daily. Microsoft always refers to ‘Drinking from the Fire Hose’ Since the info we need to follow is so intense similar to a fire hose, RSS helps us drink from that fire hose. &lt;strong&gt;Google Reader hands down my favorite URL on the internet&lt;/strong&gt;.    &lt;br /&gt;  &lt;br /&gt;&lt;strong&gt;RSS (Really Simple Syndication)&lt;/strong&gt; can be used by a reader such as Google Reader. We can subscribe to a RSS Feed then use Google reader to view the information.   &lt;br /&gt;  &lt;br /&gt;&lt;a href="http://voinbq.bay.livefilestore.com/y1pdn6HrehblVhZaJJ24T2wKsGLRf3jYvdEynEAKkfcB53YTdGGFnhYZleZ0ODf0v3mPW6Qo-hW17lPbzcsbNPVOe1AH3tNgF4n/ChrisCattoDotCom-google-reader-subscriptions.xml" target="_blank"&gt;I’ve posted my list of feeds I’ve subscribe to all labeled. To use this file you can download the XML file (OPML)&lt;/a&gt; then go to Google Reader &amp;amp; click the Manage Subscriptions link (bottom right), click import &amp;amp; browse to the file. This list is ~500 blogs mostly technical.    &lt;br /&gt;  &lt;br /&gt;A user will view many sites daily, we can click a link to a favorite website such as CNN then view the new news, then click another favorite such as ESPN &amp;amp; read the new news. This works however we are constantly going out to see if there is information. What we can do is automatically have all our the information we care about brought to us no us going to it.   &lt;br /&gt;This benefits us by having information from many sites all in one place &amp;amp; we see the info the instant the news is published.    &lt;br /&gt;We can get started using RSS by the following:   &lt;br /&gt;1. Login to Google   &lt;br /&gt;2. Go To Google Reader   &lt;br /&gt;3. Go to webpage with RSS feeds (get feed URL)   &lt;br /&gt;4. Subscribe to the feed   &lt;br /&gt;5. Read the feed in Google Reader&lt;/p&gt;  &lt;p&gt;My favorite hotkeys for Google Reader is ………&lt;/p&gt;  &lt;p&gt;J – Jump this will jump to the next post  &lt;br /&gt;M – Mark as unread this will mark the post un read   &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Here &lt;a href="http://www.youtube.com/watch?v=VSPZ2Uu_X3Y&amp;amp;feature=player_embedded" target="_blank"&gt;is an official Google YouTube Vid that offers a great description&lt;/a&gt;. &lt;/p&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:d8473045-5b64-4718-9b2b-77dac27c8f01" class="wlWriterEditableSmartContent"&gt;&lt;embed src="http://www.youtube.com/v/VSPZ2Uu_X3Y&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br&gt;  &lt;p&gt; As Always all comments welcome,&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.chriscatto.com/" target="_blank"&gt;Catto&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-648298646649085927?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/09/rss-drinking-from-fire-hose.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-2867257641090154005</guid><pubDate>Thu, 01 Oct 2009 01:28:00 +0000</pubDate><atom:updated>2009-09-30T21:28:08.473-04:00</atom:updated><title>Memory Management – My PC can run better!</title><description>&lt;p&gt;Memory Management &lt;/p&gt;  &lt;p&gt;Hey Now -&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Often time our pc's will freeze or not respond, then we wait unproductively. One action we can take is to view the process that is using the most memory &amp;amp; end it. Since usually the process consuming the most memory is the one causing the system to not respond.    &lt;br /&gt;If we are using a large amount of memory our systems will react slower &amp;amp; when there is not much memory used our systems will respond quickly. Memory is critical piece of hardware to our pc's &amp;amp; our productivity daily. Memory is one of the most important pieces of hardware &amp;amp; often called RAM (random access memory).    &lt;br /&gt;Memory Management - Monitoring &amp;amp; adjusting processes are two critical actions we can take to manage our memory.    &lt;br /&gt;Monitoring Memory in 7 &amp;amp; Vista has improved greatly from XP.    &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;101 - View Processes by mem descending&lt;/strong&gt;.    &lt;br /&gt;Task Manager Process Tab (Ctrl + Shift + Esc Hotkey to open Task Manager)    &lt;br /&gt;Resource Monitor - 7 &amp;amp; Vista have a much improved app compared to the traditional task manager. (click start pearl then type in Res &amp;amp; resource Monitor should be on the start menu to open)    &lt;br /&gt;Sort by Memory Descending - We can accomplish this by first ensuring the memory column is displayed (we can add columns such as peak mem on from the View menu --&amp;gt; select columns or right clicking on the column headers)    &lt;br /&gt;In 7 &amp;amp; Vista it's great since one the order is sorted every time we open the app after that memory will be sorted by desc. In XP we have to click 'mem' column header two times every time task manager is opened.    &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;201 - Ending Processes&lt;/strong&gt;    &lt;br /&gt;We can end a process by highlighting the process such as iexplore.exe then right clicking &amp;amp; selecting end tasks. Then confirm the end process.    &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;301 - Minimizing Windows&lt;/strong&gt; - By minimizing windows in some programs it will free memory. If a pc stops responding we can minimize all our windows (Win + M). For example Office apps such as Word &amp;amp; Outlook , Firefox 3.5 if it's minimized there will be memory free'd up so the system will respond quicker.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;RAM Memory &lt;strong&gt;Hardware&lt;/strong&gt; - We can see how much RAM is on a workstation by pressing the windows button &amp;amp; pause break. Win+PauseBreak. This will display the basic info regarding your system such as your processor/chip &amp;amp; RAM. Currently in my notebook my RAM shows 4G (2.62 usable)    &lt;br /&gt;We can buy memory for ~ $10 / gig now. Word to the motherboard! Currently a large percent of mother boards have a maximum of 4g. It's not too tuff or time consuming to buy more memory &amp;amp; install it on a notebook or desktop (my Mom can do it). By maxing out the memory installed we are also improving performance.    &lt;br /&gt;We should also keep in mind we now have ReadyBoost - Vista &amp;amp; beyond. We can easily use USB keys as memory (a really fast cache) doubling the amount of memory we have installed.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Memory &amp;amp; Managing our memory is critical to our productivity daily. &lt;/p&gt;  &lt;p&gt;We can monitor &amp;amp; alter process to improve pc's performance at the same time our hardware is another factor we should be aware of.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;As always all comments welcome!    &lt;br /&gt;&lt;a href="http://www.ChrisCatto.com" target="_blank"&gt;Catto&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-2867257641090154005?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/09/memory-management-my-pc-can-run-better.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-4320677697026066444</guid><pubDate>Thu, 01 Oct 2009 00:38:00 +0000</pubDate><atom:updated>2009-09-30T20:38:15.057-04:00</atom:updated><title>Keyboarding - Catto Home Keys in the 2000’s</title><description>&lt;p&gt;Hey Now,&lt;/p&gt;  &lt;p&gt;I introduce to you the &lt;/p&gt;  &lt;p&gt;&lt;font size="5"&gt;Catto Home Keys&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;Keyboarding 101&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Catto Home Keys&lt;/strong&gt; are a new efficient use of home keys. Keyboarding / typing is critical to being productive, efficient every day. In the 2000’s it’s time for a change &amp;amp; not use the same old home row keys. In 1870’s the keyboard layout which many use “QWERTY” (letters below 12345) was designed. When typing words the traditional home keys work well, there is a good amount of time we can use another set of home keys while navigating &amp;amp; completing many tasks daily. So, the home row has been around for ~140 years &amp;amp; I think it’s time to change it due to the fact we use pc’s now not just a type writer. &lt;/p&gt;  &lt;p&gt;Left hand    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Thumb – Left Alt     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Pinky&amp;#160;&amp;#160; - Tab     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Pointer – F     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Middle&amp;#160; - E     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ring&amp;#160;&amp;#160;&amp;#160;&amp;#160; - 2&lt;/p&gt;  &lt;p&gt;Right Hand – &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; a.&amp;#160;&amp;#160; Mouse    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; b.&amp;#160;&amp;#160; 201 Touchpad (keyboard w/ touchpad)&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Thumb – Left Click&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Pointer - Touchpad     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; c.&amp;#160;&amp;#160; 301 Touchpad (keyboard w/ touchpad)&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Thumb – Touchpad     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Left Thumb – Left click (for drag click &amp;amp; hold)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ring – J     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Pinky – Enter ready (not on enter but ready)&lt;/p&gt;  &lt;p&gt;What this does it keep our left able to use the &lt;a href="http://chriscatto.blogspot.com/2009/02/alt-tab-task-switcher-voted-1-hotkey.html" target="_blank"&gt;#1 Hotkey Alt + Tab&lt;/a&gt; to switch tasks since we do this so often. Catto Home Keys can be used thought our work day to improve productivity. &lt;/p&gt;  &lt;p&gt;As always all comments welcome,&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.ChrisCatto.com" target="_blank"&gt;Catto&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-4320677697026066444?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/09/keyboarding-catto-home-keys-in-2000s.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-5597694791845426302</guid><pubDate>Mon, 21 Sep 2009 01:03:00 +0000</pubDate><atom:updated>2009-09-20T21:04:54.724-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MCTS 70-536 code</category><title>70-536 MCTS .NET Foundations Questions #37</title><description>Hey Now,&lt;br /&gt;&lt;br /&gt;Please feel free to check out my MCTS 70-536 reference page on Chris Catto.com. It’s a page with a summary of all of my posts.   &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;br /&gt;I'm try to split a previous post Here is the second half.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;Question: 198 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a class library that contains the class hierarchy defined in the following code segment. &lt;/p&gt;  &lt;p&gt;(Line numbers are included for reference only.)   &lt;br /&gt;01    &lt;br /&gt;Public Class Group    &lt;br /&gt;02 Public Employees As Employee()   &lt;br /&gt;03 End Class   &lt;br /&gt;0405 Public Class Employee   &lt;br /&gt;06 Public Name As String   &lt;br /&gt;07 End Class   &lt;br /&gt;0809 Public Class Manager   &lt;br /&gt;10 Inherits Employee   &lt;br /&gt;11 Public Level As Integer   &lt;br /&gt;12 End Class   &lt;br /&gt;You create an instance of the Group class. You populate the fields of the instance. When you attempt to serialize the instance by using the Serialize method of the XmlSerializer class, you receive InvalidOperationException. You also receive the following error message: "There was an error generating the XML document." You need to modify the code segment so that you can successfully serialize instances of the Group class by using the XmlSerializer class. You also need to ensure that the XML output contains an element for all public fields in the class hierarchy. What should you do? &lt;/p&gt;  &lt;p&gt;A. Insert the following code between lines 1 and 2 of the code segment: &lt;/p&gt;  &lt;p&gt;&amp;lt;XmlArrayItem(Type:=GetType(Employee))&amp;gt; _   &lt;br /&gt;&amp;lt;XmlArrayItem(Type:=GetType(Manager))&amp;gt; _ &lt;/p&gt;  &lt;p&gt;B. Insert the following code between lines 1 and 2 of the code segment: &lt;/p&gt;  &lt;p&gt;&amp;lt;XmlElement(Type:=GetType(Employee))&amp;gt; _ &lt;/p&gt;  &lt;p&gt;C. Insert the following code between lines 1 and 2 of the code segment: &lt;/p&gt;  &lt;p&gt;&amp;lt;XmlArray(ElementName:="Employees")&amp;gt; _ &lt;/p&gt;  &lt;p&gt;D. Insert the following code between lines 5 and 6 of the code segment: &lt;/p&gt;  &lt;p&gt;&amp;lt;XmlElement(Type:=GetType(Employee))&amp;gt; &lt;/p&gt;  &lt;p&gt;andInsert the following code between lines 10 and 11 of the code segment: &lt;/p&gt;  &lt;p&gt;&amp;lt;XmlElement(Type:=GetType(Manager))&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – XML Array Item &lt;/p&gt;    &lt;p&gt;&lt;b&gt;Question: 199 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are testing a method that examines a running process. This method returns an ArrayList containing the name and full path of all modules that are loaded by the process. You need to &lt;b&gt;list the modules loaded &lt;/b&gt;by a process named C:\TestApps\Process1.exe. Which code segment should you use?&lt;/p&gt;  &lt;p&gt;A. ArrayList ar = new ArrayList();  &lt;br /&gt;Process[] procs;   &lt;br /&gt;ProcessModuleCollection modules;   &lt;br /&gt;procs = Process.GetProcesses(@”Process1”);   &lt;br /&gt;if (procs.Length &amp;gt; 0) {modules = porcs[0].Modules;    &lt;br /&gt;foreach (ProcessModule mod in modules) {    &lt;br /&gt;ar.Add(mod.ModuleName);    &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;B. ArrayList ar = new ArrayList();  &lt;br /&gt;Process[] procs;   &lt;br /&gt;ProcessModuleCollection modules;   &lt;br /&gt;procs = Process.GetProcesses(@”C:\TestApps\Process1.exe”);   &lt;br /&gt;if (procs.Length &amp;gt; 0) {modules = porcs[0].Modules;   &lt;br /&gt;foreach (ProcessModule mod in modules) { &lt;/p&gt;  &lt;p&gt;ar.Add(mod.ModuleName); &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;C. ArrayList ar = new ArrayList();  &lt;br /&gt;Process[] procs;   &lt;br /&gt;ProcessModuleCollection modules;   &lt;br /&gt;procs = Process.&lt;b&gt;GetProcessesByName&lt;/b&gt;(@”Process1”);   &lt;br /&gt;if (procs.Length &amp;gt; 0) {modules = porcs[0].Modules;   &lt;br /&gt;foreach (ProcessModule mod in modules) {   &lt;br /&gt;ar.Add(mod.FileName);    &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;D. ArrayList ar = new ArrayList();  &lt;br /&gt;Process[] procs;   &lt;br /&gt;ProcessModuleCollection modules;   &lt;br /&gt;procs =Process.GetProcessesByName(@”C:\TestApps\Process1.exe”);   &lt;br /&gt;if   &lt;br /&gt;(procs.Length &amp;gt; 0) {    &lt;br /&gt;modules = porcs[0].Modules;    &lt;br /&gt;foreach (ProcessModule mod in modules) {    &lt;br /&gt;ar.Add(mod.FileName);    &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Q:List modules loaded by process A: &lt;b&gt;GetProcessesByName &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 200 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code to implement the CompanyClass.MyMethod function. &lt;/p&gt;  &lt;p&gt;public class CompanyClass {   &lt;br /&gt;public int MyMethod(int arg) {    &lt;br /&gt;return arg;    &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;You need to call the CompanyClass.MyMethod function dynamically from an unrelated class in your assembly. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. CompanyClass myClass = new CompanyClass();   &lt;br /&gt;Type t = typeof(CompanyClass);    &lt;br /&gt;MethodInfo m = t.GetMethod(“MyMethod”);    &lt;br /&gt;int i = (int)m.Invoke(this, new object[] { 1 }); &lt;/p&gt;  &lt;p&gt;B. CompanyClass myClass = new CompanyClass();   &lt;br /&gt;Type t = typeof(CompanyClass); |   &lt;br /&gt;MethodInfo m = t.GetMethod(“&lt;b&gt;MyMethod&lt;/b&gt;”);    &lt;br /&gt;int i = (int) m.Invoke(&lt;b&gt;myClass&lt;/b&gt;, new object[] { 1 }); &lt;/p&gt;  &lt;p&gt;C. CompanyClass myClass = new CompanyClass();   &lt;br /&gt;Type t = typeof(CompanyClass);    &lt;br /&gt;MethodInfo m = t.GetMethod(“CompanyClass.MyMethod”);    &lt;br /&gt;int i = (int)m.Invoke(myClass, new object[] { 1 }); &lt;/p&gt;  &lt;p&gt;D. Type t = Type.GetType(“CompanyClass”);   &lt;br /&gt;MethodInfo m = t.GetMethod(“MyMethod”);    &lt;br /&gt;int i = (int)m.Invoke(this, new object[] { 1 }); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – MyClass &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 201 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;create&lt;/b&gt; a dynamic assembly named &lt;b&gt;MyAssembly&lt;/b&gt;. You also need to &lt;b&gt;save&lt;/b&gt; the &lt;b&gt;assembly&lt;/b&gt; to disk. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objAssembly As New AssemblyName()objAssembly.Name = "MyAssembly"  &lt;br /&gt;Dim objBuilder As AssemblyBuilder =    &lt;br /&gt;_AppDomain.CurrentDomain.DefineDynamicAssembly( _objAssembly,   &lt;br /&gt;AssemblyBuilderAccess.Run)objBuilder.Save("MyAssembly.dll") &lt;/p&gt;  &lt;p&gt;B. Dim objAssembly As New AssemblyName()objAssembly.Name = "MyAssembly"  &lt;br /&gt;Dim objBuilder As AssemblyBuilder = &lt;/p&gt;  &lt;p&gt;_AppDomain.CurrentDomain.DefineDynamicAssembly( _objAssembly,   &lt;br /&gt;AssemblyBuilderAccess.&lt;b&gt;Save&lt;/b&gt;)objBuilder.&lt;b&gt;Save&lt;/b&gt;("&lt;b&gt;MyAssembly.dll&lt;/b&gt;") &lt;/p&gt;  &lt;p&gt;C. Dim objAssembly As New AssemblyName()objAssembly.Name = "MyAssembly"  &lt;br /&gt;Dim objBuilder As AssemblyBuilder =    &lt;br /&gt;_AppDomain.CurrentDomain.DefineDynamicAssembly( _objAssembly,    &lt;br /&gt;AssemblyBuilderAccess.RunAndSave)objBuilder.Save("MyAssembly.dll") &lt;/p&gt;  &lt;p&gt;D. Dim objAssembly As New AssemblyName()objAssembly.Name = "MyAssembly"  &lt;br /&gt;Dim objBuilder As AssemblyBuilder =    &lt;br /&gt;_AppDomain.CurrentDomain.DefineDynamicAssembly( _objAssembly,    &lt;br /&gt;AssemblyBuilderAccess.Save)objBuilder.Save("c:\MyAssembly.dll") &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Q: Create &amp;amp; Save A: AssemblyBuilderAccess.&lt;b&gt;Save “MyAssebly”&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 202 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code. &lt;/p&gt;  &lt;p&gt;Public Delegate Sub FaxDocs(ByVal sender As Object, _   &lt;br /&gt;ByVal args as FaxArgs)    &lt;br /&gt;You need to &lt;b&gt;create an event&lt;/b&gt; that will &lt;b&gt;invoke FaxDocs&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Public Shared Event Fax As FaxDocs &lt;/p&gt;  &lt;p&gt;B. Public Shared Event FaxDocs As FaxArgs &lt;/p&gt;  &lt;p&gt;C. Public Class FaxArgs   &lt;br /&gt;Inherits EventArgs    &lt;br /&gt;Private coverPageInfo As String    &lt;br /&gt;Public Sub New(ByVal coverInfo As String)    &lt;br /&gt;Me.coverPageInfo = coverInfo    &lt;br /&gt;End Sub    &lt;br /&gt;Public ReadOnly Property CoverPageInformation As String    &lt;br /&gt;Get    &lt;br /&gt;Return Me.coverPageInfo    &lt;br /&gt;End Get    &lt;br /&gt;End PropertyEnd Class &lt;/p&gt;  &lt;p&gt;D. Public Class FaxArgs   &lt;br /&gt;Inherits EventArgs    &lt;br /&gt;Private coverPageInfo As String    &lt;br /&gt;Public ReadOnly Property CoverPageInformation As String Get    &lt;br /&gt;Return Me.coverPageInfo    &lt;br /&gt;End Get    &lt;br /&gt;End PropertyEnd Class &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Create an event to invoke FaxDocs A: Public Shared Event Fax As FaxDocs &lt;/p&gt;    &lt;p&gt;&lt;b&gt;Question: 203 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to encrypt sensitive data with the Data Encryption Standard (&lt;b&gt;DES&lt;/b&gt;) algorithm. Your method accepts the following parameters: &lt;/p&gt;  &lt;p&gt;The byte array to be &lt;b&gt;encrypted&lt;/b&gt;, which is named &lt;b&gt;messageAn&lt;/b&gt; encryption key, which is named &lt;b&gt;keyAn&lt;/b&gt; initialization vector, which is named &lt;b&gt;iv&lt;/b&gt; You need to encrypt the data. You also need to &lt;b&gt;write&lt;/b&gt; the encrypted data to a MemoryStream object. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. DES^ des = gcnew DESCryptoServiceProvider();   &lt;br /&gt;des-&amp;gt;BlockSize = message-&amp;gt;Length;    &lt;br /&gt;ICryptoTransform^ crypto = des-&amp;gt;&lt;b&gt;CreateEncryptor&lt;/b&gt;(key, iv);    &lt;br /&gt;MemoryStream ^cipherStream = gcnew MemoryStream();    &lt;br /&gt;CryptoStream ^cryptoStream = gcnew CryptoStream(cipherStream,crypto, CryptoStreamMode::Write);    &lt;br /&gt;cryptoStream-&amp;gt;Write(message, 0, message-&amp;gt;Length); &lt;/p&gt;  &lt;p&gt;B. DES^ des = gcnew DESCryptoServiceProvider();   &lt;br /&gt;ICryptoTransform^ crypto = des-&amp;gt;CreateDecryptor(key, iv);    &lt;br /&gt;MemoryStream ^cipherStream = gcnew MemoryStream();    &lt;br /&gt;CryptoStream ^cryptoStream = gcnew   &lt;br /&gt;CryptoStream(cipherStream, crypto,    &lt;br /&gt;CryptoStreamMode::Write);    &lt;br /&gt;cryptoStream-&amp;gt;Write(message, 0, message-&amp;gt;Length); &lt;/p&gt;  &lt;p&gt;C. DES^ des = gcnew DESCryptoServiceProvider();  &lt;br /&gt;ICryptoTransform^ crypto = des-&amp;gt;CreateDecryptor();    &lt;br /&gt;MemoryStream ^cipherStream = gcnew MemoryStream();CryptoStream ^cryptoStream    &lt;br /&gt;= gcnew CryptoStream(cipherStream,crypto,    &lt;br /&gt;CryptoStreamMode::Write);   &lt;br /&gt;cryptoStream-&amp;gt;Write(message, 0, message-&amp;gt;Length); &lt;/p&gt;  &lt;p&gt;D. DES^ des = gcnew DESCryptoServiceProvider();  &lt;br /&gt;&lt;b&gt;ICryptoTransform&lt;/b&gt;^ crypto = des-&amp;gt;&lt;b&gt;CreateEncryptor&lt;/b&gt;(key, iv);   &lt;br /&gt;MemoryStream ^cipherStream = gcnew MemoryStream();   &lt;br /&gt;CryptoStream ^cryptoStream = gcnew CryptoStream(cipherStream, crypto, CryptoStreamMode::Write);    &lt;br /&gt;cryptoStream-&amp;gt;Write(message, 0, message-&amp;gt;Length); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Encrypt A: CreateEncryptor ICryptoTransform&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 204 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are testing a newly developed method named &lt;b&gt;PersistToDB&lt;/b&gt;. This method accepts a parameter of type &lt;b&gt;EventLogEntry&lt;/b&gt;. This method does not return a value. You need to create a code segment that helps you to test the method. The code segment must &lt;b&gt;read entries&lt;/b&gt; from the &lt;b&gt;application log&lt;/b&gt; of &lt;b&gt;local&lt;/b&gt; &lt;b&gt;computers&lt;/b&gt; and then pass &lt;b&gt;the entries on to the PersistToDB method&lt;/b&gt;. The code block must pass only events of type Error or Warning from the source MySource to the PersistToDB method. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim myLog As New EventLog("Application", ".")  &lt;br /&gt;For Each entry As EventLogEntry In myLog.Entries    &lt;br /&gt;If entry.Source = "MySource" Then    &lt;br /&gt;PersistToDB(entry)    &lt;br /&gt;End If    &lt;br /&gt;Next &lt;/p&gt;  &lt;p&gt;B. Dim myLog as New EventLog("Application", ".")   &lt;br /&gt;myLog.Source = "MySource"    &lt;br /&gt;For Each entry As EventLogEntry In myLog.Entries    &lt;br /&gt;If entry.EntryType = (EventLogEntryType.Error And _    &lt;br /&gt;EventLogEntryType.Warning) Then    &lt;br /&gt;PersistToDB(entry)    &lt;br /&gt;End If    &lt;br /&gt;Next &lt;/p&gt;  &lt;p&gt;C. Dim myLog as New EventLog("Application", ".")   &lt;br /&gt;For Each entry As EventLogEntry In myLog.Entries    &lt;br /&gt;If entry.Source = "MySource" Then    &lt;br /&gt;If (entry.EntryType = EventLogEntryType.Error) Or _    &lt;br /&gt;(entry.EntryType = EventLogEntryType.Warning) Then    &lt;br /&gt;PersistToDB(entry)    &lt;br /&gt;End If    &lt;br /&gt;End If    &lt;br /&gt;Next &lt;/p&gt;  &lt;p&gt;D. Dim myLog as New EventLog("Application", ".")   &lt;br /&gt;myLog.Source = "MySource"    &lt;br /&gt;For Each entry As EventLogEntry In myLog.Entries    &lt;br /&gt;If (entry.EntryType = EventLogEntryType.Error) Or _    &lt;br /&gt;(entry.EntryType = EventLogEntryType.Warning) Then    &lt;br /&gt;PersistToDB(entry)    &lt;br /&gt;End If    &lt;br /&gt;Next &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;A: Loop threw all w/ some ifs to check if&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 205 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an &lt;b&gt;undo buffer&lt;/b&gt; that stores data modifications. You need to ensure that the undo &lt;b&gt;functionality undoes the most recent data &lt;/b&gt;modifications first. You also need to ensure that the undo buffer permits the storage of strings only. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Stack&amp;lt;String^&amp;gt; undoBuffer = gcnew &lt;b&gt;Stack&lt;/b&gt;&amp;lt;String^&amp;gt;(); &lt;/p&gt;  &lt;p&gt;B. Stack undoBuffer = gcnew Stack(); &lt;/p&gt;  &lt;p&gt;C. Queue&amp;lt;String^&amp;gt; undoBuffer = gcnew Queue&amp;lt;String^&amp;gt;(); &lt;/p&gt;  &lt;p&gt;D. Queue undoBuffer = gcnew Queue(); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Most rescent Stack LIFO A: Stack String&lt;/p&gt;    &lt;p&gt;&lt;b&gt;Question: 206 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a &lt;b&gt;multicast&lt;/b&gt; &lt;b&gt;delegate&lt;/b&gt; that &lt;b&gt;accepts a DateTime&lt;/b&gt; argument. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public delegate int PowerDeviceOn(bool result,   &lt;br /&gt;DateTime autoPowerOff); &lt;/p&gt;  &lt;p&gt;B. public delegate bool PowerDeviceOn(object sender,   &lt;br /&gt;EventsArgs autoPowerOff); &lt;/p&gt;  &lt;p&gt;C. public delegate void PowerDeviceOn(DataTime autoPowerOff); &lt;/p&gt;  &lt;p&gt;D. public delegate bool PowerDeviceOn(DataTime autoPowerOff); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – void PowerDeviceOn DataTemautoPowerOff &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 207 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method to &lt;b&gt;compress an array of bytes&lt;/b&gt;. The array is passed to the method in a parameter named &lt;b&gt;document&lt;/b&gt;. You need to compress the incoming array of bytes and return the &lt;b&gt;result as an array&lt;/b&gt; of bytes. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objStream As New MemoryStream(document)  &lt;br /&gt;Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)    &lt;br /&gt;Dim result(document.Length) As Byteobj    &lt;br /&gt;Deflate.Write(result, 0, result.Length)   &lt;br /&gt;Return result &lt;/p&gt;  &lt;p&gt;B. Dim objStream As New MemoryStream(document)  &lt;br /&gt;Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)obj    &lt;br /&gt;Deflate.Write(document, 0, document.Length)obj    &lt;br /&gt;Deflate.Close()   &lt;br /&gt;Return objStream.ToArray &lt;/p&gt;  &lt;p&gt;C. Dim objStream As New &lt;b&gt;MemoryStream()&lt;/b&gt;   &lt;br /&gt;Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)obj    &lt;br /&gt;Deflate.Write(document, 0, document.Length)obj    &lt;br /&gt;Deflate.Close()   &lt;br /&gt;Return objStream.ToArray &lt;/p&gt;  &lt;p&gt;D. Dim objStream As New MemoryStream()   &lt;br /&gt;Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)    &lt;br /&gt;Dim outStream As New MemoryStreamDim b As IntegerWhile (b = objDeflate.ReadByte)    &lt;br /&gt;outStream.WriteByte(CByte(b))    &lt;br /&gt;End    &lt;br /&gt;WhileReturn outStream.ToArray &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – MemoryStream() &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 208 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create the definition for a &lt;b&gt;Vehicle class&lt;/b&gt; by using the following code segment. &lt;/p&gt;  &lt;p&gt;public ref class Vehicle { &lt;/p&gt;  &lt;p&gt;public : [XmlAttribute(AttributeName = "category")]   &lt;br /&gt;String^ vehicleType;    &lt;br /&gt;String^ model;    &lt;br /&gt;[XmlIgnore]    &lt;br /&gt;int year;    &lt;br /&gt;[XmlElement(ElementName = "mileage")]    &lt;br /&gt;int miles;    &lt;br /&gt;Condition Type condition;    &lt;br /&gt;Vehicle() {}    &lt;br /&gt;enum ConditionType {    &lt;br /&gt;[XmlEnum("Poor")] BelowAverage,    &lt;br /&gt;[XmlEnum("Good")] Average,    &lt;br /&gt;[XmlEnum("Excellent")] AboveAverage    &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;You create an instance of the Vehicle class. You populate the public fields of the Vehicle class instance as shown in the following table:&lt;/p&gt;  &lt;p&gt;Exhibit: &lt;/p&gt;  &lt;p&gt;You need to identify the XML block that is produced when this &lt;b&gt;Vehicle class instance is serialized&lt;/b&gt;. Which block of XML represents the output of serializing the Vehicle instance? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;   &lt;br /&gt;&amp;lt;Vehicle   &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    &lt;br /&gt;xmlns:xsd="http://www.w3.org/2001/XMLSchema""   &lt;br /&gt;vehicleType="car"&amp;gt;    &lt;br /&gt;&amp;lt;model&amp;gt;racer&amp;lt;/model&amp;gt;    &lt;br /&gt;&amp;lt;miles&amp;gt;15000&amp;lt;/miles&amp;gt;    &lt;br /&gt;&amp;lt;condition&amp;gt;AboveAverage&amp;lt;/condition&amp;gt;    &lt;br /&gt;&amp;lt;/Vehicle&amp;gt; &lt;/p&gt;  &lt;p&gt;B. &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;   &lt;br /&gt;&amp;lt;Vehicle    &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    &lt;br /&gt;xmlns:xsd="http://www.w3.org/2001/XMLSchema"    &lt;br /&gt;category="car"&amp;gt;    &lt;br /&gt;&amp;lt;model&amp;gt;racer&amp;lt;/model&amp;gt;    &lt;br /&gt;&amp;lt;mileage&amp;gt;15000&amp;lt;/mileage&amp;gt;    &lt;br /&gt;&amp;lt;&lt;b&gt;condition&lt;/b&gt;&amp;gt;&lt;b&gt;Excellent&lt;/b&gt;&amp;lt;/condition&amp;gt;    &lt;br /&gt;&amp;lt;/Vehicle&amp;gt; &lt;/p&gt;  &lt;p&gt;C. &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;   &lt;br /&gt;&amp;lt;Vehicle    &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    &lt;br /&gt;xmlns:xsd="http://www.w3.org/2001/XMLSchema"    &lt;br /&gt;category="car"&amp;gt;    &lt;br /&gt;&amp;lt;model&amp;gt;racer&amp;lt;/model&amp;gt;    &lt;br /&gt;&amp;lt;mileage&amp;gt;15000&amp;lt;/mileage&amp;gt;    &lt;br /&gt;&amp;lt;conditionType&amp;gt;Excellent&amp;lt;/conditionType&amp;gt;    &lt;br /&gt;&amp;lt;/Vehicle&amp;gt; &lt;/p&gt;  &lt;p&gt;D. &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;   &lt;br /&gt;&amp;lt;Vehicle    &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    &lt;br /&gt;xmlns:xsd="http://www.w3.org/2001/XMLSchema"&amp;gt;    &lt;br /&gt;&amp;lt;category&amp;gt;car&amp;lt;/category&amp;gt;    &lt;br /&gt;&amp;lt;model&amp;gt;racer&amp;lt;/model&amp;gt;    &lt;br /&gt;&amp;lt;mileage&amp;gt;15000&amp;lt;/mileage&amp;gt;    &lt;br /&gt;&amp;lt;condition&amp;gt;Excellent&amp;lt;/condition&amp;gt;    &lt;br /&gt;&amp;lt;/Vehicle&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Serilize XML&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 209 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method &lt;b&gt;to compress an array of bytes&lt;/b&gt;. The bytes to be compressed are passed to the method in a parameter named &lt;b&gt;document&lt;/b&gt;. You need to compress the contents of the incoming parameter. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim inStream As New MemoryStream(document)  &lt;br /&gt;Dim zipStream As New GZipStream( _inStream, CompressionMode.Compress)   &lt;br /&gt;Dim result(document.Length) As    &lt;br /&gt;BytezipStream.Write(result, 0, result.Length)   &lt;br /&gt;Return result &lt;/p&gt;  &lt;p&gt;B. Dim objStream As New MemoryStream(document)  &lt;br /&gt;Dim zipStream As New GZipStream( _ objStream, CompressionMode.Compress)zipStream.Write(document, 0,   &lt;br /&gt;document.Length)zipStream.Close()   &lt;br /&gt;Return objStream.ToArray &lt;/p&gt;  &lt;p&gt;C. Dim outStream As New MemoryStream  &lt;br /&gt;Dim zipStream As New GZipStream( _outStream, CompressionMode.Compress)zipStream.Write(document, 0,    &lt;br /&gt;document.Length)zipStream.Close()   &lt;br /&gt;Return outStream.ToArray &lt;/p&gt;  &lt;p&gt;D. Dim objStream As New MemoryStream(document)  &lt;br /&gt;Dim zipStream As New    &lt;br /&gt;GZipStream( _objStream, CompressionMode.Compress)   &lt;br /&gt;Dim outStream As New    &lt;br /&gt;MemoryStreamDim b As IntegerWhile (b =    &lt;br /&gt;zipStream.ReadByte)outStream.WriteByte(CByte(b))   &lt;br /&gt;End While   &lt;br /&gt;Return outStream.ToArray &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Compress array of bytes&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 210 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to &lt;b&gt;decrypt&lt;/b&gt; data that was encrypted with the Triple &lt;b&gt;DES&lt;/b&gt; Algorithm. The method accepts the following parameters: The byte array to be decrypted, which is named cipherMessageThe key, which is named key An initialization vector, which is named iv You need to decrypt the message by using the TripleDES class and place the result in a string. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. TripleDES des = new TripleDESCryptoServiceProvider();  &lt;br /&gt;des.BlockSize = cipherMessage.Length;   &lt;br /&gt;ICryptoTransform crypto = des.CreateDecryptor(key, iv);   &lt;br /&gt;MemoryStream cipherStream = new MemoryStream(cipherMessage);   &lt;br /&gt;CryptoStream cryptoStream = new CryptoStream( cipherStream, crypto, CryptoStreamMode.Read);    &lt;br /&gt;string message;   &lt;br /&gt;message = new StreamReader(cryptoStream).ReadToEnd(); &lt;/p&gt;  &lt;p&gt;B. TripleDES des = new TripleDESCryptoServiceProvider();  &lt;br /&gt;des.&lt;b&gt;FeedbackSize&lt;/b&gt; = cipherMessage.Length;   &lt;br /&gt;ICryptoTransform crypto = des.CreateDecryptor(key, iv);   &lt;br /&gt;MemoryStream cipherStream = new MemoryStream(cipherMessage);   &lt;br /&gt;CryptoStream cryptoStream = new CryptoStream(    &lt;br /&gt;cipherStream, crypto, CryptoStreamMode.Read);    &lt;br /&gt;string message;   &lt;br /&gt;message = new StreamReader(cryptoStream).ReadToEnd(); &lt;/p&gt;  &lt;p&gt;C. TripleDES des = new TripleDESCryptoServiceProvider();  &lt;br /&gt;ICryptoTrans form crypto = des.CreateDecryptor();   &lt;br /&gt;MemoryStream cipherStream = new MemoryStream(cipherMessage);   &lt;br /&gt;CryptoStream cryptoStream = new CryptoStream(    &lt;br /&gt;cipherStream, crypto, CryptoStreamMode.Read);    &lt;br /&gt;string message;   &lt;br /&gt;message = new StreamReader(cryptoStream).ReadToEnd(); &lt;/p&gt;  &lt;p&gt;D. TripleDES des = new TripleDESCryptoServiceProvider();  &lt;br /&gt;ICryptoTrans form crypto = des.&lt;b&gt;CreateDecryptor(key, iv);&lt;/b&gt;   &lt;br /&gt;MemoryStream cipherStream = new MemoryStream(cipherMessage);   &lt;br /&gt;CryptoStream cryptoStream = new CryptoStream( cipherStream, crypto, CryptoStreamMode.Read);    &lt;br /&gt;string message;   &lt;br /&gt;message = new StreamReader(cryptoStream).ReadToEnd(); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 - Des.CreateDecryptor(key, iv)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 211 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a utility screen for a new client application. The utility screen displays a thermometer that conveys the current status of processes being carried out by the application. You need to draw a rectangle on the screen to serve as the background of the thermometer as shown in the exhibit. The &lt;b&gt;rectangle must be filled with gradient shading&lt;/b&gt;. Which code segment should you choose? &lt;/p&gt;  &lt;p&gt;A - Rectangle^ rectangle = gcnew Rectangle(10, 10, 450, 25); LinearGradientBrush^ rectangleBrush = gcnew LinearGradientBrush(rectangle, Color::AliceBlue,&lt;br /&gt;Color::CornflowerBlue,LinearGradientMode::ForwardDiagonal);    &lt;br /&gt;Pen^ rectanglePen = gcnew Pen(rectangleBrush);    &lt;br /&gt;Graphics^ g = this-&amp;gt;CreateGraphics();    &lt;br /&gt;g-&amp;gt;DrawRectangle(rectanglePen, rectangle); &lt;/p&gt;  &lt;p&gt;B - Rectangle^ rectangle = gcnew Rectangle(10, 10, 450, 25); LinearGradientBrush^ rectangleBrush = gcnew LinearGradientBrush(rectangle, Color::AliceBlue, Color::CornflowerBlue, LinearGradientMode::ForwardDiagonal);&lt;br /&gt;Pen^ rectanglePen = gcnew Pen(rectangleBrush);    &lt;br /&gt;Graphics^ g = this-&amp;gt;Createsraphics();    &lt;br /&gt;g-&amp;gt;FillRectangle(&lt;b&gt;rectangleBrush&lt;/b&gt;, rectangle); &lt;/p&gt;  &lt;p&gt;C - RectangleF^ rectangle = gcnew RectangleF(10f, 10f, 450f, 25f);   &lt;br /&gt;array&amp;lt;Point^&amp;gt;^ points = gcnew array&amp;lt;Point^&amp;gt;^ {gcnew Point(0, 0), gcnew Point(110, 145)};    &lt;br /&gt;LinearGradientBrush^ rectangleBrush = gcnew LinearGradientBrush(rectangle, Color::AliceBlue, Color::CornflowerBlue, LinearGradientMode::ForwardDiagonal);&lt;br /&gt;Pen^ rectanglePen = gcnew Pen(rectangleBrush);    &lt;br /&gt;Graphics^ g = this-&amp;gt;CreateGraphics();    &lt;br /&gt;g-&amp;gt;DrawPolygon(rectanglePen, points); &lt;/p&gt;  &lt;p&gt;D - RectangleF^ rectangle = gcnew RectangleF(l0f, l0f, 450f, 25f);   &lt;br /&gt;SolidBrush^ rectangleBrush = gcnew SolidBrush(Color::AliceBlue);    &lt;br /&gt;Pen^ rectanglePen = gcnew Pen(rectangleBrush);   &lt;br /&gt;Graphics^ g = this-&amp;gt;CreateGraphics();    &lt;br /&gt;g-&amp;gt;DrawRectangle(rectangleBrush, rectangle); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – &lt;b&gt;rectangleBrush numbers w/out F&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-5597694791845426302?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/09/70-536-mcts-net-foundations-questions.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-1692243933666079528</guid><pubDate>Mon, 21 Sep 2009 00:23:00 +0000</pubDate><atom:updated>2009-09-20T20:23:25.281-04:00</atom:updated><title>Opera 10 'The Worlds Fastest Browser' has Good Qualities</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hey Now,&lt;/p&gt;  &lt;p&gt;Browsers are the most important program that we use. There are many browsers out there such as &lt;a href="http://chriscatto.blogspot.com/2009/06/firefox-35-your-default-browser.html" target="_blank"&gt;Firefox&lt;/a&gt;, &lt;a href="http://chriscatto.blogspot.com/2009/01/ie8-rc1-downloading-installing-in-7.html" target="_blank"&gt;IE&lt;/a&gt;, Safari &amp;amp; &lt;a href="http://chriscatto.blogspot.com/2008/09/browsers-google-chrome.html" target="_blank"&gt;Chrome&lt;/a&gt;. Let us take a look at Opera 10, who call themselves 'The Worlds Fastest Browser' &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_aeOfe_H0_iQ/SrbHd9m8okI/AAAAAAAAAM8/DRwPdgrdvDM/s1600-h/image%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_aeOfe_H0_iQ/SrbHecK5fJI/AAAAAAAAANA/dNp9sITTwaw/image_thumb%5B2%5D.png?imgmax=800" width="384" height="196" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Opera's best qualities are:&lt;/p&gt;  &lt;p&gt;1. Early adopters &lt;strong&gt;new browser features&lt;/strong&gt; – This is the reason why I really enjoy using Opera over the years. I’ve learned about new features in Opera then in year or two they become mainstream. &lt;/p&gt;  &lt;p&gt;2. Speed, Quick, lightweight browser&lt;/p&gt;  &lt;p&gt;3. Widgets ( ex Chuck Norris Widget )&lt;/p&gt;  &lt;p&gt;Opera has been available for a while &amp;amp; has not been widely used maybe ~ 2% of the market share. Personally use Opera occasionally &amp;amp; like to have it installed. Opera has always been an early adopter of technology such as tabbed browsing, mouse gestures &amp;amp; speed dial. Now in Opera 10 there is are new features for example the ability to share your bookmarks between browsers on different computes &amp;amp; resizing the tab toolbar to display thumbnails of the pages. &lt;/p&gt;  &lt;p&gt;I always felt like one reason Opera didn't have as many downloads as say IE or Firefox is a few years ago there wasn't an easy big download button on Opera's homepage such as the easy big download Java button. Instead the user had to click a link then get to the next page to find the download. &lt;/p&gt;  &lt;p&gt;One new feature for Opera 10 is a resizable tab toolbar. It can be resized vertically to be able to view page previews. Check out the screen shot below. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_aeOfe_H0_iQ/SrbHeyoOWOI/AAAAAAAAANE/JD0UqH5PQT4/s1600-h/image%5B10%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_aeOfe_H0_iQ/SrbHfCf34yI/AAAAAAAAANI/ds1fVHhEors/image_thumb%5B6%5D.png?imgmax=800" width="415" height="134" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;So it's good to know about Opera to stay in tune with new browser features, use it if you want a quick, lightweight browser, is it going to be your default browser? Probably not. &lt;/p&gt;  &lt;p&gt;As Always All Comments Welcome!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.ChrisCatto.com" target="_blank"&gt;Catto&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-1692243933666079528?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/09/opera-10-worlds-fastest-browser-has.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-413985774186962486</guid><pubDate>Sun, 20 Sep 2009 00:53:00 +0000</pubDate><atom:updated>2009-09-19T20:53:19.429-04:00</atom:updated><title>Microsoft Visual Studio Hotkey Shortcuts 2009 Top (N)</title><description>&lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Keyboarding is very important to efficiency &amp;amp; hotkeys / shortcut keys are can be used many times each day to increase productivity. The way I’ve displayed my hotkeys are in a shorter list that are rated so it’s a top ten style where #1 is most used &amp;amp; #10 is tenth most used. &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; When in Visual Studio the common tasks I try to accomplish are running / debugging code, finding files in the solution explorer, using controls &amp;amp; their properties, using breakpoints, comments &amp;amp; formatting code. This list accomplishes these tasks &amp;amp; can be used in VS05, VS08 &amp;amp; VS10.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_aeOfe_H0_iQ/SrV8_TJrc-I/AAAAAAAAAM0/rn16ogbGe2s/s1600-h/image%5B2%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_aeOfe_H0_iQ/SrV8_l8NtHI/AAAAAAAAAM4/EHyStiODuRI/image_thumb.png?imgmax=800" width="244" height="54" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;0.5&amp;#160; Ctrl+S, Alt+Tab, F5&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Save file switch to browser &amp;amp; refresh combo   &lt;br /&gt;1&amp;#160; F5&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Run with debug    &lt;br /&gt;1b&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ctrl F5&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Run w/out Debug    &lt;br /&gt;2 Ctrl+Alt + L&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Unhides Solutions Explorer    &lt;br /&gt;3. Ctrl + Alt + X&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Unhides Toolbox    &lt;br /&gt;4. F4&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Unhides Properties    &lt;br /&gt;5&amp;#160; a. F9&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Sets Breakpoints    &lt;br /&gt;5&amp;#160; b. Ctrl + Shift + F9, Alt+Y&amp;#160;&amp;#160; Removes All Breakpoints    &lt;br /&gt;5&amp;#160; c. F10, F11&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Step into, Step Over    &lt;br /&gt;6&amp;#160; a. Ctrl + K, Ctrl + C&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Comments line(s)    &lt;br /&gt;6&amp;#160; b. Ctrl + k, Ctrl + U&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Uncomment line(s)    &lt;br /&gt;7. Ctrl + Pageup / Ctrl+pagedown / F7&amp;#160;&amp;#160; Split View    &lt;br /&gt;8&amp;#160; a. Shift+Alt+Enter&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Full Screen    &lt;br /&gt;8&amp;#160; b. Alt + U&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Resize (not full screen boo)    &lt;br /&gt;9&amp;#160; a. Ctrl + F&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Find    &lt;br /&gt;9&amp;#160; b. Ctrl + H&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Replace    &lt;br /&gt;10&amp;#160;&amp;#160;&amp;#160; Ctrl K, Ctrl D&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Format Co&lt;u&gt;d&lt;/u&gt;e All Pretty    &lt;br /&gt;11.&amp;#160;&amp;#160; Ctrl M, Ctrl O&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; C&lt;u&gt;o&lt;/u&gt;llapse Code    &lt;br /&gt;12.&amp;#160; Alt + S&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;u&gt;S&lt;/u&gt;top internal IIS    &lt;br /&gt;13&amp;#160; a. Ctrl + Shift&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Switch Tab     &lt;br /&gt;13&amp;#160; b. Ctrl + Shift&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Switch Tab reverse&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;This hotkey list is compact and ordered to display hotkeys that we can use daily. Of course there are large lists of every hotkey in studio out which is just not what I wanted to concentrate on right now. From one productive efficient keyboarding fan another. &lt;/p&gt;  &lt;p&gt;As always all comments welcome!&lt;/p&gt;  &lt;p&gt;Bye for now,&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://www.ChrisCatto.com" target="_blank"&gt;Catto&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-413985774186962486?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/09/microsoft-visual-studio-hotkey.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-9205871242333357670</guid><pubDate>Tue, 01 Sep 2009 01:30:00 +0000</pubDate><atom:updated>2009-09-20T21:03:17.071-04:00</atom:updated><title>70-536 MCTS .NET Foundations Questions #36</title><description>&lt;p&gt;Hey Now,&lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.    &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments.&lt;/p&gt;  &lt;p&gt;Whew! 211 Questions reviewed! &lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;Catto&lt;/p&gt;  &lt;p&gt;Q: #186 - #211&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 186 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing code for user &lt;b&gt;authentication and authorization&lt;/b&gt;. The username, password, and roles are stored in your application data store. You need to establish a user security context that will be used for authorization checks such as IsInRole. You write the following code segment to authorize the user. &lt;/p&gt;  &lt;p&gt;If TestPassword(UserName, Password) = False Then   &lt;br /&gt;Throw New Exception("Could not authenticate user")End If    &lt;br /&gt;Dim RolesArray() As String = LookUpUserRoles(UserName)   &lt;br /&gt;You need to complete this code so that it &lt;b&gt;establishes the user security context&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objID As New &lt;b&gt;GenericIdentity&lt;/b&gt;(UserName)    &lt;br /&gt;Dim objUser As New &lt;b&gt;GenericPrincipal&lt;/b&gt;(objID, RolesArray)    &lt;br /&gt;Thread.CurrentPrincipal = objUser &lt;/p&gt;  &lt;p&gt;B. Dim objID As New WindowsIdentity(UserName)   &lt;br /&gt;Dim objUser As New WindowsPrincipal(objID)    &lt;br /&gt;Thread.CurrentPrincipal = objUser &lt;/p&gt;  &lt;p&gt;C. Dim objNT As New NTAccount(UserName)   &lt;br /&gt;Dim objID As New GenericIdentity(objNT.Value)    &lt;br /&gt;Dim objUser As New GenericPrincipal(objID, RolesArray)    &lt;br /&gt;Thread.CurrentPrincipal = objUser &lt;/p&gt;  &lt;p&gt;D. Dim objToken As IntPtr = IntPtr.Zeroobj   &lt;br /&gt;Token = LogonUserUsingInterop(UserName, EncryptedPassword)    &lt;br /&gt;Dim objContext As WindowsImpersonationContext =    &lt;br /&gt;_WindowsIdentity.Impersonate(objToken) &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: Establishes security context A: &lt;b&gt;GenericIdentity&lt;/b&gt; GenericPrincipal&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 187 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;return&lt;/b&gt; the contents of an &lt;b&gt;isolated storage file as a string&lt;/b&gt;. The file is &lt;b&gt;machine-scoped&lt;/b&gt; and is named &lt;b&gt;Settings.dat&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. IsolatedStorageFileStream isoStream;  &lt;br /&gt;isoStream = new IsolatedStorageFileStream( “Settings.dat”, FileMode.Open);    &lt;br /&gt;string result = new StreamReader(isoStream).ReadToEnd(); &lt;/p&gt;  &lt;p&gt;B. IsolatedStorageFile isoFile;  &lt;br /&gt;isoFile = IsolatedStorageFile.&lt;b&gt;GetMachineStoreForAssembly&lt;/b&gt;();   &lt;br /&gt;IsolatedStorageFileStream isoStream;   &lt;br /&gt;isoStream = new IsolatedStorageFileStream( “Settings.dat”, FileMode.Open, isoFile);    &lt;br /&gt;string result = new StreamReader(isoStream).&lt;b&gt;ReadToEnd&lt;/b&gt;(); &lt;/p&gt;  &lt;p&gt;C. IsolatedStorageFileStream isoStream;  &lt;br /&gt;isoStream = new IsolatedStorageFileStream( “Settings.dat”, FileMode.Open);    &lt;br /&gt;string result = isoStream.ToString(); &lt;/p&gt;  &lt;p&gt;D. IsolatedStorageFile isoFile;  &lt;br /&gt;isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();   &lt;br /&gt;IsolatedStorageFileStream isoStream;   &lt;br /&gt;isoStream = new IsolatedStorageFileStream( “Settings.dat”, FileMode.Open, isoFile);    &lt;br /&gt;string result = isoStream.ToString(); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - File Stream String to end&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 188 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a code segment that will create a common language runtime (CLR) unit of &lt;b&gt;isolation&lt;/b&gt; within an application. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. AppDomainSetup mySetup = AppDomain.CurrentDomain.SetupInformation;  &lt;br /&gt;mySetup.ShadowCopyFiles = “true”; &lt;/p&gt;  &lt;p&gt;B. System.Diagnostics.Process myProcess;  &lt;br /&gt;myProcess = new System.Diagnostics.Process(); &lt;/p&gt;  &lt;p&gt;C. AppDomain domain;   &lt;br /&gt;domain = AppDomain.CreateDomain(“CompanyDomain”): &lt;/p&gt;  &lt;p&gt;D. System.ComponentModel.Component myComponent;  &lt;br /&gt;myComponent = new System.ComponentModel.Component(); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Q: CLR isolation A: Create AppDomain&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 189 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to create a method to &lt;b&gt;clear a Queue&lt;/b&gt; named q. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. foreach (object e in q) {   &lt;br /&gt;q.Dequeue();} &lt;/p&gt;  &lt;p&gt;B. foreach (object e in q) {   &lt;br /&gt;Enqueue(null);} &lt;/p&gt;  &lt;p&gt;C. q.&lt;b&gt;Clear&lt;/b&gt;(); &lt;/p&gt;  &lt;p&gt;D. q.Dequeue(); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – ez question right?&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 190 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code segment to call a function from the Win32 Application Programming Interface (API) by using &lt;b&gt;platform invoke.&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Dim PersonName as String = "N?el"  &lt;br /&gt;Dim Msg as String = "Welcome " + PersonName + "to club ''!"   &lt;br /&gt;Dim r As Boolean= User32API.MessageBox(0, Msg, PersonName, 0)    &lt;br /&gt;You need to define a method prototype that can best &lt;b&gt;marshal the string data&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;DllImport("user32", CharSet:=CharSet.Ansi)&amp;gt; _Public Function   &lt;br /&gt;MessageBox(ByVal hWnd As Int32, _ByVal text As String, ByVal caption As String, _ByVal t As UInt32) As BooleanEnd Function &lt;/p&gt;  &lt;p&gt;B. &amp;lt;DllImport("user32", EntryPoint:="MessageBoxA", _CharSet:=CharSet.Ansi)&amp;gt;   &lt;br /&gt;_Public Function MessageBox(ByVal hWnd As Int32,    &lt;br /&gt;_&amp;lt;MarshalAs(UnmanagedType.LPWStr)&amp;gt; ByVal text As String,    &lt;br /&gt;_&amp;lt;MarshalAs(UnmanagedType.LPWStr)&amp;gt; ByVal caption As String, _ByVal t As UInt32) As BooleanEnd Function &lt;/p&gt;  &lt;p&gt;C. &amp;lt;DllImport("user32", CharSet:=CharSet.&lt;b&gt;Unicode&lt;/b&gt;)&amp;gt; _Public Function    &lt;br /&gt;MessageBox(ByVal hWnd As Int32, _ByVal text As String, ByVal caption As String,    &lt;br /&gt;_ByVal t As UInt32) As BooleanEnd Function &lt;/p&gt;  &lt;p&gt;D. DllImport("user32", EntryPoint:="MessageBoxA", _CharSet:=CharSet.Unicode)&amp;gt;   &lt;br /&gt;_Public Function MessageBox(ByVal hWnd As Int32, &lt;/p&gt;  &lt;p&gt;_&amp;lt;MarshalAs(UnmanagedType.LPWStr)&amp;gt; ByVal text As String, &lt;/p&gt;  &lt;p&gt;_&amp;lt;MarshalAs(UnmanagedType.LPWStr)&amp;gt; ByVal caption As String, _ByVal t As &lt;/p&gt;  &lt;p&gt;UInt32) As BooleanEnd Function &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Q: Marshall String A: CharSet.&lt;b&gt;Unicode&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 191 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method to &lt;b&gt;compress an array of bytes&lt;/b&gt;. The bytes to be compressed are passed to the method in a parameter named &lt;b&gt;document&lt;/b&gt;. You need to &lt;b&gt;compress the contents of the incoming parameter&lt;/b&gt;. Which code segment should you use?&lt;/p&gt;  &lt;p&gt;A. MemoryStream^ intStream = gcnew MemoryStream(document);  &lt;br /&gt;GZipStream^ zipStream = gcnew GZipStream(inStream, CompressionMode::Compress);    &lt;br /&gt;array&amp;lt;Byte&amp;gt;^ result = gcnew array&amp;lt;Byte&amp;gt;(document-&amp;gt;Length);   &lt;br /&gt;zipStream-&amp;gt;Write(result, 0, result-&amp;gt;Length);    &lt;br /&gt;return result; &lt;/p&gt;  &lt;p&gt;B. MemoryStream^ stream = gcnew MemoryStream(document);  &lt;br /&gt;GZipStream^ zipStream = gcnew GZipStream(stream, &lt;/p&gt;  &lt;p&gt;CompressionMode::Compress);   &lt;br /&gt;zipStream-&amp;gt;Write(document, 0, document- &amp;gt;Length);   &lt;br /&gt;zipStream-&amp;gt;Close();   &lt;br /&gt;return stream-&amp;gt;ToArray(); &lt;/p&gt;  &lt;p&gt;C. MemoryStream^ outStream = gcnew MemoryStream();  &lt;br /&gt;GZipStream^ zipStream = gcnew GZipStream(&lt;b&gt;outStream&lt;/b&gt;,    &lt;br /&gt;CompressionMode::Compress);    &lt;br /&gt;zipStream-&amp;gt;Write(document, 0, document-&amp;gt;Length);   &lt;br /&gt;zipStream-&amp;gt;Close();   &lt;br /&gt;return outStream-&amp;gt;ToArray(); &lt;/p&gt;  &lt;p&gt;D. MemoryStream^ inStream = gcnew MemoryStream(document);  &lt;br /&gt;GZipStream^ zipStream = gcnew GZipStream(inStream,    &lt;br /&gt;CompressionMode::Compress);    &lt;br /&gt;MemoryStream^ outStream = gcnew MemoryStream();   &lt;br /&gt;int b;    &lt;br /&gt;while ((b = zipStream-&amp;gt;ReadByte()) != -1) {    &lt;br /&gt;outStream-&amp;gt;WriteByte((Byte)b);   &lt;br /&gt;} return outStream-&amp;gt;ToArray(); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – OutStream!&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 192 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You develop a service application named &lt;b&gt;PollingService&lt;/b&gt; that periodically calls long-running procedures. These procedures are called from the DoWork method. You use the following service application code: &lt;/p&gt;  &lt;p&gt;Partial Class PollingService Inherits ServiceBase   &lt;br /&gt;Dim blnExit As Boolean = False Protected Overrides Sub OnStart(ByVal args() As String)   &lt;br /&gt;Do    &lt;br /&gt;DoWork()    &lt;br /&gt;Loop While Not blnExit    &lt;br /&gt;End Sub    &lt;br /&gt;Protected Overrides Sub OnStop()    &lt;br /&gt;blnExit = True    &lt;br /&gt;End Sub    &lt;br /&gt;Private Sub DoWork()    &lt;br /&gt;End SubEnd Class &lt;/p&gt;  &lt;p&gt;When you attempt to start the service, you receive the following error message: Could not start the PollingService service on the local computer. Error 1053: The service did not respond to the start or control request in a timely fashion. You need to modify the service application code so that &lt;b&gt;the service starts properly&lt;/b&gt;. What should you do? &lt;/p&gt;  &lt;p&gt;A. Move the loop code into the constructor of the service class from the OnStart method. &lt;/p&gt;  &lt;p&gt;B. Drag a timer component onto the design surface of the service. Move the calls to the long-running procedure from the OnStart method into the Tick event procedure of the timer, set   &lt;br /&gt;the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method. &lt;/p&gt;  &lt;p&gt;C. Add a class-level &lt;b&gt;System.Timers.Timer&lt;/b&gt; variable to the service class code. Move the call to the DoWork method into the Elapsed event procedure of the timer, set the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method. &lt;/p&gt;  &lt;p&gt;D. Move the loop code from the OnStart method into the DoWork method. &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 - &lt;b&gt;System.Timers.Timer&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 193 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application to assist the user in conducting electronic surveys. The survey consists of 25 true-or-false questions. You need to perform the following tasks: &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Initialize each answer to true&lt;/b&gt;.&lt;b&gt;Minimize&lt;/b&gt; the amount of &lt;b&gt;memory&lt;/b&gt; used by each survey. Which storage option should you choose? &lt;/p&gt;  &lt;p&gt;A. BitVector32 answers = new BitVector32(1); &lt;/p&gt;  &lt;p&gt;B. BitVector32 answers = new &lt;b&gt;BitVector32(-1);&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;C. BitArray answers = new BitArray(1); &lt;/p&gt;  &lt;p&gt;D. BitArray answers = new BitArray(-1); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Q: init to true &amp;amp; min mem A: &lt;b&gt;BitVector32(-1);&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 194 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a method that runs by using the credentials of the end user. You need to use &lt;b&gt;M&lt;/b&gt;icro&lt;b&gt;s&lt;/b&gt;oft Windows groups to authorize the user. You must add a code segment that &lt;b&gt;identifies&lt;/b&gt; whether a user &lt;b&gt;is in the local group named Clerk&lt;/b&gt;.    &lt;br /&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. WindowsIdentity^ currentUser = WindowsIdentity::GetCurrent();  &lt;br /&gt;For each    &lt;br /&gt;(IdentityReference^ grp in currentUser-&amp;gt;Groups) { &lt;/p&gt;  &lt;p&gt;NTAccount^ grpAccount =   &lt;br /&gt;safe_cast&amp;lt;NTAccount^&amp;gt;(grp-&amp;gt;Translate(NTAccount::typeid));    &lt;br /&gt;isAuthorized = grpAccount-&amp;gt;Value-&amp;gt;Equals(    &lt;br /&gt;Environment::MachineName + “\\Clerk”);    &lt;br /&gt;if(isAuthorized) break;} &lt;/p&gt;  &lt;p&gt;B. &lt;b&gt;WindowsPrincipal&lt;/b&gt;^ currentUser =    &lt;br /&gt;safe_cast&amp;lt;WindowsPrincipal^&amp;gt;(Thread::CurrentPrincipal);   &lt;br /&gt;isAuthorized = currentUser-&amp;gt;IsInRole(“Clerk”); &lt;/p&gt;  &lt;p&gt;C. GenericPrincipal^ currentUser = safe_cast&amp;lt;GenericPrincipal^&amp;gt;(Thread::CurrentPrincipal);  &lt;br /&gt;isAuthorized = currentUser-&amp;gt;IsInRole(“Clerk”); &lt;/p&gt;  &lt;p&gt;D. WindowsPrincipal^ currentUser = safe_cast&amp;lt;WindowsPrincipal^&amp;gt;(Thread::CurrentPrincipal);  &lt;br /&gt;isAuthorized = currentUser-&amp;gt;IsInRole( Environment::MachineName); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Q: Identify if user is in local user group A: WindowsPrincipal IsInRole(“rolename”)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 195 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a class named &lt;b&gt;Age&lt;/b&gt;. You need to ensure that the Age class is written such that &lt;b&gt;collections of Age objects can be sorted&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public class Age {   &lt;br /&gt;public int Value;    &lt;br /&gt;public object CompareTo(object obj) {    &lt;br /&gt;if (obj is Age) { Age_age = (Age) obj;    &lt;br /&gt;return Value.ComapreTo(obj);    &lt;br /&gt;}    &lt;br /&gt;throw new ArgumentException(“object not an Age”);    &lt;br /&gt;} } &lt;/p&gt;  &lt;p&gt;B. public class Age {   &lt;br /&gt;public int Value;    &lt;br /&gt;public object CompareTo(int iValue) {    &lt;br /&gt;try {    &lt;br /&gt;return Value.ComapreTo(iValue);    &lt;br /&gt;} catch {    &lt;br /&gt;throw new ArgumentException(“object not an Age”);    &lt;br /&gt;} } } &lt;/p&gt;  &lt;p&gt;C. public class Age : &lt;b&gt;IComparable&lt;/b&gt; {   &lt;br /&gt;public int Value;    &lt;br /&gt;public int CompareTo(object obj) {    &lt;br /&gt;if (obj is Age) {    &lt;br /&gt;Age_age = (Age) obj; &lt;/p&gt;  &lt;p&gt;return Value.ComapreTo(_age.Value); &lt;/p&gt;  &lt;p&gt;}   &lt;br /&gt;throw new &lt;b&gt;ArgumentException&lt;/b&gt;(“object not an Age”);    &lt;br /&gt;} } &lt;/p&gt;  &lt;p&gt;D. public class Age : IComparable {  &lt;br /&gt;public int Value;    &lt;br /&gt;public int CompareTo(object obj) {    &lt;br /&gt;try {    &lt;br /&gt;return Value.ComapreTo(((Age) obj).Value);    &lt;br /&gt;} catch {    &lt;br /&gt;return -1;   &lt;br /&gt;} } } &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Sorting w/ &lt;b&gt;IComparable&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 196 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write a class named Employee that includes the following code segment.   &lt;br /&gt;public ref    &lt;br /&gt;class Employee{    &lt;br /&gt;String^ employeeId;    &lt;br /&gt;String^ employeeName;    &lt;br /&gt;String^ jobTitleName;   &lt;br /&gt;public: String^ GetName() { return employeeName; }    &lt;br /&gt;String^ GetJobTitle() { return jobTitleName; } &lt;/p&gt;  &lt;p&gt;You need to expose this class to COM in a type library. The COM interface must also facilitate forward-compatibility across new versions of the Employee class. You need to choose a method for generating the COM interface. What should you do? &lt;/p&gt;  &lt;p&gt;A. Add the following attribute to the class definition.[ClassInterface(ClassInterfaceType::None)]  &lt;br /&gt;public class Employee { &lt;/p&gt;  &lt;p&gt;B. Add the following attribute to the class   &lt;br /&gt;definition.[ClassInterface(ClassInterfaceType::AutoDual)]   &lt;br /&gt;public class Employee { &lt;/p&gt;  &lt;p&gt;C. Add the following attribute to the class definition.[ComVisible(true)]  &lt;br /&gt;public class Employee { &lt;/p&gt;  &lt;p&gt;D. &lt;b&gt;Define an interface&lt;/b&gt; for the class and add the following attribute to the class definition.[ClassInterface(ClassInterfaceType::None)]   &lt;br /&gt;public class Employee : IEmployee &lt;/p&gt;  &lt;p&gt;{ &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Define an interface &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 197 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to hash data for later verification by using the MD5 algorithm. The data is passed to your method as a byte array named message. You need to &lt;b&gt;compute the hash&lt;/b&gt;   &lt;br /&gt;of the incoming parameter by using MD5. You also need to place the result into a byte array. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. HashAlgorithm ^algo = HashAlgorithm::Create(“MD5”);  &lt;br /&gt;hash = algo-&amp;gt;CompueHash(message); &lt;/p&gt;  &lt;p&gt;B. HashAlgorithm ^algo = HashAlgorithm::Create(“MD5”);  &lt;br /&gt;hash = BitConverter::GetBytes(algo-&amp;gt;GetHashCode()); &lt;/p&gt;  &lt;p&gt;C. HashAlgorithm ^algo;  &lt;br /&gt;algo = HashAlgorithm::Create(message-&amp;gt;ToString());   &lt;br /&gt;hash = algo-&amp;gt;Hash; &lt;/p&gt;  &lt;p&gt;D. HashAlgorithm ^algo = HashAlgorithm::Create(“MD5”);  &lt;br /&gt;hash = nullptr;   &lt;br /&gt;algo-&amp;gt;TransformBlock(message, 0, message-&amp;gt;Length, hash, 0); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: Compute Hash A: ComputeHash&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-9205871242333357670?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-foundations-questions_31.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-6134612721453661982</guid><pubDate>Sun, 30 Aug 2009 01:43:00 +0000</pubDate><atom:updated>2009-08-29T21:43:36.460-04:00</atom:updated><title>70-536 MCTS .NET Foundations Questions #35</title><description>&lt;p&gt;Hey Now,&lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.    &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments.&lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;Catto&lt;/p&gt;  &lt;p&gt;Q: #176 - #185&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 176 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You develop a service application named FileService. You deploy the service application to multiple servers on your network. You implement the following code segment. (Line numbers are included for reference only.) &lt;/p&gt;  &lt;p&gt;01 public :    &lt;br /&gt;02 void StartService(String^ serverName){     &lt;br /&gt;03     &lt;br /&gt;04 ServiceController^ crtl = gcnew     &lt;br /&gt;05 ServiceController(“FileService”);     &lt;br /&gt;06 if (crtl-&amp;gt;Status == ServiceControllerStatus::Stopped){}     &lt;br /&gt;07 } &lt;/p&gt;  &lt;p&gt;You need to develop a routine that will &lt;b&gt;start&lt;/b&gt; &lt;b&gt;FileService&lt;/b&gt; if it stops. The routine must start FileService on the server identified by the serverName input parameter. Which two lines of code should you add to the code segment? (Each correct answer presents part of the solution. Choose two.)&lt;/p&gt;  &lt;p&gt;A. Insert the following line of code between lines 03 and 04:crtl.ServiceName = serverName; &lt;/p&gt;  &lt;p&gt;B. Insert the following line of code between lines 03 and 04:crtl.&lt;b&gt;MachineName&lt;/b&gt; = serverName; &lt;/p&gt;  &lt;p&gt;C. Insert the following line of code between lines 03 and 04:crtl.Site.Name = serverName; &lt;/p&gt;  &lt;p&gt;D. Insert the following line of code between lines 04 and 05:crtl.Continue(); &lt;/p&gt;  &lt;p&gt;E. Insert the following line of code between lines 04 and 05:crtl.&lt;b&gt;Start&lt;/b&gt;(); &lt;/p&gt;  &lt;p&gt;F. Insert the following line of code between lines 04 and 05:crtl.ExecuteCommand(0); &lt;/p&gt;  &lt;p&gt;Answer: B, E &lt;/p&gt;  &lt;p&gt;K8 – Repeated questions are easier the 4&lt;sup&gt;th&lt;/sup&gt; time. Crtl.MachineName = serverName &amp;amp; crtl.Start()&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 177 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are changing the security settings of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. FileSecurity security = new FileSecurity(&amp;quot;mydata.xml&amp;quot;, AccessControlSections.All);   &lt;br /&gt;security.SetAccessRuleProtection(true, true);    &lt;br /&gt;File.SetAccessControl(“mydata.xml”, security); &lt;/p&gt;  &lt;p&gt;B. FileSecurity security = new FileSecurity();   &lt;br /&gt;security.SetAccessRuleProtection(true, true);    &lt;br /&gt;File.SetAccessControl(“mydata.xml”, security); &lt;/p&gt;  &lt;p&gt;C. FileSecurity security = File.GetAccessControl(“mydata.xml”);   &lt;br /&gt;security.SetAccessRuleProtection(true, true); &lt;/p&gt;  &lt;p&gt;D. FileSecurity security = File.GetAccessControl(“mydata.xml”);   &lt;br /&gt;security.SetAuditRuleProtection(true, true);    &lt;br /&gt;File.SetAccessControl(“mydata.xml”, security); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – FileSecurity &amp;amp; AccessControlSections&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 178 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code to implement the CompanyClass.MyMethod function.    &lt;br /&gt;public class CompanyClass {     &lt;br /&gt;public int MyMethod(int arg) {     &lt;br /&gt;return arg;     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;You need to call the CompanyClass.MyMethod function &lt;b&gt;dynamically&lt;/b&gt; from an unrelated class in your assembly. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. CompanyClass^ myClass = gcnew CompanyClass();   &lt;br /&gt;Type^ t = CompanyClass::typeid;    &lt;br /&gt;MethodInfo^m = t-&amp;gt;GetMethod(“MyMethod”);     &lt;br /&gt;int i = (int)m-&amp;gt;Invoke(this, gcnew array&amp;lt;Object^&amp;gt; {1}); &lt;/p&gt;  &lt;p&gt;B. CompanyClass^ myClass = gcnew CompanyClass();   &lt;br /&gt;Type^ t = CompanyClass::typeid;     &lt;br /&gt;MethodInfo^m = t-&amp;gt;GetMethod(“&lt;b&gt;MyMethod&lt;/b&gt;”);     &lt;br /&gt;int i = (int)m-&amp;gt;Invoke(&lt;b&gt;myClass&lt;/b&gt;, gcnew array&amp;lt;Object^&amp;gt; {1}); &lt;/p&gt;  &lt;p&gt;C. CompanyClass^ myClass = gcnew CompanyClass();    &lt;br /&gt;Type^ t = CompanyClass::typeid;    &lt;br /&gt;MethodInfo^m = t-&amp;gt;GetMethod(“CompanyClass.MyMethod”);     &lt;br /&gt;int i = (int)m-&amp;gt;Invoke(myClass, gcnew array&amp;lt;Object^&amp;gt; {1}); &lt;/p&gt;  &lt;p&gt;D. Type^ t =Type::GetType(“CompanyClass”);    &lt;br /&gt;MethodInfo^m = t-&amp;gt;GetMethod(“MyMethod”);     &lt;br /&gt;int i = (int)m-&amp;gt;Invoke(this, gcnew array&amp;lt;Object^&amp;gt; {1}); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Q: Call function dynamically.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 179 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a class to compare a specially-formatted string. The default collation comparisons do not apply. You need to implement the IComparable&amp;lt;string&amp;gt; interface.    &lt;br /&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public class Person : IComparable&amp;lt;string&amp;gt;{    &lt;br /&gt;public int CompareTo(&lt;b&gt;string&lt;/b&gt; other){     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;B. public class Person : IComparable&amp;lt;string&amp;gt;{    &lt;br /&gt;public int CompareTo(object other){     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;C. public class Person : IComparable&amp;lt;string&amp;gt;{    &lt;br /&gt;public bool CompareTo(string other){     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;D. public class Person : IComparable&amp;lt;string&amp;gt;{    &lt;br /&gt;public bool CompareTo(object other){     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Compare special string A: int CompareTo(&lt;b&gt;string&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 180 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a &lt;b&gt;custom dictionary&lt;/b&gt;. The custom-dictionary class is named MyDictionary. You need to ensure that the dictionary is &lt;b&gt;type safe&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public ref class MYDictionary : public Dictionary&amp;lt;String^, String^&amp;gt;{}; &lt;/p&gt;  &lt;p&gt;B. public ref class MYDictionary : public Hashtable{}; &lt;/p&gt;  &lt;p&gt;C. public ref class MYDictionary : public IDictionary{}; &lt;/p&gt;  &lt;p&gt;D. public ref class MYDictionary {};Distionary&amp;lt;String^, String^&amp;gt;t = gcnew Dictionary&amp;lt;String^, String^&amp;gt;();   &lt;br /&gt;MyDictionary dictionary = (MyDictionary)t; &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Type Safe so use &amp;lt;String&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 181 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a utility screen for a new client application. The utility screen displays a thermometer that conveys the current status of processes being carried out by the application. &lt;/p&gt;  &lt;p&gt;You need to draw &lt;b&gt;a rectangle&lt;/b&gt; on the screen to serve as the background of the thermometer as shown in the exhibit. The rectangle must be &lt;b&gt;filled with gradient shading&lt;/b&gt;. Which code segment should you choose? &lt;/p&gt;  &lt;p&gt;Exhibit: &lt;/p&gt;  &lt;p&gt;A. Dim objRect As New Rectangle(10, 10, 450, 25)    &lt;br /&gt;Dim objBrush As New LinearGradientBrush( _objRect, Color.AliceBlue, Color.CornflowerBlue, _LinearGradientMode.ForwardDiagonal)    &lt;br /&gt;Dim objPen As New Pen(objBrush)Dim g As Graphics =     &lt;br /&gt;myForm.CreateGraphicsg.DrawRectangle(objPen, objRect) &lt;/p&gt;  &lt;p&gt;B. Dim objRect As New Rectangle(10, 10, 450, 25)    &lt;br /&gt;Dim objBrush As New LinearGradientBrush( _     &lt;br /&gt;objRect, Color.AliceBlue, Color.CornflowerBlue, _     &lt;br /&gt;LinearGradientMode.ForwardDiagonal)     &lt;br /&gt;Dim objPen As New Pen(objBrush)     &lt;br /&gt;Dim g As Graphics = myForm.CreateGraphicsg.FillRectangle(objBrush, objRect) &lt;/p&gt;  &lt;p&gt;C. Dim objRect As New RectangleF(10.0F, 10.0F, 450.0F, 25.0F)   &lt;br /&gt;Dim points() As System.Drawing.Point = _     &lt;br /&gt;{New Point(0, 0), New Point(110, 145)}     &lt;br /&gt;Dim objBrush As New LinearGradientBrush( _     &lt;br /&gt;objRect, Color.AliceBlue, Color.CornflowerBlue, _     &lt;br /&gt;LinearGradientMode.ForwardDiagonal)     &lt;br /&gt;Dim objPen As New Pen(objBrush)     &lt;br /&gt;Dim g As Graphics = myForm.CreateGraphicsg.DrawPolygon(objPen, points) &lt;/p&gt;  &lt;p&gt;D. Dim objRect As New Rectangle(10, 10, 450, 25)    &lt;br /&gt;Dim objBrush As New SolidBrush(Color.AliceBlue)     &lt;br /&gt;Dim objPen As New Pen(objBrush)Dim g As Graphics =     &lt;br /&gt;myForm.CreateGraphicsg.DrawRectangle(objPen, objRect) &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - Gradient Brush object. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 182 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to call a COM component. You need to use &lt;b&gt;declarative security&lt;/b&gt; to explicitly request the runtime to perform &lt;b&gt;a full stack walk&lt;/b&gt;. You must ensure that all callers have the required level of trust for COM interop before the callers execute your method. Which attribute should you place on the method? &lt;/p&gt;  &lt;p&gt;A. [SecurityPermission(    &lt;br /&gt;SecurityAction.&lt;b&gt;Demand&lt;/b&gt;,     &lt;br /&gt;Flags=SecurityPermissionFlag.UnmanagedCode)] &lt;/p&gt;  &lt;p&gt;B. [SecurityPermission(    &lt;br /&gt;SecurityAction.LinkDemand,     &lt;br /&gt;Flags=SecurityPermissionFlag.UnmanagedCode)] &lt;/p&gt;  &lt;p&gt;C. [SecurityPermission(    &lt;br /&gt;SecurityAction.Assert,     &lt;br /&gt;Flags = SecurityPermissionFlag.UnmanagedCode)] &lt;/p&gt;  &lt;p&gt;D. [SecurityPermission(    &lt;br /&gt;SecurityAction.Deny,     &lt;br /&gt;Flags = SecurityPermissionFlag.UnmanagedCode)] &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – All callers have required trust A: Demand&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 183 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method that returns an ArrayList named al. You need to ensure that changes to the ArrayList are performed in a thread-safe manner. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. ArrayList al = new ArrayList();   &lt;br /&gt;lock (al.SyncRoot){     &lt;br /&gt;return al;} &lt;/p&gt;  &lt;p&gt;B. ArrayList al = new ArrayList();   &lt;br /&gt;lock (al.SyncRoot.GetType()){     &lt;br /&gt;return al;} &lt;/p&gt;  &lt;p&gt;C. ArrayList al = new ArrayList();   &lt;br /&gt;Monitor.Enter(al);Monitor.Exit(al);return al; &lt;/p&gt;  &lt;p&gt;D. ArrayList al = new ArrayList();   &lt;br /&gt;ArrayList sync_al = ArrayList.Synchronized(al);    &lt;br /&gt;return sync_al; &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Changes to ArrayList Thread safe A: ArrayList sync_al&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 184 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are loading a new assembly into an application. You need to override the default evidence for the assembly. You require the common language runtime (CLR) to grant the assembly a permission set, as if the assembly were loaded from the local intranet zone. You need to build the evidence collection. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objEvidence As New Evidence( _    &lt;br /&gt;Assembly.GetExecutingAssembly.Evidence &lt;/p&gt;  &lt;p&gt;B. Dim objEvidence As New EvidenceobjEvidence.AddAssembly( _   &lt;br /&gt;New Zone(SecurityZone.Intranet)) &lt;/p&gt;  &lt;p&gt;C. Dim objEvidence As New EvidenceobjEvidence.&lt;b&gt;AddHost&lt;/b&gt;( _     &lt;br /&gt;New Zone(SecurityZone.&lt;b&gt;Intranet&lt;/b&gt;)) &lt;/p&gt;  &lt;p&gt;D. Dim objEvidence As New Evidence( _ &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomain.Evidence) &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 Q: Grant Assembly permission A: &lt;b&gt;AddHost&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 185 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an application that lists processes on remote computers. The application requires a method that performs the following tasks: Accept the remote computer name as a string parameter named strComputer.Return an ArrayList object that contains the names of all processes that are running on that computer. You need to write a code segment that retrieves the name of each process that is running on the remote computer and adds the name to the ArrayList    &lt;br /&gt;object. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. ArrayList al = new ArrayList();   &lt;br /&gt;Process[] procs = Process.GetProcessesByName(s trComputer);    &lt;br /&gt;foreach (Process proc in procs) {    &lt;br /&gt;al.Add(proc);} &lt;/p&gt;  &lt;p&gt;B. ArrayList al = new ArrayList();   &lt;br /&gt;Process[] procs = Process.GetProcesses(strComputer);    &lt;br /&gt;foreach (Process proc in procs) {     &lt;br /&gt;al.Add(proc);} &lt;/p&gt;  &lt;p&gt;C. ArrayList al = new ArrayList();   &lt;br /&gt;Process[] procs = Process.GetProcessesByName(s trComputer);    &lt;br /&gt;foreach (Process proc in procs) {    &lt;br /&gt;al.Add(proc.ProcessName);} &lt;/p&gt;  &lt;p&gt;D. ArrayList al = new ArrayList();   &lt;br /&gt;Process[] procs = Process.&lt;b&gt;GetProcesses&lt;/b&gt;(strComputer);    &lt;br /&gt;foreach (Process proc in procs) {    &lt;br /&gt;al.Add(proc.&lt;b&gt;ProcessName&lt;/b&gt;);} &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 Get Process&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-6134612721453661982?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-foundations-questions_29.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-4682103929168124705</guid><pubDate>Sat, 29 Aug 2009 04:17:00 +0000</pubDate><atom:updated>2009-08-29T00:17:52.164-04:00</atom:updated><title>70-536 MCTS .NET Foundations Questions #34</title><description>&lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx, &lt;/p&gt;  &lt;p&gt;Catto &lt;/p&gt;  &lt;p&gt;#167 - #175&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 167 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a &lt;b&gt;class library&lt;/b&gt; that is used by applications in three departments of your company. The library contains a Department class with the following definition. &lt;/p&gt;  &lt;p&gt;Public Class Department &lt;/p&gt;  &lt;p&gt;Public name As String &lt;/p&gt;  &lt;p&gt;Public manager As String &lt;/p&gt;  &lt;p&gt;End Class &lt;/p&gt;  &lt;p&gt;Each application uses a custom configuration section to store department-specific values in the application configuration file as shown in the following code. &lt;/p&gt;  &lt;p&gt;&amp;lt;Department&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;name&amp;gt;Hardware&amp;lt;/name&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;manager&amp;gt;Company&amp;lt;/manager&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;/Department&amp;gt; &lt;/p&gt;  &lt;p&gt;You need to write a code segment &lt;b&gt;that creates a Department object instance&lt;/b&gt; by using the field values retrieved from the application configuration file. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Public Class deptElement    &lt;br /&gt;Inherits ConfigurationElement     &lt;br /&gt;Protected Overrides Sub DeserializeElement( _     &lt;br /&gt;ByVal reader As XmlReader, _     &lt;br /&gt;ByVal serializeCollectionKey As Boolean)     &lt;br /&gt;Dim dept As Department = New Department()     &lt;br /&gt;dept.name = ConfigurationManager.AppSettings(&amp;quot;name&amp;quot;)     &lt;br /&gt;dept.manager = _     &lt;br /&gt;ConfigurationManager.AppSettings(&amp;quot;manager&amp;quot;)     &lt;br /&gt;End Sub     &lt;br /&gt;End Class &lt;/p&gt;  &lt;p&gt;B. Public Class deptElement    &lt;br /&gt;Inherits ConfigurationElement     &lt;br /&gt;Protected Overrides Sub DeserializeElement( _     &lt;br /&gt;ByVal reader As XmlReader, _     &lt;br /&gt;ByVal serializeCollectionKey As Boolean)     &lt;br /&gt;Dim dept As Department = New Department()     &lt;br /&gt;dept.name = reader.GetAttribute(&amp;quot;name&amp;quot;)     &lt;br /&gt;dept.manager = reader.GetAttribute(&amp;quot;manager&amp;quot;)     &lt;br /&gt;End Sub     &lt;br /&gt;End Class &lt;/p&gt;  &lt;p&gt;C. Public Class deptHandler    &lt;br /&gt;Implements &lt;b&gt;IConfigurationSectionHandler&lt;/b&gt;    &lt;br /&gt;Public Function Create(ByVal parent As Object, _     &lt;br /&gt;ByVal configContext As Object, _     &lt;br /&gt;ByVal section As System.Xml.XmlNode) As Object _     &lt;br /&gt;Implements IConfigurationSectionHandler.Create     &lt;br /&gt;Dim dept As Department = new Department()     &lt;br /&gt;dept.name = section.&lt;b&gt;SelectSingleNode&lt;/b&gt;(&amp;quot;name&amp;quot;).&lt;b&gt;InnerText&lt;/b&gt;    &lt;br /&gt;dept.manager = _     &lt;br /&gt;section.&lt;b&gt;SelectSingleNode&lt;/b&gt;(&amp;quot;manager&amp;quot;).InnerText     &lt;br /&gt;Return dept     &lt;br /&gt;End Function     &lt;br /&gt;End Class &lt;/p&gt;  &lt;p&gt;D. Public Class deptHandler    &lt;br /&gt;Implements &lt;b&gt;IConfigurationSectionHandler&lt;/b&gt;    &lt;br /&gt;Public Function Create(ByVal parent As Object, _     &lt;br /&gt;ByVal configContext As Object, _     &lt;br /&gt;ByVal section As System.Xml.XmlNode) As Object _     &lt;br /&gt;Implements IConfigurationSectionHandler.Create     &lt;br /&gt;Dim dept As Department = new Department()     &lt;br /&gt;dept.name = section.Attributes(&amp;quot;name&amp;quot;).Value     &lt;br /&gt;dept.manager = section.Attributes(&amp;quot;manager&amp;quot;).Value     &lt;br /&gt;Return dept     &lt;br /&gt;End Function     &lt;br /&gt;End Class &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – A: &lt;b&gt;IconfigurationSectionHandler &amp;amp; SelectSingleNode&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 168 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method that returns an ArrayList named al. You need to ensure that c&lt;b&gt;hanges&lt;/b&gt; to the &lt;b&gt;ArrayList&lt;/b&gt; are performed in a &lt;b&gt;thread-safe manner&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. ArrayList^ al = gcnew ArrayList();   &lt;br /&gt;lock (al-&amp;gt;SyncRoot){     &lt;br /&gt;return al;} &lt;/p&gt;  &lt;p&gt;B. ArrayList^ al = gcnew ArrayList();   &lt;br /&gt;lock (al-&amp;gt;SyncRoot.GetType()){     &lt;br /&gt;return al;} &lt;/p&gt;  &lt;p&gt;C. ArrayList^ al = gcnew ArrayList();   &lt;br /&gt;Monitor::Enter(al);    &lt;br /&gt;Monitor::Exit(al);    &lt;br /&gt;return al; &lt;/p&gt;  &lt;p&gt;D. ArrayList^ al = gcnew ArrayList();   &lt;br /&gt;ArrayList^ sync_al = ArrayList::&lt;b&gt;Synchronized&lt;/b&gt;(al);    &lt;br /&gt;return sync_al; &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Thread safe manner to changes in array list A: Synchronized&lt;/p&gt;  &lt;p&gt;Question: 169 &lt;/p&gt;  &lt;p&gt;You need to write a code segment that &lt;b&gt;transfers the contents of a byte array named dataToSend&lt;/b&gt; by using a &lt;b&gt;NetworkStream&lt;/b&gt; object named netStream. You need to use a &lt;b&gt;cache&lt;/b&gt; of size 8,192 bytes. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim memStream As New MemoryStream(8192)memStream.Write(dataToSend, 0, _    &lt;br /&gt;CType(netStream.Length, Integer)) &lt;/p&gt;  &lt;p&gt;B. Dim memStream As New MemoryStream(8192)netStream.Write(dataToSend, 0, _    &lt;br /&gt;CType(memStream.Length, Integer)) &lt;/p&gt;  &lt;p&gt;C. Dim bufStream As New &lt;b&gt;BufferedStream&lt;/b&gt;(netStream, &lt;b&gt;8192&lt;/b&gt;)     &lt;br /&gt;bufStream.Write(dataToSend, 0, dataToSend.Length) &lt;/p&gt;  &lt;p&gt;D. Dim bufStream As New &lt;b&gt;BufferedStream&lt;/b&gt;(netStream)     &lt;br /&gt;bufStream.Write(dataToSend, 0, 8192) &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – BufferedStream(networkStream, CasheBytes)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 170 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an undo buffer that stores data modifications. You need to ensure that the undo functionality undoes the most recent data modifications first. You also need to ensure that the &lt;b&gt;undo buffer&lt;/b&gt; permits the storage of &lt;b&gt;strings only&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim undoBuffer As New Stack(Of String) &lt;/p&gt;  &lt;p&gt;B. Dim undoBuffer As New Stack() &lt;/p&gt;  &lt;p&gt;C. Dim undoBuffer As New Queue(Of String) &lt;/p&gt;  &lt;p&gt;D. Dim undoBuffer As New Queue() &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Stack Last in first out combied with of string this is VB version&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 171 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an &lt;b&gt;undo buffer&lt;/b&gt; that stores data modifications. You need to ensure that the undo functionality undoes the &lt;b&gt;most recent data modifications first&lt;/b&gt;. You also need to ensure that the undo buffer permits the storage of &lt;b&gt;strings only&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Stack&amp;lt;string&amp;gt; undoBuffer = new Stack&amp;lt;string&amp;gt;(); &lt;/p&gt;  &lt;p&gt;B. Stack undoBuffer = new Stack(); &lt;/p&gt;  &lt;p&gt;C. Queue&amp;lt;string&amp;gt; undoBuffer = new Queue&amp;lt;string&amp;gt;(); &lt;/p&gt;  &lt;p&gt;D. Queue undoBuffer = new Queue(); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Stack Last in first out combied with of string C# &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 172 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create the definition for a Vehicle class by using the following code segment. &lt;/p&gt;  &lt;p&gt;public class Vehicle {    &lt;br /&gt;[XmlAttribute(AttributeName = &amp;quot;category&amp;quot;)]     &lt;br /&gt;public string vehicleType;     &lt;br /&gt;public string model;     &lt;br /&gt;[XmlIgnore]     &lt;br /&gt;public int year;     &lt;br /&gt;[XmlElement(ElementName = &amp;quot;mileage&amp;quot;)]     &lt;br /&gt;public int miles;     &lt;br /&gt;public ConditionType condition;     &lt;br /&gt;public Vehicle() {     &lt;br /&gt;}     &lt;br /&gt;public enum ConditionType {     &lt;br /&gt;[XmlEnum(&amp;quot;Poor&amp;quot;)] BelowAverage,     &lt;br /&gt;[XmlEnum(&amp;quot;Good&amp;quot;)] Average,     &lt;br /&gt;[XmlEnum(&amp;quot;Excellent&amp;quot;)] AboveAverage     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;You create an instance of the Vehicle class. You populate the public fields of the Vehicle class instance as shown in the following table: &lt;/p&gt;  &lt;p&gt;MemberValuevehicleTypecarmodelraceryear2002miles15000conditionAboveAverage You need to identify the XML block that is produced when this Vehicle class instance is &lt;b&gt;serialized&lt;/b&gt;. Which block of XML represents the output of serializing the Vehicle instance? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Vehicle xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&amp;quot;     &lt;br /&gt;vehicleType=&amp;quot;car&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;model&amp;gt;racer&amp;lt;/model&amp;gt;     &lt;br /&gt;&amp;lt;miles&amp;gt;15000&amp;lt;/miles&amp;gt;     &lt;br /&gt;&amp;lt;condition&amp;gt;AboveAverage&amp;lt;/condition&amp;gt;     &lt;br /&gt;&amp;lt;/Vehicle&amp;gt;     &lt;br /&gt;B. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;     &lt;br /&gt;&amp;lt;Vehicle     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;     &lt;br /&gt;xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;category=&amp;quot;car&amp;quot;&amp;gt;&lt;/b&gt;    &lt;br /&gt;&amp;lt;model&amp;gt;racer&amp;lt;/model&amp;gt;     &lt;br /&gt;&amp;lt;mileage&amp;gt;15000&amp;lt;/mileage&amp;gt;     &lt;br /&gt;&amp;lt;&lt;b&gt;condition&lt;/b&gt;&amp;gt;&lt;b&gt;Excellent&lt;/b&gt;&amp;lt;/condition&amp;gt;     &lt;br /&gt;&amp;lt;/Vehicle&amp;gt; &lt;/p&gt;  &lt;p&gt;C. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Vehicle xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;    &lt;br /&gt;category=&amp;quot;car&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;model&amp;gt;racer&amp;lt;/model&amp;gt;     &lt;br /&gt;&amp;lt;mileage&amp;gt;15000&amp;lt;/mileage&amp;gt;     &lt;br /&gt;&amp;lt;conditionType&amp;gt;Excellent&amp;lt;/conditionType&amp;gt;     &lt;br /&gt;&amp;lt;/Vehicle&amp;gt; &lt;/p&gt;  &lt;p&gt;D. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;   &lt;br /&gt;&amp;lt;Vehicle xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;category&amp;gt;car&amp;lt;/category&amp;gt;     &lt;br /&gt;&amp;lt;model&amp;gt;racer&amp;lt;/model&amp;gt;     &lt;br /&gt;&amp;lt;mileage&amp;gt;15000&amp;lt;/mileage&amp;gt;     &lt;br /&gt;&amp;lt;condition&amp;gt;Excellent&amp;lt;/condition&amp;gt;     &lt;br /&gt;&amp;lt;/Vehicle&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Car category along with condition Excellent.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 173 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a code segment that transfers the first 80 bytes from a stream variable named stream1 into a new byte array named byteArray. You also need to ensure that the code segment assigns the number of bytes that are transferred to an integer variable named bytesTransferred. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. &lt;b&gt;bytesTransferred&lt;/b&gt; = stream1.&lt;b&gt;Read&lt;/b&gt;(byteArray, 0, 80) &lt;/p&gt;  &lt;p&gt;B. For i As Integer = 1 To 80    &lt;br /&gt;stream1.WriteByte(byteArray(i))     &lt;br /&gt;bytesTransferred = i     &lt;br /&gt;If Not stream1.CanWrite Then     &lt;br /&gt;Exit For     &lt;br /&gt;End IfNext &lt;/p&gt;  &lt;p&gt;C. While bytesTransferred &amp;lt; 80    &lt;br /&gt;stream1.Seek(1, SeekOrigin.Current)     &lt;br /&gt;byteArray(bytesTransferred) = _     &lt;br /&gt;Convert.ToByte(stream1.ReadByte())bytesTransferred += 1End While &lt;/p&gt;  &lt;p&gt;D. stream1.Write(byteArray, 0, 80)bytesTransferred = byteArray.Length &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Bytes transferred with no loop&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 174 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are changing the &lt;b&gt;security settings&lt;/b&gt; of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. FileSecurity^ security = gcnew &lt;b&gt;FileSecurity(“mydata.xml”, AccessControlSections::All);&lt;/b&gt;    &lt;br /&gt;security-&amp;gt;SetAccessRuleProtection( true, true);    &lt;br /&gt;File::SetAccessControl(“mydata.xml”, security); &lt;/p&gt;  &lt;p&gt;B. FileSecurity^ security = gcnew FileSecurity();   &lt;br /&gt;security-&amp;gt;SetAccess RuleProtection(true,true);    &lt;br /&gt;File::SetAccessControl(“mydata.xml”, security); &lt;/p&gt;  &lt;p&gt;C. FileSecurity^ security = File::GetAccessControl(“mydata.xml”);   &lt;br /&gt;security-&amp;gt;SetAccessRuleProtection(true, true); &lt;/p&gt;  &lt;p&gt;D. FileSecurity^ security =    &lt;br /&gt;File::GetAccessControl(“mydata.xml”);security-&amp;gt;SetAuditRuleProtection(true, true);    &lt;br /&gt;File::SetAccessControl(“mydata.xml”, security); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Change Security Settings … &lt;b&gt;FileSecurity&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 175 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are testing a component that &lt;b&gt;serializes&lt;/b&gt; the &lt;b&gt;Meeting&lt;/b&gt; &lt;b&gt;class&lt;/b&gt; instances so that they can be saved to the file system. The Meeting class has the following definition: &lt;/p&gt;  &lt;p&gt;public class Meeting {    &lt;br /&gt;private string title;     &lt;br /&gt;public int roomNumber;     &lt;br /&gt;public string[] invitees;     &lt;br /&gt;public Meeting(){     &lt;br /&gt;}     &lt;br /&gt;public Meeting(string t){     &lt;br /&gt;title = t;     &lt;br /&gt;} } &lt;/p&gt;  &lt;p&gt;The component contains a procedure with the following code segment.    &lt;br /&gt;Meeting myMeeting = new Meeting(“Goals”);     &lt;br /&gt;myMeeting.roomNumber = 1100;     &lt;br /&gt;string[] attendees = new string[2]{“Company”, “Mary”};     &lt;br /&gt;myMeeting.invitees = attendees;    &lt;br /&gt;XmlSerializer xs = new XmlSerializer(typeof(Meeting));     &lt;br /&gt;StreamWriter writer = new StreamWriter(@&amp;quot;C:\Meeting.xml&amp;quot;);     &lt;br /&gt;Xs.Serialize(writer, myMeeting);     &lt;br /&gt;writer.Close(); &lt;/p&gt;  &lt;p&gt;You need to identify the XML block that is written to the C:\Meeting.xml file as a result of running this procedure. Which XML block represents the content that will be written to the C:\Meeting.xml file? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;title&amp;gt;Goals&amp;lt;/title&amp;gt;     &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;     &lt;br /&gt;&amp;lt;invitee&amp;gt;Company&amp;lt;/invitee&amp;gt;     &lt;br /&gt;&amp;lt;invitee&amp;gt;Mary&amp;lt;/invitee&amp;gt;     &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;B. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;roomNumber&amp;gt;&lt;b&gt;1100&lt;/b&gt;&amp;lt;/roomNumber&amp;gt;     &lt;br /&gt;&amp;lt;&lt;b&gt;invitees&lt;/b&gt;&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;&lt;b&gt;Company&lt;/b&gt;&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;/&lt;b&gt;invitees&lt;/b&gt;&amp;gt;     &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;C. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;     &lt;br /&gt;title=&amp;quot;Goals&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt; &amp;lt;invitees&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Company&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;/invitees&amp;gt;     &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;D. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt; &amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;     &lt;br /&gt;&amp;lt;invitees&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Company&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;/invitees&amp;gt;     &lt;br /&gt;&amp;lt;invitees&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;/invitees&amp;gt;     &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: B&lt;/p&gt;  &lt;p&gt;K8 – XML &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-4682103929168124705?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-foundations-questions.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-1739392801740983092</guid><pubDate>Sat, 29 Aug 2009 02:40:00 +0000</pubDate><atom:updated>2009-08-28T22:40:29.446-04:00</atom:updated><title>70-536 MCTS .NET 2.0 Configuration #33</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Hey Now Everybody,&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from section #3 of the exam.NET 2.0 Configuration Debug!.&lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;Catto&lt;/p&gt;  &lt;p&gt;&lt;b&gt;3. &lt;a name="testsec3"&gt;Embedding configuration, diagnostic, management &amp;amp; installation features&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Code&lt;/b&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;1. Which of the following configuration files shows the best way to &lt;b&gt;define a database connection string&lt;/b&gt; in an application configuration file?&lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;lt;connectionStrings&amp;gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;add &lt;b&gt;name&lt;/b&gt;=&amp;quot;AdventureWorksString&amp;quot; providerName=&amp;quot;System.Data.SqlClient&amp;quot; &lt;/p&gt;  &lt;p&gt;connectionString=&amp;quot;Data Source=localhost;Initial Catalog=AdventureWorks; Integrated Security=true&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;lt;/connectionStrings&amp;gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The .NET Framework 2.0 adds support for the &amp;lt;connectionStrings&amp;gt; configuration section for defining database connection information. Define this section within the &amp;lt;configuration&amp;gt; section using the &amp;lt;add&amp;gt; element with properties of name, providerName, and connectionString.&lt;/p&gt;  &lt;p&gt;While you can define database connection information in the appSettings section (and you had no choice in earlier versions of the .NET Framework), your best choice is to use the strongly-typed &amp;lt;connectionStrings&amp;gt; section.&lt;/p&gt;  &lt;p&gt;2. You are writing an application that requires the user to open a second application named &amp;quot;Application.exe&amp;quot;, make a configuration change, and then close the application. You want to automatically launch the application for the user, and then wait indefinitely until the user closes the application. Which of the following code samples accomplishes this?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim p As Process = New Process&lt;/p&gt;  &lt;p&gt;p.&lt;b&gt;StartInfo&lt;/b&gt;.FileName = &amp;quot;Application.exe&amp;quot;&lt;/p&gt;  &lt;p&gt;p.Start&lt;/p&gt;  &lt;p&gt;&lt;b&gt;p.WaitForExit&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To launch a new process, first create an instance of the Process class, and then specify the Process.StartInfo.FileName property. Finally, call the Process.Start method. To stop processing until the application closes, call the &lt;b&gt;Process.WaitForExit method&lt;/b&gt; without specifying a time.&lt;/p&gt;  &lt;p&gt;You cannot specify an application filename in the Process constructor.&lt;/p&gt;  &lt;p&gt;Specifying a time for the Process.WaitForExit method causes the runtime to continue execution after the specified time even if the application hasn't closed.&lt;/p&gt;  &lt;p&gt;You cannot specify an application filename in the Process constructor. Additionally, specifying a time for the Process.WaitForExit method causes the runtime to continue execution after the specified time even if the application hasn't closed.&lt;/p&gt;  &lt;p&gt;3. As part of a troubleshooting tool for the systems administrators at your organization, you are writing a command-line tool that automatically kills any unresponsive applications. Which of the following code samples accomplishes this?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;For Each p As Process In Process.GetProcesses&lt;/p&gt;  &lt;p&gt;&lt;b&gt;If Not p.Responding Then&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;p.Kill&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;End If&lt;/p&gt;  &lt;p&gt;Next&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;First, you must retrieve an array of all processes by calling Process.GetProcesses. Then you should call &lt;b&gt;Process.Kill&lt;/b&gt; for each process that you need to terminate.&lt;/p&gt;  &lt;p&gt;There is no Process.GetUnresponsiveProcesses method, and Process.Kill is not a static method.&lt;/p&gt;  &lt;p&gt;4. You are creating a tool for the IT department that displays the MAC address and description of every network adapter on a remote computer with the IP address 192.168.1.200. Which of the following code samples does this correctly?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim ms As ManagementScope = New ManagementScope(&amp;quot;\\192.168.1.200\root\cimv2&amp;quot;)&lt;/p&gt;  &lt;p&gt;Dim oq As ObjectQuery = New ObjectQuery(&amp;quot;SELECT * FROM Win32_NetworkAdapterConfiguration&amp;quot;)&lt;/p&gt;  &lt;p&gt;Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(ms, oq)&lt;/p&gt;  &lt;p&gt;Dim moc As ManagementObjectCollection = mos.Get&lt;/p&gt;  &lt;p&gt;For Each mo As ManagementObject In moc&lt;/p&gt;  &lt;p&gt;Console.WriteLine(mo(&amp;quot;MacAddress&amp;quot;) + &amp;quot;: &amp;quot; + mo(&amp;quot;Description&amp;quot;))&lt;/p&gt;  &lt;p&gt;Next&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To query running network adapters on a remote computer:&lt;/p&gt;  &lt;p&gt;1. Create a ManagementScope object to define the remote computer. The scope is not simply the computer name, however. It must be in the form &amp;quot;\\computername\root\cim2&amp;quot;.&lt;/p&gt;  &lt;p&gt;2. Create an instance of ObjectQuery using a Windows Management Instrumentation (WMI) query. The WMI query must be in the form &amp;quot;SELECT fields FROM Win32_NetworkAdapterConfiguration&amp;quot;.&lt;/p&gt;  &lt;p&gt;3. Create an instance of ManagementObjectSearcher by providing both the scope and the query.&lt;/p&gt;  &lt;p&gt;4. Create an instance of ManagementObjectCollection by calling the ManagementObjectSearcher.Get method.&lt;/p&gt;  &lt;p&gt;You can then iterate through the ManagementObjects in the ManagementObjectCollection to examine individual network adapters.&lt;/p&gt;  &lt;p&gt;You can create a ConnectionsOptions object if you want to specify a username and password. However, you cannot use a ConnectionsOptions object in place of a ManagementScope object.&lt;/p&gt;  &lt;p&gt;5. You are writing an application that communicates with a database. You need to be able to communicate with any type of database configured by the system administrator. Systems administrators can choose either a Microsoft SQL Server, Oracle, OleDB, or ODBC connection. Which of the following code samples would establish a database connection named db to any of those database types?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim css As ConnectionStringSettings = ConfigurationManager.ConnectionStrings(0)&lt;/p&gt;  &lt;p&gt;Dim db As IDBConnection = Nothing&lt;/p&gt;  &lt;p&gt;Select &lt;b&gt;css&lt;/b&gt;.&lt;b&gt;ProviderName&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Case &amp;quot;System.Data.SqlClient&amp;quot;&lt;/p&gt;  &lt;p&gt;db = New SqlConnection(css.ConnectionString)&lt;/p&gt;  &lt;p&gt;' break&lt;/p&gt;  &lt;p&gt;Case &amp;quot;System.Data.OracleClient&amp;quot;&lt;/p&gt;  &lt;p&gt;db = New OracleConnection(css.ConnectionString)&lt;/p&gt;  &lt;p&gt;' break&lt;/p&gt;  &lt;p&gt;Case &amp;quot;System.Data.OleDb&amp;quot;&lt;/p&gt;  &lt;p&gt;db = New OleDbConnection(css.ConnectionString)&lt;/p&gt;  &lt;p&gt;' break&lt;/p&gt;  &lt;p&gt;Case &amp;quot;System.Data.Odbc&amp;quot;&lt;/p&gt;  &lt;p&gt;db = New OdbcConnection(css.ConnectionString)&lt;/p&gt;  &lt;p&gt;' break&lt;/p&gt;  &lt;p&gt;End Select&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To determine the database type based on a ConnectionStringSettings object, examine &lt;b&gt;ConnectionStringSettings.ProviderName&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;ConnectionStringSettings.Name stores the server name, not the database type.&lt;/p&gt;  &lt;p&gt;ConnectionStringSettings.ConnectionString stores the entire connection string, which does not include the database type.&lt;/p&gt;  &lt;p&gt;ConnectionStringSettings.ElementInformation.Type describes the type of element, which will always be System.Configuration.ConnectionStringSettings.&lt;/p&gt;  &lt;p&gt;6. You are writing an application that stores window state in the application's configuration file. Given the following configuration file, which of the following code samples correctly tests the &lt;b&gt;IsMaximized element&lt;/b&gt; in a .NET Framework 2.0 application? (Choose all that apply.)&lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;appSettings&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;add key=&amp;quot;IsMinimized&amp;quot; value=&amp;quot;False&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;add key=&amp;quot;IsMaximized&amp;quot; value=&amp;quot;True&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;add key=&amp;quot;username&amp;quot; value=&amp;quot;user1&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/appSettings&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer&lt;/b&gt; ' VB&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;If Configuration&lt;b&gt;Manager&lt;/b&gt;.AppSettings(&amp;quot;IsMaximized&amp;quot;) = &amp;quot;True&amp;quot; Then&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;If ConfigurationManager.&lt;b&gt;AppSettings.Get&lt;/b&gt;(&amp;quot;IsMaximized&amp;quot;) = &amp;quot;True&amp;quot; Then&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The &lt;b&gt;ConfigurationManager.AppSettings&lt;/b&gt; collection provides access to elements defined in the &amp;lt;appSettings&amp;gt; section of a configuration file. Because it is a collection, you can access elements as an &lt;/p&gt;  &lt;p&gt;array or by using the Get method.&lt;/p&gt;  &lt;p&gt;The ConfigurationSettings class is obsolete in the .NET Framework 2.0.&lt;/p&gt;  &lt;p&gt;ConfigurationManager does not contain AppSettings elements. You must access ConfigurationManager.AppSettings instead.&lt;/p&gt;  &lt;p&gt;7. Which of the following configuration files correctly defines the information required to connect to a database by defining the first element of ConfigurationManager.ConnectionStrings regardless of other configuration files that might exist?&lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;connectionStrings&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;lt;clear/&amp;gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;add &lt;b&gt;name&lt;/b&gt;=&amp;quot;&lt;b&gt;AdventureWorksString&lt;/b&gt;&amp;quot; &lt;/p&gt;  &lt;p&gt;providerName=&amp;quot;System.Data.SqlClient&amp;quot; &lt;/p&gt;  &lt;p&gt;connectionString=&amp;quot;Data Source=localhost;Initial Catalog=AdventureWorks; Integrated Security=true&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/connectionStrings&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To define the first element of ConfigurationManager.ConnectionStrings, you must include the &lt;b&gt;&amp;lt;clear/&amp;gt;&lt;/b&gt; element, which removes any existing &amp;lt;connectionStrings&amp;gt; elements. You must set the providerName attribute to the database type, such as System.Data.SqlClient. The Name element is a friendly name used to refer to that specific connection string.&lt;/p&gt;  &lt;p&gt;8. Which of the following code samples successfully writes the entire contents of the &lt;b&gt;Application log &lt;/b&gt;to the console?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim el As New EventLog()&lt;/p&gt;  &lt;p&gt;&lt;b&gt;el.Log = &amp;quot;Application&amp;quot;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;For Each ele As &lt;b&gt;EventLogEntry&lt;/b&gt; In el.Entries&lt;/p&gt;  &lt;p&gt;Console.WriteLine(ele.Source + &amp;quot;: &amp;quot; + ele.Message)&lt;/p&gt;  &lt;p&gt;Next&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;To read an entire log file, create an instance of the EventLog class, specify the EventLog.Log property, and then iterate through EventLog.Entries. EventLog.Entries is an EventLogEntryCollection property containing EventLogEntry objects.&lt;/p&gt;  &lt;p&gt;9. While performing a security review of a peer's code, you see an If statement that checks the ConfigurationManager.AppSettings(&amp;quot;username&amp;quot;) value and grants additional privileges if it is equal to &amp;quot;Tom&amp;quot;. You need to test the behavior, but the application does not currently have a configuration file. How would you &lt;b&gt;create the configuration file to define that value&lt;/b&gt;?&lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;lt;appSettings&amp;gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;&lt;b&gt;add key=&amp;quot;&lt;/b&gt;username&amp;quot; value=&amp;quot;Tom&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/appSettings&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Elements accessed through ConfigurationManager.AppSettings must be defined in the application configuration file, in an &amp;lt;appSettings&amp;gt; element nested within &amp;lt;configuration&amp;gt;. To define a specific &lt;/p&gt;  &lt;p&gt;key, use the &amp;lt;add key&amp;gt; element.&lt;/p&gt;  &lt;p&gt;10. You are writing an application that communicates with a database. The connection string is stored in the application configuration file. Which of the following would correctly &lt;b&gt;retrieve the connection string&lt;/b&gt;?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;&lt;b&gt;ConfigurationManager.ConnectionStrings(0).ConnectionString&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;ConfigurationManager.ConnectionStrings is a collection of type ConnectionStringSettingsCollection that contains the connection strings loaded from the application's configuration file. Because it is a collection, you must access it using an index. ConfigurationSettings, which is obsolete, does not contain a ConnectionStrings property.&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;11. You have created a custom event log for your application. Your application provides tools for managing the event log, and one of the methods you need to implement &lt;b&gt;clears all events&lt;/b&gt; from the event log. Which of the following code samples would do this?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Public Sub ClearEventLog()&lt;/p&gt;  &lt;p&gt;Dim el As New EventLog(&amp;quot;MyApp&amp;quot;)&lt;/p&gt;  &lt;p&gt;el.Source = &amp;quot;DemoApp&amp;quot;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;el.Clear()&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;End Sub&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;To clear an event log, create an EventLog object and specify the &lt;b&gt;EventLog.Source&lt;/b&gt; property. Then call &lt;b&gt;EventLog.Clear&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;There is no EventLog.Commit or EventLog.Log.Clear method.&lt;/p&gt;  &lt;p&gt;Iterating through EventLogEntry objects and calling EventLogEntry.Dispose would not remove the events from the event log; it would only destroy the instances of the EventLogEntry objects created &lt;/p&gt;  &lt;p&gt;in the runtime.&lt;/p&gt;  &lt;p&gt;12. Which of the following code samples correctly &lt;b&gt;displays the modules loaded by Application.exe&lt;/b&gt;?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim p As Process = New Process&lt;/p&gt;  &lt;p&gt;p.StartInfo.FileName = &amp;quot;Application.exe&amp;quot;&lt;/p&gt;  &lt;p&gt;p.Start&lt;/p&gt;  &lt;p&gt;For Each m As &lt;b&gt;ProcessModule In p.Modules&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Console.WriteLine(m.FileName)&lt;/p&gt;  &lt;p&gt;Next&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;To retrieve a list of modules loaded by a process, access the &lt;b&gt;ProcessModule&lt;/b&gt; array in Process.Modules.&lt;/p&gt;  &lt;p&gt;Process.Modules is an array of ProcessModule objects, not ProcessModuleCollection, and Process.Modules is not a static method.&lt;/p&gt;  &lt;p&gt;13. As a favor to your IT department, you are writing a console application that outputs information related to the security of the current computer. Which of the following code samples correctly displays running services?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim oq As New ObjectQuery(&amp;quot;SELECT Caption FROM Win32_Service WHERE Started = &lt;b&gt;TRUE&lt;/b&gt;&amp;quot;)&lt;/p&gt;  &lt;p&gt;Dim mos As New ManagementObjectSearcher(oq)&lt;/p&gt;  &lt;p&gt;Dim moc As ManagementObjectCollection = mos.&lt;b&gt;Get&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;For Each mo As ManagementObject In moc&lt;/p&gt;  &lt;p&gt;Console.WriteLine(mo(&amp;quot;Caption&amp;quot;).ToString())&lt;/p&gt;  &lt;p&gt;Next&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To query running services:&lt;/p&gt;  &lt;p&gt;1. Create an instance of ObjectQuery using a Windows Management Instrumentation (WMI) query. The WMI query must be in the form &amp;quot;SELECT fields FROM Win32_Service WHERE criteria&amp;quot;. In this case, the criteria must be &amp;quot;&lt;b&gt;WHERE Started = True&amp;quot;&lt;/b&gt; to return services that have started.&lt;/p&gt;  &lt;p&gt;2. Create an instance of ManagementObjectSearcher based on the query.&lt;/p&gt;  &lt;p&gt;3. Next, create an instance of ManagementObjectCollection by calling the &lt;b&gt;ManagementObjectSearcher.Get&lt;/b&gt; method.&lt;/p&gt;  &lt;p&gt;You can then iterate through the ManagementObjects in the ManagementObjectCollection to examine individual services.&lt;/p&gt;  &lt;p&gt;ManagementObjectSearcher.Query is a property used to define the query; it is not a method. You must use ManagementObjectSearcher.Get to run a query.&lt;/p&gt;  &lt;p&gt;14. You need to establish a database connection to a server based on configuration information stored in the application's configuration file. Which of the following properties would you examine to determine the &lt;b&gt;server name&lt;/b&gt;?&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer: ConnectionStringSettings.Name&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;ConnectionStringSettings.Name&lt;/b&gt; stores the &lt;b&gt;server name&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;The ConnectionStringSettings.&lt;b&gt;ProviderName&lt;/b&gt; describes the database type and allows you to &lt;b&gt;distinguish&lt;/b&gt; between Oracle, SQL Server, and other &lt;b&gt;databases&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;ConnectionStringSettings.&lt;b&gt;ConnectionString&lt;/b&gt; stores the &lt;b&gt;entire connection string&lt;/b&gt;, which does not include the server name.&lt;/p&gt;  &lt;p&gt;ConnectionStringSettings.ElementInformation.Properties contains all the attributes that apply to the element. It does not normally include a Name element.&lt;/p&gt;  &lt;p&gt;15. Which class would you use to programmatically access &lt;b&gt;the connection strings stored&lt;/b&gt; in the following &lt;b&gt;configuration&lt;/b&gt; file?&lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;connectionStrings&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;clear/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;add name=&amp;quot;AdventureWorksString&amp;quot; &lt;/p&gt;  &lt;p&gt;providerName=&amp;quot;System.Data.SqlClient&amp;quot; connectionString=&amp;quot;Data Source=localhost;Initial Catalog=AdventureWorks; Integrated Security=true&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;add name=&amp;quot;MarsEnabledSqlServer2005String&amp;quot; providerName=&amp;quot;System.Data.SqlClient&amp;quot; connectionString=&amp;quot;Server=Aron1;Database=pubs;Trusted_Connection=True;MultipleActiveResultSets=true&amp;quot; /&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;add name=&amp;quot;OdbcConnectionString&amp;quot; &lt;/p&gt;  &lt;p&gt;providerName=&amp;quot;System.Data.Odbc&amp;quot; &lt;/p&gt;  &lt;p&gt;connectionString=&amp;quot;Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\adatabase.mdb;Uid=Admin;Pwd=R3m3emberToUseStrongPasswords;&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/connectionStrings&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/configuration&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer:&lt;/b&gt; &lt;b&gt;ConfigurationManager.ConnectionStrings&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explaination: &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;U&lt;/b&gt;se ConfigurationManager.ConnectionStrings to access database connection strings&lt;/p&gt;  &lt;p&gt;16. You are writing an application that performs long-running calculations. To minimize the impact on the responsiveness of the user's computer, you want to warn the user if your application is running at Normal or higher priority. Which of the following code samples accomplishes this?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;If &lt;b&gt;Process.GetCurrentProcess.BasePriority &amp;gt;= 8&lt;/b&gt; Then&lt;/p&gt;  &lt;p&gt;Console.WriteLine(&amp;quot;For best results, run this application at low priority.&amp;quot;)&lt;/p&gt;  &lt;p&gt;End If&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;You should examine the &lt;b&gt;Process.GetCurrentProcess().BasePriority property&lt;/b&gt;. A value of &lt;b&gt;4&lt;/b&gt; is considered &lt;b&gt;low&lt;/b&gt; priority, &lt;b&gt;8 is normal priority&lt;/b&gt;, &lt;b&gt;13&lt;/b&gt; is &lt;b&gt;high&lt;/b&gt; priority, and &lt;b&gt;24&lt;/b&gt; is &lt;b&gt;real-time&lt;/b&gt; priority. Therefore, a value of 8 or higher indicates the current application is running at Normal priority.&lt;/p&gt;  &lt;p&gt;There is no Process.BasePriority.IsNormal property.&lt;/p&gt;  &lt;p&gt;There is no Process.BasePriority.IsLow property.&lt;/p&gt;  &lt;p&gt;Checking Process.GetCurrentProcess().BasePriority for a value of 4 or higher would be true even if the process were running as a low priority.&lt;/p&gt;  &lt;p&gt;17. You are writing an application that &lt;b&gt;remembers a username in the application settings&lt;/b&gt;. Which of the following code samples is the best way to retrieve a username?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim nvc As NameValueCollection = &lt;b&gt;ConfigurationManager.AppSettings&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Dim un As String = nvc(&amp;quot;username&amp;quot;)&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;When writing assemblies for the .NET Framework version 2.0, you should use &lt;b&gt;ConfigurationManager.AppSettings&lt;/b&gt; instead of ConfigurationSettings.AppSettings. ConfigurationSettings is now obsolete, and using it will result in a compiler warning.&lt;/p&gt;  &lt;p&gt;ConfigurationManager.AppSettings does not have a GetSetting method.&lt;/p&gt;  &lt;p&gt;18. You are in the process of isolating a complicated bug in a console application that occurs only in rare circumstances. You want to be able to write messages to the Output window in Microsoft Visual Studio 2005, as shown in the following figure. Which of the following code samples accomplishes this by writing the message, &amp;quot;Entering main processing loop&amp;quot;?&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_aeOfe_H0_iQ/SpiVGKMkq3I/AAAAAAAAAME/lxzdrPTfzE8/s1600-h/clip_image002%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://lh3.ggpht.com/_aeOfe_H0_iQ/SpiVHBL2l2I/AAAAAAAAAMI/yA4J96fLX2c/clip_image002_thumb.jpg?imgmax=800" width="244" height="125" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer: &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim dtl As New DefaultTraceListener&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Trace.Listeners.Add&lt;/b&gt;(dtl)&lt;/p&gt;  &lt;p&gt;Debugger.Log(2&lt;b&gt;, &amp;quot;Information&amp;quot;, &amp;quot;Entering main processing loop&lt;/b&gt;&amp;quot;)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: &lt;/b&gt;To write information to the Output window, first create an instance of &lt;b&gt;DefaultTraceListener&lt;/b&gt;. Then add it to the Trace.&lt;b&gt;Listeners&lt;/b&gt; collection. Finally, call &lt;b&gt;Debugger.Log&lt;/b&gt; to write the message. Debugger.Log takes three parameters: a level, a category, and a message. The third parameter is the message that appears in the Output window.&lt;/p&gt;  &lt;p&gt;There is no Trace.Listeners.Log method.&lt;/p&gt;  &lt;p&gt;19. You need to provide users with a list of network drives so that they can choose where to store a file. Which of the following code samples correctly &lt;b&gt;displays network drives and available space&lt;/b&gt;?&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim oq As New ObjectQuery(&amp;quot;SELECT Size, Name FROM Win32_&lt;b&gt;LogicalDisk&lt;/b&gt; where DriveType=4&amp;quot;)&lt;/p&gt;  &lt;p&gt;Dim mos As New &lt;b&gt;ManagementObjectSearcher&lt;/b&gt;(oq)&lt;/p&gt;  &lt;p&gt;Dim moc As ManagementObjectCollection = mos.Get&lt;/p&gt;  &lt;p&gt;For Each mo As ManagementObject In moc&lt;/p&gt;  &lt;p&gt;Console.WriteLine(mo(&amp;quot;Name&amp;quot;).ToString() + &amp;quot;, Free Space: &amp;quot; + mo(&amp;quot;Size&amp;quot;).ToString())&lt;/p&gt;  &lt;p&gt;Next&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To query available drives:&lt;/p&gt;  &lt;p&gt;1. Create an instance of ObjectQuery using a Windows Management Instrumentation (&lt;b&gt;WMI&lt;/b&gt;) query. The WMI query must be in the form &amp;quot;SELECT fields FROM Win32_LogicalDisk WHERE criteria&amp;quot;.&lt;/p&gt;  &lt;p&gt;2. Create an instance of &lt;b&gt;ManagementObjectSearcher&lt;/b&gt; based on the query.&lt;/p&gt;  &lt;p&gt;3. Create an instance of ManagementObjectCollection by calling the &lt;b&gt;ManagementObjectSearcher.Get&lt;/b&gt; &lt;b&gt;method&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;You can then iterate through the ManagementObjects in the ManagementObjectCollection to examine individual drives.&lt;/p&gt;  &lt;p&gt;ManagementObjectSearcher.Get is not a static method; you must create an instance to use it.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;&lt;/b&gt;&lt;b&gt;Installer class&lt;/b&gt;: The following &lt;b&gt;steps&lt;/b&gt; need to be taken to use a class derived from the &lt;b&gt;Installer class&lt;/b&gt;:      &lt;ul&gt;       &lt;li&gt;* Inherit the Installer class.&lt;/li&gt;        &lt;li&gt;* Override the Install, Commit, Rollback, and Uninstall methods.&lt;/li&gt;        &lt;li&gt;* Add the RunInstallerAttribute to your derived class, and set it to true.&lt;/li&gt;        &lt;li&gt;* Put your derived class in the assembly with your application to install.&lt;/li&gt;        &lt;li&gt;* Invoke the installers.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The Installer class does not have OnInstall, OnCommit, OnRollback, or OnUninstall methods.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;To &lt;b&gt;uninstall&lt;/b&gt; the installation, only the following tasks need to be done:      &lt;ul&gt;       &lt;li&gt;1. Create a new AssemblyInstaller or ComponentInstaller object.&lt;/li&gt;        &lt;li&gt;2. Specify the name of the assembly or application.&lt;/li&gt;        &lt;li&gt;3. Call the Uninstall method.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The Rollback method is used to cancel an installation that is in progress before it is committed. The Commit method finalizes an installation.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;EventLogEntry&lt;b&gt;.InstanceId&lt;/b&gt;, in the .NET Framework version 2.0, &lt;b&gt;defines the Event ID&lt;/b&gt; number shown in the Event Log console.      &lt;ul&gt;       &lt;li&gt;EventLogEntry.EventID was used to define the Event ID in the .NET Framework versions 1.0 and 1.1; however, it is now obsolete.&lt;/li&gt;        &lt;li&gt;EventLogEntry.Index gets the index of an event in the Event Log.&lt;/li&gt;        &lt;li&gt;EventLogEntry.Source gets the name of the application that generated the event.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;To &lt;b&gt;wait for a management event&lt;/b&gt;:&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;1. &lt;b&gt;Create &lt;/b&gt;a new &lt;b&gt;ManagementEventWatcher&lt;/b&gt; object.&lt;/p&gt;  &lt;p&gt;2. Associate an &lt;b&gt;EventQuery object&lt;/b&gt; with the ManagementEventWatcher object.&lt;/p&gt;  &lt;p&gt;3. Call the ManagementEventWatcher.&lt;b&gt;WaitForNextEvent &lt;/b&gt;method.&lt;/p&gt;  &lt;p&gt;4. Call the ManagementEventWatcher.&lt;b&gt;Stop&lt;/b&gt; method.&lt;/p&gt;  &lt;ul&gt;   &lt;ul&gt;     &lt;li&gt;You do not need to call the ManagementEventWatcher.Start method when calling ManagementEventWatcher.WaitForNextEvent. You only need to call ManagementEventWatcher.Start when &lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;registering an event handler.&lt;/li&gt;    &lt;li&gt;When writing an Application that must perform &lt;b&gt;event logging&lt;/b&gt;, the correct &lt;b&gt;time&lt;/b&gt; to create an &lt;b&gt;event source&lt;/b&gt; is &lt;b&gt;during installation&lt;/b&gt;.&lt;b&gt;&lt;/b&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;o You should create a new event source durning app installation. This will require the user to have admin privileges.&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;o You only need to create an event source once. Therefore, it is unnecessary to create it before each event. &lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;o You should create a new event source during application installation, rather than before you write the first event. &lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;· Application that performs event logging are supported by the following OS’&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;o Windows Server 2003&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;o Windows XP&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;· &lt;b&gt;OnBeforeInstall – &lt;/b&gt;is the &lt;b&gt;method&lt;/b&gt; of the &lt;b&gt;installer class&lt;/b&gt; which is called &lt;b&gt;first&lt;/b&gt; when installing an app.&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;o When installing an app, methods are called in the following order: OnBeforeInstaller, Install, OnAfterInstall, OnCommiting, Commit, &amp;amp; finally Oncommitted&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Debug.Assert&lt;/b&gt; – evaluates a condition &amp;amp; displays a message to the debugging output window. Debug methods do not run in release code. &lt;b&gt;Ex.&lt;/b&gt; To assist w/ debugging, you want to write an output message if a configuration setting has not been defined. You do not want to waste processing time in released code. You should use the &lt;b&gt;Debug.Assert&lt;/b&gt; method      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;Debug&lt;/b&gt;.&lt;b&gt;Fail&lt;/b&gt; causes the debugger to break @ the line of code &amp;amp; output a failure message.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Debug&lt;/b&gt;.&lt;b&gt;Flush&lt;/b&gt; flushes the debug output buffer&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Debug&lt;/b&gt;.&lt;b&gt;Indent&lt;/b&gt; controls the output formatting&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Debugger&lt;/b&gt;.&lt;b&gt;Break&lt;/b&gt; – acts just like a hard-coded breakpoint, except you can call it programmatically. You would like to pause execution to examine the value of variables during debugging, but you do not want to pause execution when users run release versions of the app. You should use the Debugger.Break method.      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;Console.Read &amp;amp; Console.ReadLine&lt;/b&gt; interrupt processing in both debug &amp;amp; release versions of code.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Debug&lt;/b&gt;.&lt;b&gt;Assert&lt;/b&gt; validates a value &amp;amp; does not stop execution during debugging. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Application configuration files &lt;/b&gt;should be located in the same folder as the executable file &amp;amp; named &amp;lt;filename.exe&amp;gt; config. ex. You are writing a windows form app called MyApp. You need to define application settings &amp;amp; database connection strings in a custom configuration file in the same folder as your MyApp.exe file You should name the configuration file &lt;b&gt;MyApp.exe.config. &lt;/b&gt;&lt;/li&gt;    &lt;li&gt;You are writing an app that adds events to an event log. Based on the &lt;b&gt;EventLogEntryType enumeration&lt;/b&gt;, the following are &lt;b&gt;valid entry types&lt;/b&gt;:      &lt;ul&gt;       &lt;li&gt;Error&lt;/li&gt;        &lt;li&gt;Information&lt;/li&gt;        &lt;li&gt;Warning&lt;/li&gt;        &lt;li&gt;FailureAudit&lt;/li&gt;        &lt;li&gt;SuccessAudit&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Debugger.Log&lt;/b&gt; – Debugger Log posts information to the attached Debugger in one is present. If no Debugger is present, the results is effectively nothing. ex. You need to write info to the debugging console, but you do not want to waste processing cycles when users run release versionso f the application. You should call the &lt;b&gt;Debugger.Log method&lt;/b&gt;&lt;/li&gt;    &lt;li&gt;To &lt;b&gt;query local resources&lt;/b&gt;, you need instances of ObjectQuery, ManagementObjectSearcher &amp;amp; ManagementObjectCollection. You need to perform a &lt;b&gt;management query&lt;/b&gt; for resources located on the local computer. You’ll need to create instances of the following classes&lt;b&gt;:&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;ManagementObjectSearcher&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;ObjectQuery&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;ManagementObjectCollection&lt;/b&gt;&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;PerformanceCounter.RawValue – &lt;/b&gt;offers the best performance in single-threaded app. Ex. You are writing a single threaded app that performs custom performance logging to enable users to use the Performance console to track the current number of users who have connected to your app. You should call the &lt;b&gt;PerformanceCounter.RawValue&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;PerformanceCounter.&lt;/b&gt;Decrement words well in Multi-Threaded environments. However PerformanceCounter.RawValue offers the best performance in single-treaded apps&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Rollback method –&lt;/b&gt; to remove changes made during installation when install is cancelled.      &lt;ul&gt;       &lt;li&gt;The&lt;b&gt; Install method &lt;/b&gt;performs the actual installation&lt;/li&gt;        &lt;li&gt;The&lt;b&gt; Commit method &lt;/b&gt;finalizes the installation changes&lt;/li&gt;        &lt;li&gt;The&lt;b&gt; OnCommitting method &lt;/b&gt;runs immediately before the Commit method&lt;/li&gt;        &lt;li&gt;There is no OnRollback method&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;PerformanceCounter.Decrement&lt;/b&gt; – works well in multithreaded environments, Because users are disconnecting you would want to decrease the user counter. Ex. you’re writing a multithreaed app that performs custom logging to enable users to use the Performance console to track the current number of users who have connected to your app. You should call the &lt;b&gt;PerformanceCounter.Decrement&lt;/b&gt; method when a user &lt;b&gt;disconnects.&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;You would call&lt;b&gt; Performancecounter.Increment&lt;/b&gt; when a user connects, not disconnects.&lt;/li&gt;        &lt;li&gt;You would call&lt;b&gt; PerformanceCounter.IncrementBy&lt;/b&gt; when a user connects, not disconnects.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;PerformanceCounter&lt;/b&gt;.&lt;b&gt;RawValue&lt;/b&gt; would offer better performance than PerformanceCounter.Decrement. However PerformanceCounter.RawValue may yield an inaccurate count in multithreaded apps. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Application event log&lt;/b&gt; – You should always write events to the Application event log or a custom event log. &lt;b&gt;ex&lt;/b&gt;. You are writing an application that implements a custom authentication mechanism. You should write entries related to unsuccessful authentication attempts to the &lt;b&gt;application event log.&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;The&lt;b&gt; Security log &lt;/b&gt;is reserved for the operating system to store auditing events. &lt;/li&gt;        &lt;li&gt;The &lt;b&gt;System event log&lt;/b&gt; is reserved for operating system events. &lt;/li&gt;        &lt;li&gt;The &lt;b&gt;Active Directory event log&lt;/b&gt; is reserved for events relating to an Active Directory domain controller. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Commit – &lt;/b&gt;During a successful installation, &lt;b&gt;Installer.Commit&lt;/b&gt; is the la&lt;b&gt;st method called&lt;/b&gt;, Commit finalizes all changes made during the installation.&lt;b&gt; &lt;/b&gt;&lt;/li&gt;    &lt;li&gt;&lt;b&gt;Debug.Fail – &lt;/b&gt;causes the debugger to break at the line of code &amp;amp; output a failure message. ex. you want to verify an important value &amp;amp; stop execution if the value is not set properly. However, you only want to stop execution during debugging. You don’t want users with released versions of your app to experience problems. You should use the &lt;b&gt;Debug.Fail method&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;Debug.Assert &lt;/b&gt;evaluates a condition &amp;amp; displays a message, but it does not interrupt processing. &lt;/li&gt;        &lt;li&gt;&lt;b&gt;Debug.Flush &lt;/b&gt;flushes the debug output buffer&lt;b&gt;&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Debug.Indent &lt;/b&gt;controls the output formatting.&lt;b&gt; &lt;/b&gt;&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-1739392801740983092?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-20-configuration-33.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-6067926144479656288</guid><pubDate>Thu, 27 Aug 2009 23:49:00 +0000</pubDate><atom:updated>2009-08-27T19:49:40.516-04:00</atom:updated><title>70-536 MCTS .NET 2.0 Configuration #32</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Hey Now Everybody,&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from .NET 2.0 Configuration GAC GAC!.&lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;Catto&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;.NET Framework 2.0 Configuration&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;a href="http://lh3.ggpht.com/_aeOfe_H0_iQ/SpcbklLp71I/AAAAAAAAAL8/6FM0JbqeHbA/s1600-h/clip_image002%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://lh5.ggpht.com/_aeOfe_H0_iQ/Spcbk8h2rKI/AAAAAAAAAMA/U1b2Qf6Pphg/clip_image002_thumb%5B1%5D.jpg?imgmax=800" width="396" height="211" /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;ul&gt;     &lt;ul&gt;       &lt;ul&gt;         &lt;ul&gt;           &lt;li&gt;Chapter 9 Lesson 2&lt;/li&gt;         &lt;/ul&gt;       &lt;/ul&gt;     &lt;/ul&gt;   &lt;/ul&gt;    &lt;li&gt;Click on the node you should use to &lt;b&gt;view &amp;amp; fix dependencies &lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;To view, manage, &amp;amp; fix dependencies. &lt;b&gt;First click the application node&lt;/b&gt;. If necessary, add the application. Then select the application &amp;amp; click View The Assembly Dependencies or Fix This App&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Click on the node you should use to&lt;b&gt; make an assembly globally available&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;The &lt;b&gt;assembly cache&lt;/b&gt; contains the set of assemblies available to all applications targeting the .NET Framework. Mutiple versions of the same assembly can be placed in the assembly cache. This allows two applications to correctly execute even if they require different versions of the same shared assembly. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Click on the node you should use to&lt;b&gt; configure binding policy.&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;Binding policy allows you to specify a new version of the assembly when an application requests a different version. To configure binding policy the assembly must first be in the global assembly cache (GAC). Then you can configure it from the &lt;b&gt;Configured Assemblies node&lt;/b&gt;&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Click on the node you should use to &lt;b&gt;view permission sets&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;You should use the &lt;b&gt;Runtime Security Policy node. &lt;/b&gt;The .NET Framework 2.0 Config tool gives you the ability to evaluate code groups &amp;amp; permissions sets that apply to an assembly. This is especially critical in Active Directory environments, where policy can be applied at the enterprise, machine, &amp;amp; user levels. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-6067926144479656288?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-20-configuration-32.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-3252006210397542936</guid><pubDate>Thu, 27 Aug 2009 23:46:00 +0000</pubDate><atom:updated>2009-08-27T19:46:08.846-04:00</atom:updated><title>70-536 MCTS .NET #31 Implementation Section 4</title><description>&lt;p&gt;&lt;b&gt;Hey Now Everybody,&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Section 4 Study Notes from Implementing serialization and input/output functionality in a .NET Framework app&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the book exam.Please feel free to comment.&lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;Catto&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Implementing serialization and input/output functionality in a .NET Framework app&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Per-user storage&lt;/b&gt; – is appropriate for &lt;b&gt;isolated storage&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;Isolated storage is perfect for storing data that should be kept separate for different users&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;The following ways &lt;b&gt;isolated storage&lt;/b&gt; can be &lt;b&gt;separated by&lt;/b&gt;:      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;User&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Assembly&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Application Domain&lt;/b&gt;          &lt;ul&gt;           &lt;li&gt;Isolated Storage is always separated by user &amp;amp; assembly. It can also be separated by application domain.&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;The following classes you can use when &lt;b&gt;serializing data&lt;/b&gt; to be consumed by applications running on a UNIX-based OS:      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;SoapFormatter&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;XmlSerializer&lt;/b&gt;          &lt;ul&gt;           &lt;li&gt;Both SoapFiormatter &amp;amp; XMLSerializer serialize data using open standards that other platforms can consume. &lt;/li&gt;            &lt;li&gt;BinaryFormatter provides very efficient serialization, but it is not open-standards based&lt;/li&gt;            &lt;li&gt;Iserializable is an interface that you can use to implement custom serialization. You cannot use it directly to perform serialization&lt;/li&gt;            &lt;li&gt;SerializationBinder allows users to control class loading &amp;amp; mandate what class to load. You cannot use it to perform serialization.&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;FileSystemWatcher.&lt;b&gt;Created – &lt;/b&gt;occurs when a file or directory in the specified path is created.      &lt;ul&gt;       &lt;li&gt;When you are writing an app that needs to process files when they are added to a folder. FileSystemWatcher.&lt;b&gt;Created is the event you should be respond to. &lt;/b&gt;&lt;/li&gt;        &lt;li&gt;FileSystemWatcher.&lt;b&gt;Changed &lt;/b&gt;only occurs when an existing file is modified.&lt;/li&gt;        &lt;li&gt;FileSystemWatcher.&lt;b&gt;Deleted &lt;/b&gt;occurs when a file is removed.&lt;/li&gt;        &lt;li&gt;FileSystemWatcher.&lt;b&gt;Renamed &lt;/b&gt;occurs when a file is renamed&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Serialized event occurs immediately after serialization     &lt;ul&gt;       &lt;li&gt;Serialized is the serialization event that you should respond to if you need to &lt;b&gt;run code after serialization occurs&lt;/b&gt; when creating a class that implements the &lt;b&gt;ISerializable&lt;/b&gt; interface. &lt;/li&gt;        &lt;li&gt;Serializing event occurs prior to serialization &lt;/li&gt;        &lt;li&gt;Deserializing event occurs prior to deserialization &lt;/li&gt;        &lt;li&gt;Deserializied event occurs immediately after serialization.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;OptionalField –&lt;/b&gt; attribute &lt;b&gt;prevents deserialization from throwing an exception&lt;/b&gt; if the member is not present while still serializing the member.&lt;b&gt;&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;You are adding a new member to class that is already in use. You want to provide backward compatibility with serialized data that was created before the member was added. Which attribute would you add to the new member so that it would be serialized in the future, but &lt;b&gt;deserialization would not throw an exception&lt;/b&gt; if the member class was not present in the serialized data? &lt;b&gt;OptionalField&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;ISerializable &amp;amp; IDeserializationCallback are interfaces that you can implement when you need to control the serialization process&lt;/li&gt;        &lt;li&gt;NonSerialized attribute would prevent the runtime from throwing an exception if the member was not present, however, it Also prevents the member from being serialized.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;BinaryFormatter –&lt;/b&gt; Only the BinaryFormatter class &lt;b&gt;supports serialization events&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;When creating a class that responds to serialization events &lt;b&gt;BinaryFormatter&lt;/b&gt; &lt;b&gt;class&lt;/b&gt; will &lt;b&gt;trigger&lt;/b&gt; the &lt;b&gt;serialization events&lt;/b&gt;.&lt;/li&gt;        &lt;li&gt;The SoapFormatter class does not support serialization events&lt;/li&gt;        &lt;li&gt;XMLSerializer does not support serialization events&lt;/li&gt;        &lt;li&gt;IFormatter is an interface &amp;amp; cannot be directly used to perform serialization. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;During &lt;b&gt;Deserialization&lt;/b&gt;, &lt;b&gt;track&lt;/b&gt; which &lt;b&gt;objects&lt;/b&gt; have been &lt;b&gt;deserialized&lt;/b&gt; &amp;amp; which are pending. This is a &lt;b&gt;task&lt;/b&gt; performed by the &lt;b&gt;ObjectManager class&lt;/b&gt; as part of serialization.       &lt;ul&gt;       &lt;li&gt;The &lt;b&gt;ObjectManager class&lt;/b&gt; keeps &lt;b&gt;track of objects &lt;/b&gt;as they are &lt;b&gt;deserialized.&lt;/b&gt;&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Classes that interact with the file system&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;StreamReader&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;FileStream&lt;/b&gt;          &lt;ul&gt;           &lt;li&gt;You can directly interact with the &lt;b&gt;file system&lt;/b&gt; by using &lt;b&gt;FileStream or StreamReader&lt;/b&gt;&lt;/li&gt;            &lt;li&gt;MemoryStream &amp;amp; StringReader both interact w/ Memory not the file system. SslStream interacts with a remote host&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;When you need to &lt;b&gt;create a text file&lt;/b&gt; using the static &lt;b&gt;FileCreateText.method&lt;/b&gt; the following values are acceptable &lt;b&gt;parameters:&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;C:\text.txt&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;a href="file:///\\server\text.txt"&gt;\\server\text.txt&lt;/a&gt;&lt;/b&gt;          &lt;ul&gt;           &lt;li&gt;File.CreateText &lt;b&gt;can accept local file paths&lt;/b&gt; or universal naming convention (&lt;b&gt;UNC) paths&lt;/b&gt;&lt;/li&gt;            &lt;li&gt;File.CreateText &lt;b&gt;cannot accept URL’s&lt;/b&gt;&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;You have written an app that &lt;b&gt;stores compressed data&lt;/b&gt; using the &lt;b&gt;DeflateStream class.&lt;/b&gt; The following methods you can use to &lt;b&gt;open the compressed file&lt;/b&gt;:      &lt;ul&gt;       &lt;li&gt;Read the file from a .NET app using the &lt;b&gt;DeflateStream class&lt;/b&gt;          &lt;ul&gt;           &lt;li&gt;&lt;b&gt;DeflateStream&lt;/b&gt; does not use the commonly used zip format nor is it natively supported by Windows Explorer. Therefore, &lt;b&gt;only other .NET applications can read the compressed data&lt;/b&gt;&lt;/li&gt;            &lt;li&gt;WinZip cannot open the compressed with DeflateStream&lt;/li&gt;            &lt;li&gt;Compressed Folders cannot open files compressed with DeflateStream&lt;/li&gt;            &lt;li&gt;Notepad cannot open files compressed with DeflateStream&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;You are writing a class that implements the &lt;b&gt;ISerializable interface&lt;/b&gt;. Which of the following are requirements for a method that responds to the &lt;b&gt;Deserialized event&lt;/b&gt;?      &lt;ul&gt;       &lt;li&gt;Accepts a &lt;b&gt;StreamingContext object as a parameter&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Returns a void&lt;/b&gt;          &lt;ul&gt;           &lt;li&gt;&lt;b&gt;Methods that respond to serialization events must accept a Streaming Context object as a parameter &amp;amp; return void. &lt;/b&gt;&lt;/li&gt;            &lt;li&gt;A method cannot respond to a serialization event if it accepts zero parameters. It must accept a StreamingContext object&lt;/li&gt;            &lt;li&gt;Methods that respond to serialization events cannot return a StreamingContext object. They must return void.&lt;/li&gt;            &lt;li&gt;A method cannot respond to a serialization event if it accepts a SerializationInfo object. It must accept a SerializationInfo Object. It must accept a StreamingContext object&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;You would use the System.IO.&lt;b&gt;Path &lt;/b&gt;to test the past users provide when writing an app that will run on a computer that acts as &lt;b&gt;kiosk&lt;/b&gt;. Users should be able to &lt;b&gt;save files to the local disk&lt;/b&gt;, but users should only be able to specify a relative path to their files, you don’t want users to be able to specify an &lt;b&gt;absolute path&lt;/b&gt;. You can test a path to determine weather it is absolute or relative by calling the Path.IsPathRooted method      &lt;ul&gt;       &lt;li&gt;System.IO.Directory contains static methods for processing directories, but it does not enable you to test whether a pst is absolute.&lt;/li&gt;        &lt;li&gt;System.IO.DirectoryInfo provides directory management capabilities, but it does not enable you to test whether a past is absolute.&lt;/li&gt;        &lt;li&gt;SystemIO.DriveInfo enables you to examine the properties of a drive, &amp;amp; does not enable you to test whether a path is absolute. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Serializing&lt;/b&gt; – you are creating a class that implements the ISerializable interface. &lt;b&gt;Serializing&lt;/b&gt; is the serialization event should you respond to if you need to run code &lt;b&gt;prior to serialization.&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;Serializing event occurs prior to serialization &lt;/li&gt;        &lt;li&gt;Serialized event occurs immediaFtely after serialization&lt;/li&gt;        &lt;li&gt;Deserializing event occurs prior to deserialization&lt;/li&gt;        &lt;li&gt;Deserialized event occurs immediately after serialization.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;You need to define a value that is not available in the serialized data&lt;/b&gt; is a valid reason to Implement the &lt;b&gt;ISerializable&lt;/b&gt; &lt;b&gt;interface&lt;/b&gt; &amp;amp; respond to the &lt;b&gt;Deserialized&lt;/b&gt; &lt;b&gt;event&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;You should respond to the &lt;b&gt;Deserialized event&lt;/b&gt; when you need to d&lt;b&gt;efine a value that was not contained in the serialized data&lt;/b&gt;. Typically, summary values such as totals are not serialized &amp;amp; must be defined by responding to the Deserialized event. &lt;/li&gt;        &lt;li&gt;The Deserialized event occurs after deserialization &amp;amp; cannot be used to read custom formatting in serialized data. &lt;/li&gt;        &lt;li&gt;XML serialization does not support serialization events.&lt;/li&gt;        &lt;li&gt;To define a value prior to serialization, you should repond to the Serializing event, not the Deserialized event. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Deserialized&lt;/b&gt; –is the serialization event you should respond to if you need to initialize a variable &lt;b&gt;after deserialization occurs&lt;/b&gt; when you are creating a class that implements the ISerializable interface.      &lt;ul&gt;       &lt;li&gt;Deserialized event occurs immediately after serialization&lt;/li&gt;        &lt;li&gt;Serializing event occrs prioer to serialization&lt;/li&gt;        &lt;li&gt;Serialized event occurs immediately after serialization&lt;/li&gt;        &lt;li&gt;Deserializing event occurs prior to deserialization &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Xsd.exe –&lt;/b&gt; is a tool you would use to create a class that, when serialiezed using XMlSerializer, would conform to a specific schema.      &lt;ul&gt;       &lt;li&gt;If you have an XML Schema you can run the XML Schema Definition tool (Xsd.exe) to produce a set of classes that are strongly typed to the schema &amp;amp; annotated with attributes.         &lt;ul&gt;           &lt;li&gt;XmlSerializer.exe, Schema.exe &amp;amp; Xml.exe are&lt;b&gt; not .&lt;/b&gt;NET Framework tools.&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Deserializing&lt;/b&gt; – is the serialization event you should respond to if you need to initialize a variable &lt;b&gt;before deserialization&lt;/b&gt; occurs when creating a class that implements the ISerializable interface.       &lt;ul&gt;       &lt;li&gt;&lt;b&gt;Deserializing&lt;/b&gt; event occurs &lt;b&gt;prior&lt;/b&gt; to deserialization&lt;/li&gt;        &lt;li&gt;Serializing event occurs prior to serialization&lt;/li&gt;        &lt;li&gt;Serialized event occurs immediately after serialization&lt;/li&gt;        &lt;li&gt;Deserialized event occurs immediately after serialization&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;The following are &lt;b&gt;requirements&lt;/b&gt; for implementing &lt;b&gt;custom serialization &lt;/b&gt;using the &lt;b&gt;ISerializable interface:&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;Override the GetObjectData method&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Implement a constructor that accepts SerializationInfo &amp;amp; StreamingContext object as parameter&lt;/b&gt;s.          &lt;ul&gt;           &lt;li&gt;To implement ISerializable, you must override the GetObjectData method &amp;amp; create a constructor that accepts SerializationInfo &amp;amp; StreamingContext objects as parameters. &lt;/li&gt;            &lt;li&gt;You can respond to the Serializing &amp;amp; Deserializing events, but it is not a requirement&lt;/li&gt;            &lt;li&gt;You can respond to the Serialized &amp;amp; Deserialized events, but it is not a requirement&lt;/li&gt;            &lt;li&gt;You must override the OnDeserialization method when you implement the IDeserializationCallback interface. It is not a member of the ISerializable interface.&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;IFormatter&lt;/b&gt; – interface you should implement when you are writing an application that uses serialization &amp;amp; you need &lt;b&gt;complete control over how the serialized data is formatted&lt;/b&gt;.       &lt;ul&gt;       &lt;li&gt;You should implement the &lt;b&gt;IFormatter interface&lt;/b&gt;, which is the same interface that BinaryFormatter &amp;amp; SoapFormatter implement.           &lt;ul&gt;           &lt;li&gt;IFormatterConverter includes methods for converting values between core types, such as converting a Decimal to a Double or a signed integer to an unsigned integer. You typically do not need to implement the IFormatterConverter interface when using serialization.&lt;/li&gt;            &lt;li&gt;You should implement ISerializable when you need to control the serialization process, but not when you need to control the formatting of the actual serialized data&lt;/li&gt;            &lt;li&gt;You should implement IDeserializationCallback when you need to calculate the value of a member after deserialization. You cannot control formatting with IDeserializationCallback.&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;XmlSerializer&lt;/b&gt; – is the most efficient way to &lt;b&gt;write an object to an XML doc&lt;/b&gt;ument. &lt;b&gt;ex. &lt;/b&gt;You are responsible for an internal database application. Your organization would now like to selectively send information from the database to external customers using XML documents. Currently you have custom classes that stroe this information. &lt;b&gt;XmlSerializer&lt;/b&gt; is the class you should use to write the XML docs.       &lt;ul&gt;       &lt;li&gt;BinaryFormatter would write the object to disk, but it would not use XML&lt;/li&gt;        &lt;li&gt;TextWriter &amp;amp; StreamWriter could be used to create XML docs, but it would be very inefficient because you would have to create the XML formatting manually.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;StreamingContext&lt;/b&gt; is the type of object you would use during custom serialization to determine how the serialized data will be transferred &amp;amp; used. The StreamingContext structure describes the source &amp;amp; destination of a given serialized stream &amp;amp; provides an additional caller defined context. However, the method performing the serialization must define the StreamingContext structure it does not happen automatically.      &lt;ul&gt;       &lt;li&gt;The SerializationEntry structure holds the value type &amp;amp; name of a serialized object. It does not describe the context of serialization&lt;/li&gt;        &lt;li&gt;SerializationInfo class stores all the data needed to serialize or deserialized an object. It does contain a StreamingContext structure as a member, but you would need to directly access the StreamingContext object to determine how serialization data will be transferred. &lt;/li&gt;        &lt;li&gt;ObjectManager class keeps track of objects as they are deserialized &amp;amp; does not describe the serialization context. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Storeadm&lt;/b&gt; – is a command that you would use to &lt;b&gt;view isolated storage stores&lt;/b&gt;.       &lt;ul&gt;       &lt;li&gt;Storeadm tool is a command line tool for listing &amp;amp; deleting isolated storage stores. Use the command storeadm / list to view stores &amp;amp; storeadm / remove to delete stores.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;NonSerialized attribute&lt;/b&gt; you would add to a member class to &lt;b&gt;prevent&lt;/b&gt; if from being serialized.      &lt;ul&gt;       &lt;li&gt;NonSerialized attribute prevents a member from being serialized.&lt;/li&gt;        &lt;li&gt;Iserializable &amp;amp; IDeserializationCallback are interfaces that you can implement when you need to control the serialization process.&lt;/li&gt;        &lt;li&gt;OptionalField does not affect the serialzation of a member. OptionalField affects only deserialization by preventing the runtime from throwing an exception if the member is not present in serialized data.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;IDeserializationCallback&lt;/b&gt; is the interface you would use to most &lt;b&gt;efficiently&lt;/b&gt; automatically &lt;b&gt;initialize&lt;/b&gt; a nonserialized member when Deserializing data.      &lt;ul&gt;       &lt;li&gt;The simplest way to initialize nonserialized members is to implement the IDeserialiationCallback interface &amp;amp; override the OnDeserialization method&lt;/li&gt;        &lt;li&gt;The IFormatter interface provides functionality for formatting serialized objects, but it is not the most efficient way to initialize nonserialized members&lt;/li&gt;        &lt;li&gt;The ISerializable interface allows an object to control its own serialization &amp;amp; deserialization, however, it is not the most efficient way to initialize nonserialized members. &lt;/li&gt;        &lt;li&gt;IFormatterConverter interface provides the connection between an instance of SerializationInfo &amp;amp; the formatter-provided class best suited to parse the data inside SerializationInfo. It cannot be used to initialize nonserialized members.&lt;/li&gt;        &lt;li&gt;4GB is the maximum file size you can compress by using the DeflateStream class&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Byte array&lt;/b&gt; – &lt;b&gt;FileStream.Write&lt;/b&gt; only supports &lt;b&gt;byte arrays&lt;/b&gt;. To write other types, create a Writer class based on the FileStream object such as StreamWriter, BinaryWriter or TextWriter. data &lt;/li&gt;    &lt;li&gt;You can create a custom class when you need to implement a &lt;b&gt;custom compression&lt;/b&gt; algorithm in a custom class by the following:      &lt;ul&gt;       &lt;li&gt;Derive from GZipStream&lt;/li&gt;        &lt;li&gt;Derive from DeflateStream         &lt;ul&gt;           &lt;li&gt;You can &lt;b&gt;derive from GZipStream or DeflateStream&lt;/b&gt;, GZipStream is base on the GZip algorithm, whi8le DeflateStream is base on the Deflate algorithm, Alternatively, you could create an entirely unique compression algorithm by implementing the Stream interface. &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;BinaryFormatter&lt;/b&gt; – &lt;b&gt;class&lt;/b&gt; you should use when &lt;b&gt;serializaiing data&lt;/b&gt; to be consumed only by .NET Apps      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;BinaryFormatter&lt;/b&gt; provides the best &lt;b&gt;efficiency&lt;/b&gt; when only .NET apps will consume the &lt;b&gt;serialized&lt;/b&gt; &lt;b&gt;data&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;SoapFormatter provides standards-based serialization, but it is not as efficient as BinaryFormatter.         &lt;ul&gt;           &lt;li&gt;ISerializable is an interface you can use to implement custom serialization. You cannot use it directly to perform serialization.&lt;/li&gt;            &lt;li&gt;XmlSerializer provides standards based serialization, but it si not as efficient as BinaryFormatter.&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;ol&gt;   &lt;li&gt;You are working with your IT department to deploy an application that you wrote. The IT department asks if your application needs access to any folders on the local hard disk. Your application only uses &lt;b&gt;isolated storage&lt;/b&gt;. Your application will be deployed only to Microsoft &lt;b&gt;new&lt;/b&gt; computers running Windows &lt;b&gt;XP&lt;/b&gt;. Your IT department does not use roaming profiles. To which folder does your application require access?      &lt;ul&gt;       &lt;li&gt;&lt;b&gt;Answer&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&amp;lt;systemdrive&lt;b&gt;&amp;gt;\Documents and Settings\&lt;/b&gt;&amp;lt;user&amp;gt;&lt;b&gt;\ Local Settings\Application Data&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 2 Lesson 4&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;On Windows XP computers that were not upgraded and do not use roaming profiles, isolated storage is physically located in the &amp;lt;systemdrive&amp;gt;\Documents and Settings\&amp;lt;user&amp;gt;\ Local Settings\Application Data folder.&lt;/li&gt;        &lt;li&gt;The &amp;lt;systemroot&amp;gt;\Profiles\&amp;lt;user&amp;gt;\Application Data folder is used by Windows 2000, Windows XP, and Windows Server 2003 when upgraded from Windows NT 4.0 in environments that use roaming profiles&lt;/li&gt;        &lt;li&gt;The &amp;lt;systemroot&amp;gt;\Application Data folder is used by Microsoft Windows 98 and Windows ME without user profiles.&lt;/li&gt;        &lt;li&gt;The &amp;lt;systemroot&amp;gt;\Documents and Settings\&amp;lt;user&amp;gt;\Application Data folder is used by Windows XP and Windows Server 2003, when upgraded from Windows 2000 and Windows 98, or when not upgraded in environments that use roaming profiles.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;You are working with your IT department to deploy an application that you wrote. The IT department asks if your application needs access to any folders on the local hard disk. Your application only uses &lt;b&gt;isolated storage&lt;/b&gt;. Your application will be deployed only to Microsoft Windows &lt;b&gt;XP &lt;/b&gt;computers that had been upgraded from &lt;b&gt;Windows 2000&lt;/b&gt;. Your IT department does use roaming profiles. To which folder does your application require access?      &lt;ul&gt;       &lt;li&gt;&amp;lt;systemroot&amp;gt;\&lt;b&gt;Documents and Settings\&lt;/b&gt;&amp;lt;user&amp;gt;&lt;b&gt;\Application Data&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 2 Lesson 4&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;The &amp;lt;systemroot&amp;gt;\Documents and Settings\&amp;lt;user&amp;gt;\Application Data folder is used by Windows XP when upgraded from Windows 2000 in environments that use roaming profiles.&lt;/li&gt;        &lt;li&gt;On Windows XP computers that were not upgraded and do not use roaming profiles, isolated storage is physically located in the &amp;lt;systemdrive&amp;gt;\Documents and Settings\&amp;lt;user&amp;gt;\ Local &lt;/li&gt;        &lt;li&gt;Settings\Application Data folder.&lt;/li&gt;        &lt;li&gt;The &amp;lt;systemroot&amp;gt;\Profiles\&amp;lt;user&amp;gt;\Application Data folder is used by Windows 2000, Windows XP, and Windows Server 2003 when upgraded from Windows NT 4.0 in environments that use roaming profiles.&lt;/li&gt;        &lt;li&gt;The &amp;lt;systemroot&amp;gt;\Application Data folder is used by Microsoft Windows 98 and Windows ME without user profiles.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Which of the following code samples is the most &lt;b&gt;efficient&lt;/b&gt; way to &lt;b&gt;rename&lt;/b&gt; a file from &amp;quot;File1.txt&amp;quot; to &amp;quot;File2.txt&amp;quot;?&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;File.&lt;b&gt;Move&lt;/b&gt;(&amp;quot;File1.txt&amp;quot;, &amp;quot;File2.txt&amp;quot;)&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;ul&gt;     &lt;li&gt;&lt;b&gt;Explanation: Ch2 Lesson 1&lt;/b&gt;&lt;/li&gt;      &lt;li&gt;Use the static System.IO.File.&lt;b&gt;Move method to rename files.&lt;/b&gt;&lt;/li&gt;      &lt;li&gt;There is no File.Rename method. You should use File.Move instead.&lt;/li&gt;      &lt;li&gt;Although copying and then deleting a file does effectively rename the file, it is not the most efficient way to rename a file.&lt;/li&gt;      &lt;li&gt;Use File.Replace to copy a file while overwriting the destination file. File.Replace does not rename files.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Which of the following code samples correctly creates a new file named &amp;quot;Hello.dat&amp;quot; and writes the string &amp;quot;Hello, world!&amp;quot; to it?&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim fs As New FileStream(&amp;quot;Hello.dat&amp;quot;, FileMode.CreateNew)&lt;/p&gt;  &lt;p&gt;Dim bw As New BinaryWriter(fs)&lt;/p&gt;  &lt;p&gt;bw.Write(&amp;quot;Hello, World!&amp;quot;)&lt;/p&gt;  &lt;p&gt;bw.Close()&lt;/p&gt;  &lt;p&gt;fs.Close()&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Ch2 Lesson 2&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To write to a file with BinaryWriter, first create a FileStream object and use that to create the BinaryWriter object. Then call the BinaryWriter.Write method. Finally, close both the BinaryWriter object and the FileStream object.&lt;/p&gt;  &lt;p&gt;You can write directly to a FileStream object; however, the FileStream.Write method does not accept a string parameter.&lt;/p&gt;  &lt;p&gt;You cannot use a BinaryWriter object without creating a FileStream object first.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;Which of the following code samples &lt;b&gt;writes&lt;/b&gt; a &lt;b&gt;string to a text file&lt;/b&gt;? (Choose all that apply.)&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim s As String = &amp;quot;Hello, World!&amp;quot;&lt;/p&gt;  &lt;p&gt;File.&lt;b&gt;WriteAllText&lt;/b&gt;(&amp;quot;Text.txt&amp;quot;, s)&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim s As String = &amp;quot;Hello, World!&amp;quot;&lt;/p&gt;  &lt;p&gt;Dim sw As &lt;b&gt;StreamWriter&lt;/b&gt; = New StreamWriter(&amp;quot;Text.txt&amp;quot;)&lt;/p&gt;  &lt;p&gt;Try&lt;/p&gt;  &lt;p&gt;sw.WriteLine(s)&lt;/p&gt;  &lt;p&gt;Finally&lt;/p&gt;  &lt;p&gt;Sw.Close()&lt;/p&gt;  &lt;p&gt;End Try&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Ch 2 Lesson 1&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To write a string to a file, you can call the static File.&lt;b&gt;WriteAllText&lt;/b&gt; &lt;b&gt;method&lt;/b&gt; or you can create a &lt;b&gt;StreamWriter object.&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The String class does not have a WriteFile method.&lt;/p&gt;  &lt;p&gt;The File class contains only static methods; you cannot create an instance of the File class.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;Which of the following is the most &lt;b&gt;efficient&lt;/b&gt; way to &lt;b&gt;create a name for a new temp file?&lt;/b&gt;      &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Path.&lt;b&gt;GetTempFileName()&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch2 lesson 1&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Path.GetTempFileName()&lt;/b&gt; is the most &lt;b&gt;efficient&lt;/b&gt; way to identify a name for a &lt;b&gt;new temp file.&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;Combining both Path.GetTempPath() and Path.GetTempFileName() is unnecessary because Path.GetTempFileName() already includes the path.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Given the following class, which of the following files represents how an instance of that class would be serialized using the &lt;b&gt;XmlSerializer&lt;/b&gt; &lt;b&gt;class&lt;/b&gt;?&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Public Class ShoppingCartItem&lt;/p&gt;  &lt;p&gt;Public productId As Int32&lt;/p&gt;  &lt;p&gt;Public price As Decimal&lt;/p&gt;  &lt;p&gt;Public quantity As Int32&lt;/p&gt;  &lt;p&gt;Public total As Decimal&lt;/p&gt;  &lt;p&gt;Public Sub New()&lt;/p&gt;  &lt;p&gt;MyBase.New&lt;/p&gt;  &lt;p&gt;End Sub&lt;/p&gt;  &lt;p&gt;End Class&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;CartItem&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;productId&amp;gt;100&amp;lt;/productId&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;price&amp;gt;10.25&amp;lt;/price&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;quantity&amp;gt;2&amp;lt;/quantity&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;/CartItem&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Ch5 Lesson 2&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;· The specified attributes change the root XML element to CartItem from the default ShoppingCartItem, and they cause the total to be ignored during serialization.&lt;/p&gt;  &lt;p&gt;· By default, XmlSerializer serializes all members as elements, not attributes.&lt;/p&gt;  &lt;p&gt;· By default, XmlSerializer serializes all members as elements, not attributes. Additionally, the total member would be left out of serialization.&lt;/p&gt;  &lt;p&gt;· The specified attributes change the root XML element to CartItem from the default ShoppingCartItem.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;Given the following class, which of the following files represents how an instance of that class would be serialized using the XmlSerializer class?&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Public Class ShoppingCartItem&lt;/p&gt;  &lt;p&gt;Public productId As Int32&lt;/p&gt;  &lt;p&gt;Public price As Decimal&lt;/p&gt;  &lt;p&gt;Public quantity As Int32&lt;/p&gt;  &lt;p&gt;Public total As Decimal&lt;/p&gt;  &lt;p&gt;Public Sub New()&lt;/p&gt;  &lt;p&gt;MyBase.New&lt;/p&gt;  &lt;p&gt;End Sub&lt;/p&gt;  &lt;p&gt;End Class&lt;/p&gt;  &lt;p&gt;· Answer: &lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;ShoppingCartItem&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;productId&amp;gt;100&amp;lt;/productId&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;price&amp;gt;10.25&amp;lt;/price&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;quantity&amp;gt;2&amp;lt;/quantity&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;total&amp;gt;20.50&amp;lt;/total&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;/ShoppingCartItem&amp;gt;&lt;/p&gt;  &lt;p&gt;· &lt;b&gt;Explaination: Ch 5 Lesson 2 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;· By default, XmlSerializer serializes all members as XML elements.&lt;/p&gt;  &lt;p&gt;· XmlSerializer serializes members as attributes only if each member has the XmlAttribute attribute.&lt;/p&gt;  &lt;p&gt;· XmlSerializer would ignore the total member only if it had the XmlIgnore attribute.&lt;/p&gt;  &lt;p&gt;· XmlSerializer creates an element for the class and makes each member a subelement within the class element.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;You are developing version 2.0 of your application. One of the changes you are making is to &lt;b&gt;change the file extension&lt;/b&gt; of a &lt;b&gt;configuration settings file&lt;/b&gt; from .txt to .dat. The contents of the file do not need to change--just the file extension itself. In the following code samples, the current path and filename are stored in the String named &amp;quot;sn&amp;quot;. Which of the following is the most reliable way to change the file extension?&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;File.&lt;b&gt;Move&lt;/b&gt;(sn, Path.&lt;b&gt;ChangeExtension&lt;/b&gt;(sn, &amp;quot;dat&amp;quot;))&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Ch2 Lesson 1 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Combining the static File.Move method with the static Path.ChangeExtension method is the most efficient and reliable way to change the extension of a file.&lt;/p&gt;  &lt;p&gt;Path.ChangeExtension does not directly make changes to the file system.&lt;/p&gt;  &lt;p&gt;Providing a wildcard to the File.Move method results in an exception because the destination path includes an illegal character.&lt;/p&gt;  &lt;p&gt;Using String.Replace to change the extension would work in most circumstances. However, if the filename included another occurrence of &amp;quot;txt&amp;quot; (for example, if the file were named &amp;quot;mytxt.txt&amp;quot;), both occurrences of &amp;quot;txt&amp;quot; would be changed.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;You are creating a class that implements the &lt;b&gt;ISerializable interface to perform custom serialization&lt;/b&gt;. Which of the following code samples correctly overrides the &lt;b&gt;GetObjectData method&lt;/b&gt; and &lt;b&gt;serializes&lt;/b&gt; the firstName, lastName, and age &lt;b&gt;values&lt;/b&gt;?&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Public Overridable Sub GetObjectData&lt;b&gt;(ByVal info As SerializationInfo, ByVal context As StreamingContext) &lt;/b&gt;Implements System.Runtime.Serialization.ISerializable.GetObjectData&lt;/p&gt;  &lt;p&gt;&lt;b&gt;info&lt;/b&gt;.AddValue(&amp;quot;First Name&amp;quot;, firstName)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;info&lt;/b&gt;.AddValue(&amp;quot;Last Name&amp;quot;, lastName)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;info&lt;/b&gt;.AddValue(&amp;quot;Age&amp;quot;, age)&lt;/p&gt;  &lt;p&gt;End Sub&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Ch 5 lesson 3&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Methods that override GetObjectData must accept a SerializationInfo object and a SerializationContext structure as parameters. To add values to be serialized, call the SerializationInfo.AddValue method.&lt;/p&gt;  &lt;p&gt;You cannot add data to be serialized to a StreamingContext object.&lt;/p&gt;  &lt;p&gt;You cannot add data to be serialized to a SerializationInfo member. Additionally, the GetObjectData method must accept a SerializationInfo object and a SerializationContext structure as parameters.&lt;/p&gt;  &lt;p&gt;The GetObjectData method must accept a SerializationInfo object and a SerializationContext structure as parameters.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;You need to &lt;b&gt;create a directory&lt;/b&gt; if it does not yet exist. Of the following code samples, which most efficiently creates a directory &lt;b&gt;without throwing an exception&lt;/b&gt; if it already exists? If more than one code sample would work correctly, choose the sample that performs the desired task with the fewest lines of code.      &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Directory.CreateDirectory(&amp;quot;C:\dir\&amp;quot;)&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 2 Lesson 1&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;All of these code samples creates a directory without causing the runtime to throw an exception if the directory already exists. The &lt;b&gt;most&lt;/b&gt; &lt;b&gt;efficient &lt;/b&gt;technique is to&lt;b&gt; call the static Directory.CreateDirectory&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;Calling DirectoryInfo.Create does create a directory without causing the runtime to throw an exception if the directory already exists. However, the most efficient technique is to call the static Directory.CreateDirectory method.&lt;/li&gt;        &lt;li&gt;It is unnecessary to test whether a directory already exists before creating it.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Which of the following code samples does not result in an exception being thrown if the directory &amp;quot;C:\Dir\&amp;quot; does not exist? (Choose all that apply.)&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim d As String = &amp;quot;C:\dir\&amp;quot;&lt;/p&gt;  &lt;p&gt;Dim &lt;b&gt;di&lt;/b&gt; As DirectoryInfo = New DirectoryInfo(d)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;If&lt;/b&gt; &lt;b&gt;di.Exists&lt;/b&gt; Then&lt;/p&gt;  &lt;p&gt;Dim sw As StreamWriter = New StreamWriter(d + &amp;quot;Text.txt&amp;quot;)&lt;/p&gt;  &lt;p&gt;sw.WriteLine(&amp;quot;Hello, World!&amp;quot;)&lt;/p&gt;  &lt;p&gt;End If&lt;/p&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim d As String = &amp;quot;C:\dir\&amp;quot;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;If&lt;/b&gt; &lt;b&gt;Directory.Exists(d)&lt;/b&gt; Then&lt;/p&gt;  &lt;p&gt;Dim sw As StreamWriter = New StreamWriter(d + &amp;quot;Text.txt&amp;quot;)&lt;/p&gt;  &lt;p&gt;sw.WriteLine(&amp;quot;Hello, World!&amp;quot;)&lt;/p&gt;  &lt;p&gt;End If&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Ch 2 Lesson 1&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To check whether a directory exists, you can call the static &lt;b&gt;Directory.Exists method&lt;/b&gt;, or you can create a &lt;b&gt;DirectoryInfo object&lt;/b&gt; and call DirectoryInfo.Exists.&lt;/p&gt;  &lt;p&gt;The StreamWriter constructor cannot automatically create a directory if the specified directory does not exist. Therefore, the runtime throws an exception.&lt;/p&gt;  &lt;p&gt;This code sample tests attempts to create a file only if the directory does not exist. Therefore, it will always throw an exception.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;Which of the following code samples correctly deserializes the current date and time from an XML file?     &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Dim fs As FileStream = New FileStream(&amp;quot;SerializedDate.XML&amp;quot;, FileMode.Open)&lt;/li&gt;        &lt;li&gt;Dim xs As XmlSerializer = New XmlSerializer(GetType(DateTime))&lt;/li&gt;        &lt;li&gt;Dim t As DateTime = CType(xs.Deserialize(fs),DateTime)&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 5 Lesson 2&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;To deserialize an object, first create a Stream, TextReader, or XmlReader object to read the serialized input. Then create an XmlSerializer object (in the System.Xml.Serialization namespace) by passing it the type of object you plan to deserialize. Finally, call the XmlSerializer.Deserialize method to deserialize the object, and cast it to the correct type.&lt;/li&gt;        &lt;li&gt;No overload for the XmlSerializer constructor takes zero parameters.&lt;/li&gt;        &lt;li&gt;There is no static XmlSerializer.Read method.&lt;/li&gt;        &lt;li&gt;The XmlSerializer constructor requires a Type object and cannot accept a FileStream object.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;How would you rewrite the following piece of code to store the information in isolated storage, isolated by user, domain, and assembly? Assume all code samples use the System.IO and System.IO.IsolatedStorage namespaces.     &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Dim sw As StreamWriter = File.CreateText(&amp;quot;mytemp.txt&amp;quot;)&lt;/li&gt;        &lt;li&gt;sw.WriteLine(&amp;quot;Hello, world!&amp;quot;)&lt;/li&gt;        &lt;li&gt;sw.Close()&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 2 Lesson 4&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;The easiest way to rewrite code that uses StreamWriter objects to use isolated storage is to use the overloaded StreamWriter constructor that accepts an IsolatedStorageFileSystem object.&lt;/li&gt;        &lt;li&gt;IsolatedStorageFileSystem does not have a WriteLine method.&lt;/li&gt;        &lt;li&gt;You cannot pass an IsolatedStorage object to the StreamWriter constructor.&lt;/li&gt;        &lt;li&gt;The File class does not have a static CreateIsolatedStorageText method.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;You need to verify that the C:\ drive is a fixed drive and throw an exception if it is not. Which of the following code samples accomplishes this in the most efficient manner?     &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Dim di As DriveInfo = New DriveInfo(&amp;quot;C&amp;quot;)&lt;/li&gt;        &lt;li&gt;If Not (di.DriveType = DriveType.Fixed) Then&lt;/li&gt;        &lt;li&gt;Throw New Exception(&amp;quot;The C:\ drive must be fixed&amp;quot;)&lt;/li&gt;        &lt;li&gt;End If&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 2 Lesson 1&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;To determine if a drive is fixed, create an instance of the DriveInfo class and then check DriveInfo.DriveType.&lt;/li&gt;        &lt;li&gt;DriveInfo does not have a static GetDriveType method.&lt;/li&gt;        &lt;li&gt;The DriveInfo.GetDrives static method does not accept a drive letter as a parameter.&lt;/li&gt;        &lt;li&gt;The DriveInfo.GetDrives static method returns a standard, integer-indexed array of DriveInfo objects. The array cannot be accessed with the drive letter.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;You are writing a security tool that aggregates firewall logs from client computers in your organization. IT will distribute your application to the approximately 2,000 client computers. Then the client portion of the application will run nightly to &lt;b&gt;compress&lt;/b&gt; the %windir%\pfirewall.log &lt;b&gt;file&lt;/b&gt; and &lt;b&gt;copy&lt;/b&gt; it to a &lt;b&gt;shared&lt;/b&gt; folder. After the file has been stored on the server, a separate server application will decompress and process the log files. Which of the following code samples correctly &lt;b&gt;compresses and stores the logfile&lt;/b&gt;?      &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Dim readpath As String = Path.Combine(System.Environment.GetEnvironmentVariable(&amp;quot;windir&amp;quot;), &amp;quot;pfirewall.log&amp;quot;)&lt;/li&gt;        &lt;li&gt;Dim writepath As String = &amp;quot;\\server\folder&amp;quot;&lt;/li&gt;        &lt;li&gt;Dim reader As FileStream = New FileStream(readpath, FileMode.Open)&lt;/li&gt;        &lt;li&gt;Dim &lt;b&gt;writer&lt;/b&gt; As FileStream = New FileStream(writepath, FileMode.Create)&lt;/li&gt;        &lt;li&gt;Dim compress As DeflateStream = New DeflateStream(writer, CompressionMode.Compress)&lt;/li&gt;        &lt;li&gt;Dim &lt;b&gt;b(reader.Length)&lt;/b&gt; As Byte&lt;/li&gt;        &lt;li&gt;reader.Read(b, 0, CType(reader.Length, Integer))&lt;/li&gt;        &lt;li&gt;reader.Close&lt;/li&gt;        &lt;li&gt;&lt;b&gt;compress.Write(b, 0, CType(b.Length, Integer))&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;compress.Close&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch2 lesson 3&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;To accomplish this task, you must create streams for both reading and writing the file. Then, based on the stream for writing the file, you can create a DeflateStream instance. Because DeflateStream requires a byte array, you must first read the contents of the file to be compressed into the byte array.&lt;/li&gt;        &lt;li&gt;The FileStream class does not have a ReadToEnd method. Additionally, the DeflateStream.Write() method can only accept a byte array. Finally, you cannot provide a file path to the DeflateStream constructor. You must first construct a stream object.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Which of the following code samples correctly serializes the current date and time to an XML file?     &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Dim fs As FileStream = New FileStream(&amp;quot;SerializedDate.XML&amp;quot;, FileMode.Create)&lt;/li&gt;        &lt;li&gt;Dim xs As XmlSerializer = New XmlSerializer(GetType(DateTime)&lt;/li&gt;        &lt;li&gt;xs.Serialize(fs, System.DateTime.Now)&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 5 Lesson 2&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;To perform XML serialization, first create a FileStream, TextWriter, or XmlWriter object to hold the serialized output. Then create an XmlSerializer object (in the System.Xml.Serialization namespace) by passing it the type of object you plan to serialize. Finally, call the XmlSerializer.Serialize method to serialize the object and output the results to the stream.&lt;/li&gt;        &lt;li&gt;No overload for the XmlSerializer constructor takes zero parameters.&lt;/li&gt;        &lt;li&gt;You can only pass an array of bytes to the FileStream.Write method.&lt;/li&gt;        &lt;li&gt;You cannot declare a filename in the XmlSerializer constructor--you must always pass a Type object.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;You are writing an assembly that analyzes all files ending in a .txt or .dat extension in a specific folder. Which of the following code samples stores an array of all files with a .txt or a .dat extension contained in the C:\Windows folder in the allFiles array?     &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Dim directoryInfo As DirectoryInfo = New DirectoryInfo(&amp;quot;c:\windows&amp;quot;)&lt;/li&gt;        &lt;li&gt;Dim txtFiles As FileInfo() = directoryInfo.GetFiles(&amp;quot;*.txt&amp;quot;)&lt;/li&gt;        &lt;li&gt;Dim datFiles As FileInfo() = directoryInfo.GetFiles(&amp;quot;*.dat&amp;quot;)&lt;/li&gt;        &lt;li&gt;Dim allFiles(txtFiles.Length + datFiles.Length - 1) As FileInfo&lt;/li&gt;        &lt;li&gt;Array.Copy(datFiles, 0, allFiles, 0, datFiles.Length)&lt;/li&gt;        &lt;li&gt;Array.Copy(txtFiles, 0, allFiles, datFiles.Length, txtFiles.Length)&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 2 Lesson 1&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;DirectoryInfo.GetFiles can perform only one search at a time. Therefore, you would need to perform multiple searches and add the arrays using Array.Copy.&lt;/li&gt;        &lt;li&gt;You cannot add arrays using the + operator.&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Which of the following code samples does not result in an exception being thrown if &amp;quot;text.txt&amp;quot; does not exist? (Choose all that apply.)     &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Dim fn As String = &amp;quot;Text.txt&amp;quot;&lt;/li&gt;        &lt;li&gt;If File.Exists(fn) Then&lt;/li&gt;        &lt;li&gt;Dim sr As StreamReader = New StreamReader(fn)&lt;/li&gt;        &lt;li&gt;Console.WriteLine(sr.ReadToEnd)&lt;/li&gt;        &lt;li&gt;End If&lt;/li&gt;        &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;Dim fn As String = &amp;quot;Text.txt&amp;quot;&lt;/li&gt;        &lt;li&gt;Dim fi As FileInfo = New FileInfo(fn)&lt;/li&gt;        &lt;li&gt;If fi.Exists Then&lt;/li&gt;        &lt;li&gt;Dim sr As StreamReader = New StreamReader(fn)&lt;/li&gt;        &lt;li&gt;Console.WriteLine(sr.ReadToEnd)&lt;/li&gt;        &lt;li&gt;End If&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch 2 Lesson 1&lt;/b&gt;          &lt;ul&gt;           &lt;li&gt;To check whether a file exists, you can call the static File.Exists method, or you can create a FileInfo object and call FileInfo.Exists.&lt;/li&gt;            &lt;li&gt;The StreamReader constructor cannot take an instance of the class FileInfo.&lt;/li&gt;            &lt;li&gt;FileInfo.Exists is not a static method. You must first create an instance of FileInfo to call this method.&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Given the following class, which of the following files represents how an instance of that class would be serialized using the XmlSerializer class?     &lt;ul&gt;       &lt;li&gt;' VB&lt;/li&gt;        &lt;li&gt;&amp;lt;XmlRoot(&amp;quot;CartItem&amp;quot;)&amp;gt; Public Class ShoppingCartItem&lt;/li&gt;        &lt;li&gt;Public productId As Int32&lt;/li&gt;        &lt;li&gt;Public price As Decimal&lt;/li&gt;        &lt;li&gt;Public quantity As Int32&lt;/li&gt;        &lt;li&gt;&lt;/li&gt;        &lt;li&gt;&amp;lt;XmlIgnore()&amp;gt; Public total As Decimal&lt;/li&gt;        &lt;li&gt;&lt;/li&gt;        &lt;li&gt;Public Sub New()&lt;/li&gt;        &lt;li&gt;MyBase.New&lt;/li&gt;        &lt;li&gt;End Sub&lt;/li&gt;        &lt;li&gt;End Class&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Answer&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;/li&gt;        &lt;li&gt;&amp;lt;CartItem&amp;gt;&lt;/li&gt;        &lt;li&gt;&amp;lt;productId&amp;gt;100&amp;lt;/productId&amp;gt; &lt;/li&gt;        &lt;li&gt;&amp;lt;price&amp;gt;10.25&amp;lt;/price&amp;gt; &lt;/li&gt;        &lt;li&gt;&amp;lt;quantity&amp;gt;2&amp;lt;/quantity&amp;gt; &lt;/li&gt;        &lt;li&gt;&amp;lt;/CartItem&amp;gt;&lt;/li&gt;        &lt;li&gt;&lt;b&gt;Explanation: Ch5 lesson 2&lt;/b&gt;          &lt;ul&gt;           &lt;li&gt;The specified attributes change the root XML element to CartItem from the default ShoppingCartItem, and they cause the total to be ignored during serialization.&lt;/li&gt;            &lt;li&gt;By default, XmlSerializer serializes all members as elements, not attributes.&lt;/li&gt;            &lt;li&gt;By default, XmlSerializer serializes all members as elements, not attributes. Additionally, the total member would be left out of serialization.&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Given the following class, which of the following files represents how an instance of that class would be serialized using the XmlSerializer class?&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Public Class ShoppingCartItem&lt;/p&gt;  &lt;p&gt;&amp;lt;XmlAttribute()&amp;gt; Public productId As Int32&lt;/p&gt;  &lt;p&gt;Public price As Decimal&lt;/p&gt;  &lt;p&gt;Public quantity As Int32&lt;/p&gt;  &lt;p&gt;Public total As Decimal&lt;/p&gt;  &lt;p&gt;Public Sub New()&lt;/p&gt;  &lt;p&gt;MyBase.New&lt;/p&gt;  &lt;p&gt;End Sub&lt;/p&gt;  &lt;p&gt;End Class&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;ShoppingCartItem productId=&amp;quot;100&amp;quot;&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;price&amp;gt;10.25&amp;lt;/price&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;quantity&amp;gt;2&amp;lt;/quantity&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;total&amp;gt;20.50&amp;lt;/total&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;/ShoppingCartItem&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Ch 5 Lesson 2 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;By default, XmlSerializer serializes all members as XML elements. The productId member has the XmlAttribute attribute, which causes it to be serialized as an attribute.&lt;/p&gt;  &lt;p&gt;XmlSerializer serializes members as attributes only if each member has the XmlAttribute attribute.&lt;/p&gt;  &lt;p&gt;XmlSerializer would ignore the productId member only if it had the XmlIgnore attribute.&lt;/p&gt;  &lt;p&gt;The productId member has the XmlAttribute attribute, which causes it to be serialized as an attribute.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;You are creating a custom class that &lt;b&gt;implements the ISerializable interface&lt;/b&gt;. The following code shows the &lt;b&gt;deserialization constructor&lt;/b&gt; in its current state:&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;' The following constructor is for deserialization&lt;/p&gt;  &lt;p&gt;Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)&lt;/p&gt;  &lt;p&gt;MyBase.New()&lt;/p&gt;  &lt;p&gt;' TODO: Copy deserialized data&lt;/p&gt;  &lt;p&gt;End Sub&lt;/p&gt;  &lt;p&gt;How will you retrieve the deserialized data?&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer &lt;/b&gt;Copy the data from the &lt;b&gt;info.GetValue method.&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Chapter 5 Lesson 3&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Deserialized data is stored in the SerializationInfo object, and it can be retrieved using the GetValue method or one of the other Get methods.&lt;/p&gt;  &lt;p&gt;The StreamingContext object describes the source that provided the serialized data and does not contain the data itself.&lt;/p&gt;  &lt;p&gt;There is no Data collection in either the SerializationInfo or StreamingContext classes.&lt;/p&gt;  &lt;ol start="start"&gt;   &lt;li&gt;You need to &lt;b&gt;write text to a file. &lt;/b&gt;Which of the following demonstrates the most &lt;b&gt;efficient&lt;/b&gt; way to use the &lt;b&gt;TextWriter class&lt;/b&gt;?&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;' VB&lt;/p&gt;  &lt;p&gt;Dim fs As &lt;b&gt;FileStream&lt;/b&gt; = New FileStream(&amp;quot;Hello.dat&amp;quot;, FileMode.Create)&lt;/p&gt;  &lt;p&gt;Dim tw As TextWriter = New StreamWriter(fs)&lt;/p&gt;  &lt;p&gt;tw.Write(&amp;quot;Hello, world!&amp;quot;)&lt;/p&gt;  &lt;p&gt;tw.Close&lt;/p&gt;  &lt;p&gt;fs.Close&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Explanation: Ch 2 Lesson 2&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The TextWriter class does not have a constructor. Instead, you should create it using the StreamWriter constructor. To create a StreamWriter object, you must use an existing Stream object, such as an instance of &lt;b&gt;FileStream&lt;/b&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-3252006210397542936?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-31-implementation.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-4000839296870958555</guid><pubDate>Thu, 27 Aug 2009 02:53:00 +0000</pubDate><atom:updated>2009-08-26T22:53:41.089-04:00</atom:updated><title>70-536 NET Foundations questions #30</title><description>&lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx, &lt;/p&gt;  &lt;p&gt;Catto &lt;/p&gt;  &lt;p&gt;#151 - #166&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 151 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an application that lists &lt;b&gt;processes on remote computers&lt;/b&gt;. The application requires a method that performs the following tasks: Accept the remote computer name as a string parameter named &lt;b&gt;strComputer&lt;/b&gt;. Return an ArrayList object that contains the names of all processes that are running on that computer. You need to write a code segment that &lt;b&gt;retrieves the name of each process that is running on the remote computer&lt;/b&gt; and &lt;b&gt;adds&lt;/b&gt; the &lt;b&gt;name&lt;/b&gt; to the ArrayList object. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim al As New ArrayList()Dim procs As Process() = _    &lt;br /&gt;Process.GetProcessesByName(strComputer)Dim proc As ProcessFor Each proc In procs     &lt;br /&gt;al.Add(proc)Next &lt;/p&gt;  &lt;p&gt;B. Dim al As New ArrayList()Dim procs As Process() = &lt;/p&gt;  &lt;p&gt;Process.GetProcesses(strComputer)   &lt;br /&gt;Dim proc As ProcessFor Each proc In procs     &lt;br /&gt;al.Add(proc)Next &lt;/p&gt;  &lt;p&gt;C. Dim al As New ArrayList()Dim procs As Process() = _    &lt;br /&gt;Process.GetProcessesByName(strComputer)Dim proc As ProcessFor Each proc In procs     &lt;br /&gt;al.Add(proc.ProcessName)Next &lt;/p&gt;  &lt;p&gt;D. Dim al As New ArrayList()Dim procs As Process() =    &lt;br /&gt;Process.&lt;b&gt;GetProcesses&lt;/b&gt;(strComputer)    &lt;br /&gt;Dim proc As ProcessFor Each proc In procs     &lt;br /&gt;al.Add(proc.&lt;b&gt;ProcessName&lt;/b&gt;)Next &lt;/p&gt;  &lt;p&gt;Answer: D    &lt;br /&gt;K8 – Q: Retrieves each process A: GetPRocesses &amp;amp; add proc.ProcessName&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 152 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method that returns &lt;b&gt;an ArrayList named al&lt;/b&gt;. You need to ensure that changes to the ArrayList are performed in a &lt;b&gt;thread-safe manner&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim al As ArrayLis t = New ArrayList()   &lt;br /&gt;SyncLock al.SyncRoot     &lt;br /&gt;Return alEnd SyncLock &lt;/p&gt;  &lt;p&gt;B. Dim al As ArrayList = New ArrayList()   &lt;br /&gt;SyncLock al.SyncRoot.GetType()     &lt;br /&gt;Return alEnd SyncLock &lt;/p&gt;  &lt;p&gt;C. Dim al As ArrayList = New   &lt;br /&gt;ArrayList()Monitor.Enter(al)Monitor.Exit(al)Return al &lt;/p&gt;  &lt;p&gt;D. Dim al As ArrayList = New ArrayList()   &lt;br /&gt;Dim sync_al as ArrayList = &lt;b&gt;ArrayList.Synchronized(al)&lt;/b&gt;    &lt;br /&gt;Return sync_al &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: return ArrayList AL in thread safe mannor A: Synchronized(AL)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 153 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are &lt;b&gt;dev&lt;/b&gt;eloping an &lt;b&gt;app&lt;/b&gt;lication to assist the user in conducting electronic surveys. The survey consists of 25 true-or-false questions. You need to perform the following tasks: Initialize each answer to true.&lt;b&gt;Minimize the amount of memory&lt;/b&gt; used by each survey. Which storage option should you choose? &lt;/p&gt;  &lt;p&gt;A. Dim answers As New BitVector32(1) &lt;/p&gt;  &lt;p&gt;B. &lt;b&gt;Dim answers As New BitVector32(-1) &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;C. Dim answers As New BitArray(1) &lt;/p&gt;  &lt;p&gt;D. Dim answers As New BitArray(-1) &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – BitVector32(-1) Q: minimize memory used the right type needs to be selected. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 154 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a class named Age. You need to ensure that the &lt;b&gt;Age class&lt;/b&gt; is written such that &lt;b&gt;collections of Age objects can be sorted.&lt;/b&gt; Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public ref class Age {    &lt;br /&gt;public : Int32 Value;     &lt;br /&gt;public : virtual Object &lt;b&gt;CompareTo&lt;/b&gt;(Object^ obj) {     &lt;br /&gt;if (obj-&amp;gt;GetType() == Age::GetType()) {     &lt;br /&gt;Age^ _age = (Age^) obj;     &lt;br /&gt;return Value.CompareTo(obj);     &lt;br /&gt;}     &lt;br /&gt;throw gcnew ArgumentException(“object not an Age”);     &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;B. public ref class Age {    &lt;br /&gt;public : Int32 Value;     &lt;br /&gt;public : virtual Object CompareTo(Int32^ iValue) {     &lt;br /&gt;try {     &lt;br /&gt;return Value.CompareTo(iValue);     &lt;br /&gt;} catch (Exception^ ex) {     &lt;br /&gt;throw gcnew ArgumentException(“object not an Age”);     &lt;br /&gt;}     &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;C. public ref class Age : public &lt;b&gt;IComparable&lt;/b&gt; {     &lt;br /&gt;public : Int32 Value;     &lt;br /&gt;public : virtual Int32 &lt;b&gt;CompareTo&lt;/b&gt;(Object^ obj) {     &lt;br /&gt;if (obj-&amp;gt;GetType() == Age::GetType()) {     &lt;br /&gt;Age^ _age = (Age^) obj;     &lt;br /&gt;return Value.CompareTo(_age-&amp;gt;Value);     &lt;br /&gt;}     &lt;br /&gt;throw gcnew ArgumentException(“object not an Age”);     &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;D. public ref class Age : public IComparable {    &lt;br /&gt;public : Int32 Value;     &lt;br /&gt;public : virtual Int32 CompareTo(Object^ obj) {     &lt;br /&gt;try {     &lt;br /&gt;return Value.CompareTo(((Age^) obj)-&amp;gt;Value);     &lt;br /&gt;} catch (Exception^ ex) {     &lt;br /&gt;return -1;     &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;}}; &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Q: Sorting Objects A: IComparable to need to for try/catch&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 155 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a server application that will transmit sensitive information on a network. You create an X509Certificate object named certificate and a TcpClient object named client. You need to create an SslStream to communicate by using the &lt;b&gt;Transport Layer Security 1&lt;/b&gt;.0 protocol. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objSSL As New    &lt;br /&gt;SslStream(client.GetStream)objSSL.AuthenticateAsServer(certificate, False, _     &lt;br /&gt;SslProtocols.None, True) &lt;/p&gt;  &lt;p&gt;B. Dim objSSL As New    &lt;br /&gt;SslStream(client.GetStream)objSSL.AuthenticateAsServer(certificate, False, _     &lt;br /&gt;SslProtocols.Ssl3, True) &lt;/p&gt;  &lt;p&gt;C. Dim objSSL As New    &lt;br /&gt;SslStream(client.GetStream)objSSL.AuthenticateAsServer(certificate, False, _     &lt;br /&gt;SslProtocols.Ssl2, True) &lt;/p&gt;  &lt;p&gt;D. Dim objSSL As New    &lt;br /&gt;SslStream(client.GetStream)objSSL.AuthenticateAsServer(certificate, False, _     &lt;br /&gt;&lt;b&gt;SslProtocols.Tls&lt;/b&gt;, True) &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Transport Layer Security A: SslProtocols.&lt;b&gt;TLS&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 156 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are using the Microsoft Visual Studio 2005 IDE to examine the output of a method that returns a string. You assign the output of the method to a string variable named &lt;b&gt;fName&lt;/b&gt;. You need to write a code segment that prints the following on a single line The message: &amp;quot;Test Failed: &amp;quot; The value of fName if the value of fName does not equal &amp;quot;Company&amp;quot; You also need to ensure that the code segment &lt;b&gt;simultaneously facilitates uninterrupted execution of the application&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Debug.Assert(fName == “Company”, “Test Failed: ”, fName); &lt;/p&gt;  &lt;p&gt;B. Debug.&lt;b&gt;WriteLineIf&lt;/b&gt;(fName != “Company”, fName, “Test Failed”); &lt;/p&gt;  &lt;p&gt;C. if (fName != &amp;quot;Company&amp;quot;) {    &lt;br /&gt;Debug.Print(“Test Failed: ”);     &lt;br /&gt;Debug.Print(fName);     &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;D. if (fName != &amp;quot;Company&amp;quot;) {    &lt;br /&gt;Debug.WriteLine(“Test Failed: ”);     &lt;br /&gt;Debug.WriteLine(fName);     &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - Q: Write a line for a condition A: &lt;b&gt;WriteLineIf&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 157 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a new security policy for an application domain. You write the following lines of code.    &lt;br /&gt;PolicyLevel ^policy = PolicyLevel::CreateAppDomainLevel();     &lt;br /&gt;PolicyStatement ^noTrustStatement =     &lt;br /&gt;gcnew PolicyStatement(     &lt;br /&gt;policy-&amp;gt;GetNamedPermissionSet(“Nothing”));    &lt;br /&gt;PolicyStatement ^fullTrustStatement = gcnew PolicyStatement(     &lt;br /&gt;policy-&amp;gt;GetNamedPermissionSet(“FullTrust”));     &lt;br /&gt;You need to arrange &lt;b&gt;code groups&lt;/b&gt; for the policy so that loaded assemblies default to the &lt;b&gt;Nothing permission&lt;/b&gt; set. If the assembly originates from a &lt;b&gt;trusted zone,&lt;/b&gt; the security policy must grant the assembly the &lt;b&gt;FullTrust&lt;/b&gt; permission set. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. CodeGroup ^group1 = gcnew FirstMatchCodeGroup(    &lt;br /&gt;gcnew ZoneMembershipCondition(SecurityZone::Trusted),     &lt;br /&gt;fullTrustStatement); CodeGroup ^group2 = gcnew UnionCodeGroup(     &lt;br /&gt;gcnew AllMembershipCondition(),     &lt;br /&gt;noTrustStatement); group1-&amp;gt;AddChild(group2); &lt;/p&gt;  &lt;p&gt;B. CodeGroup ^group1 = gcnew FirstMatchCodeGroup(    &lt;br /&gt;gcnew AllMembershipCondition(),     &lt;br /&gt;noTrustStatement);     &lt;br /&gt;CodeGroup ^group2 = gcnew UnionCodeGroup(     &lt;br /&gt;gcnew ZoneMembershipCondition(SecurityZone::Trusted),     &lt;br /&gt;fullTrustStatement);     &lt;br /&gt;group1-&amp;gt;AddChild(group2); &lt;/p&gt;  &lt;p&gt;C. CodeGroup ^group = gcnew UnionCodeGroup(    &lt;br /&gt;gcnew ZoneMembershipCondition(SecurityZone::Trusted),     &lt;br /&gt;fullTrustStatement); &lt;/p&gt;  &lt;p&gt;D. CodeGroup ^group = gcnew FirstMatchCodeGroup(    &lt;br /&gt;gcnew AllMembershipCondition(),     &lt;br /&gt;noTrustStatement); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - Q: 2 Code Group 1&lt;sup&gt;st&lt;/sup&gt; no trust 2&lt;sup&gt;nd&lt;/sup&gt; full trust &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 158 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application that will use &lt;b&gt;custom authentication and role-based security&lt;/b&gt;. You need to write a code segment to make the runtime assign an &lt;b&gt;unauthenticated principal object &lt;/b&gt;to each running &lt;b&gt;thread&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. AppDomain domain = AppDomain.CurrentDomain;   &lt;br /&gt;domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); &lt;/p&gt;  &lt;p&gt;B. AppDomain domain = AppDomain.CurrentDomain;   &lt;br /&gt;domain.SetThreadPrincipal(new WindowsPrincipal(null)); &lt;/p&gt;  &lt;p&gt;C. AppDomain domain = AppDomain.CurrentDomain;    &lt;br /&gt;domain.SetAppDomainPolicy(     &lt;br /&gt;PolicyLevel.CreateAppDomainLevel()); &lt;/p&gt;  &lt;p&gt;D. AppDomain domain = AppDomain.CurrentDomain;   &lt;br /&gt;domain.&lt;b&gt;SetPrincipalPolicy&lt;/b&gt;(     &lt;br /&gt;PrincipalPolicy.UnauthenticatedPrincipal); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Assign unauthenticated Principal Object &lt;/p&gt;  &lt;p&gt;A: SetPrincipalPolicy&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 159 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are testing a method that examines a running process. This method &lt;b&gt;returns an ArrayList&lt;/b&gt; containing the &lt;b&gt;name and full path&lt;/b&gt; of all modules that are loaded by the process. You need to list the modules loaded by a process named C:\TestApps\Process1.exe. &lt;/p&gt;  &lt;p&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim ar As New ArrayList()   &lt;br /&gt;Dim procs As Process()Dim modules As ProcessModuleCollectionprocs = Process.GetProcesses(&amp;quot;Process1&amp;quot;)If procs.Length &amp;gt; 0     &lt;br /&gt;Thenmodules = procs(0).Modules     &lt;br /&gt;For Each pm As ProcessModule In Modules     &lt;br /&gt;ar.Add(pm.&lt;b&gt;ModuleName&lt;/b&gt;)     &lt;br /&gt;NextEnd If &lt;/p&gt;  &lt;p&gt;B. Dim ar As New ArrayList()   &lt;br /&gt;Dim procs As Process()    &lt;br /&gt;Dim modules As ProcessModuleCollectionprocs = Process.GetProcesses(&amp;quot;C:\TestApps\Process1.exe&amp;quot;)If     &lt;br /&gt;procs.Length &amp;gt; 0 Thenmodules = procs(0).Modules     &lt;br /&gt;For Each pm As ProcessModule In Modules     &lt;br /&gt;ar.Add(pm.ModuleName)     &lt;br /&gt;Next End If &lt;/p&gt;  &lt;p&gt;C. Dim ar As New ArrayList()   &lt;br /&gt;Dim procs As Process()    &lt;br /&gt;Dim modules As ProcessModuleCollectionprocs = Process.GetProcesses ByName(&amp;quot;Process1&amp;quot;)If     &lt;br /&gt;procs.Length &amp;gt; 0 Thenmodules = procs(0).Modules     &lt;br /&gt;For Each pm As ProcessModule In Modules     &lt;br /&gt;ar.Add(pm.&lt;b&gt;FileName&lt;/b&gt;)     &lt;br /&gt;Next End If &lt;/p&gt;  &lt;p&gt;D. Dim ar As New ArrayList()Dim procs As Process()Dim modules As    &lt;br /&gt;ProcessModuleCollectionprocs =     &lt;br /&gt;_Process.GetProcessesByName(&amp;quot;C:\TestApps\Process1.exe&amp;quot;)If procs.Length &amp;gt; 0 &lt;/p&gt;  &lt;p&gt;Thenmodules = procs(0).Modules &lt;/p&gt;  &lt;p&gt;For Each pm As ProcessModule In Modules &lt;/p&gt;  &lt;p&gt;ar.Add(pm.FileName) &lt;/p&gt;  &lt;p&gt;Next End If &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 - Q: process1.exe A: pm.filename &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 160 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method that accepts a string parameter named message. Your method &lt;b&gt;must break the message parameter into individual lines of text and pass&lt;/b&gt; each line to a second method named Process. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. StringReader^ reader = gcnew    &lt;br /&gt;StringReader(message);    &lt;br /&gt;Process(reader-&amp;gt;ReadToEnd());    &lt;br /&gt;reader-&amp;gt;Close(); &lt;/p&gt;  &lt;p&gt;B. StringReader^ reader = gcnew StringReader(message);   &lt;br /&gt;while(reader-&amp;gt;Peak() != -1) {     &lt;br /&gt;String^ line = reader-&amp;gt;Read().ToString();     &lt;br /&gt;Process(line);    &lt;br /&gt;}reader-&amp;gt;Close(); &lt;/p&gt;  &lt;p&gt;C. StringReader^ reader = gcnew    &lt;br /&gt;StringReader(message);    &lt;br /&gt;Process(reader-&amp;gt;ToString());    &lt;br /&gt;reader-&amp;gt;Close(); &lt;/p&gt;  &lt;p&gt;D. StringReader^ reader = gcnew StringReader(message);   &lt;br /&gt;while(reader-&amp;gt;Peak() != -1) {     &lt;br /&gt;Process(reader-&amp;gt;&lt;b&gt;ReadLine&lt;/b&gt;());    &lt;br /&gt;}reader-&amp;gt;Close(); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: string broken into lines of text A: Loop w/ While &amp;amp; ReadLine()&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 161 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following custom exception class named CustomException. &lt;/p&gt;  &lt;p&gt;public ref class CustomException : ApplicationException {public:    &lt;br /&gt;literal int COR_E_ARGUMENT = (int)0x80070057; &lt;/p&gt;  &lt;p&gt;CustomException(String^ msg) : ApplicationException(msg)   &lt;br /&gt;{     &lt;br /&gt;HResult = COR_E_ARGUMENT;     &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;You need to write a code segment that will use the &lt;b&gt;CustomException&lt;/b&gt; &lt;i&gt;class&lt;/i&gt; &lt;b&gt;to immediately return control to the COM c&lt;/b&gt;aller. You also need to ensure that the caller has access to the error code. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. return Marshal::GetExceptionForHR(    &lt;br /&gt;CustomException::COR_E_ARGUMENT); &lt;/p&gt;  &lt;p&gt;B. return CustomException::COR_E_ARGUMENT; &lt;/p&gt;  &lt;p&gt;C. Marshal::ThrowExceptionForHR(    &lt;br /&gt;CustomException::COR_E_ARGUMENT); &lt;/p&gt;  &lt;p&gt;D. &lt;b&gt;throw&lt;/b&gt; gcnew &lt;b&gt;CustomException&lt;/b&gt;(“Argument is out of bounds”); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Immediatley return control to COM A: throw an exception &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 162 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to create a &lt;b&gt;dynamic assembly&lt;/b&gt; named &lt;b&gt;MyAssembly&lt;/b&gt;. You also need to &lt;b&gt;save&lt;/b&gt; the assembly to disk. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. AssemblyName^ myAssemblyName = gcnew AssemblyName();   &lt;br /&gt;myAssemblyName-&amp;gt;Name = “MyAssembly”;     &lt;br /&gt;AssemblyBuilder myAssemblyBuilder =     &lt;br /&gt;AppDomain::CurrentDomain-&amp;gt;DefineDynamicAssembly(     &lt;br /&gt;myAssemblyName, AssemblyBuilderAccess::&lt;b&gt;Run&lt;/b&gt;);    &lt;br /&gt;myAssemblyBuilder-&amp;gt;Save(“MyAssembly.dll”); &lt;/p&gt;  &lt;p&gt;B. AssemblyName^ myAssemblyName = gcnew    &lt;br /&gt;&lt;b&gt;AssemblyName();     &lt;br /&gt;&lt;/b&gt;myAssemblyName-&amp;gt;Name = “&lt;b&gt;MyAssembly&lt;/b&gt;”;    &lt;br /&gt;AssemblyBuilder myAssemblyBuilder =     &lt;br /&gt;AppDomain::CurrentDomain-&amp;gt;DefineDynamicAssembly(     &lt;br /&gt;myAssemblyName, AssemblyBuilderAccess::&lt;b&gt;Save&lt;/b&gt;);    &lt;br /&gt;myAssemblyBuilder-&amp;gt;Save(“MyAssembly.dll”); &lt;/p&gt;  &lt;p&gt;C. AssemblyName^ myAssemblyName = gcnew AssemblyName();   &lt;br /&gt;AssemblyBuilder myAssemblyBuilder =     &lt;br /&gt;AppDomain::CurrentDomain-&amp;gt;DefineDynamicAssembly(     &lt;br /&gt;myAssemblyName,     &lt;br /&gt;AssemblyBuilderAccess::&lt;b&gt;RunAndSave&lt;/b&gt;);    &lt;br /&gt;myAssemblyBuilder-&amp;gt;Save(“MyAssembly.dll”); &lt;/p&gt;  &lt;p&gt;D. AssemblyName^ myAssemblyName =    &lt;br /&gt;gcnew AssemblyName(“MyAssembly”);     &lt;br /&gt;AssemblyBuilder^ myAssemblyBuilder =     &lt;br /&gt;AppDomain::CurrentDomain-&amp;gt;DefineDynamicAssembly(     &lt;br /&gt;myAssemblyName, &lt;/p&gt;  &lt;p&gt;AssemblyBuilderAccess::&lt;b&gt;Save&lt;/b&gt;);    &lt;br /&gt;myAssemblyBuilder-&amp;gt;Save(“c:\\MyAssembly.dll”); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Q: Create &amp;amp; Save Assembly A: AssemblyBuilderAccess::&lt;b&gt;Save&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 163 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write a class named Employee that includes the following code segment. public class    &lt;br /&gt;Employee {     &lt;br /&gt;string employeeId, employeeName, jobTitleName;     &lt;br /&gt;public string GetName() { return employeeName; }     &lt;br /&gt;public string GetTitle() { return jobTitleName; }     &lt;br /&gt;You need to expose this class to COM in a type     &lt;br /&gt;library. The COM interface must also facilitate forward-compatibility across new versions of the Employee class. You need to choose a method for generating the COM interface. What should you do? &lt;/p&gt;  &lt;p&gt;A. Add the following attribute to the class    &lt;br /&gt;definition.[ClassInterface(ClassInterfaceType.&lt;b&gt;None&lt;/b&gt;)]public class Employee { &lt;/p&gt;  &lt;p&gt;B. Add the following attribute to the class &lt;/p&gt;  &lt;p&gt;definition.[ClassInterface(ClassInterfaceType.AutoDual)]public class Employee { &lt;/p&gt;  &lt;p&gt;C. Add the following attribute to the class definition.[ComVisible(true)]public class Employee { &lt;/p&gt;  &lt;p&gt;D. Define an interface for the class and add the following attribute to the class &lt;/p&gt;  &lt;p&gt;definition.[ClassInterface(ClassInterfaceType.&lt;b&gt;None&lt;/b&gt;)]public class Employee : IEmployee &lt;/p&gt;  &lt;p&gt;{ &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: ? A: ClasInterfaceType.&lt;b&gt;None &amp;amp; IEmployee&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 164 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application to assist the user in conducting electronic surveys. The survey consists of 25 true-or-false questions. You need to perform the following tasks: &lt;/p&gt;  &lt;p&gt;Initialize each answer to true.   &lt;br /&gt;Minimize the amount of memory used by each survey.     &lt;br /&gt;Which storage option should you choose? &lt;/p&gt;  &lt;p&gt;A. BitVector32^ answers = gcnew BitVector32(1); &lt;/p&gt;  &lt;p&gt;B. BitVector32^ answers = gcnew BitVector32(-1); &lt;/p&gt;  &lt;p&gt;C. BitArray^ answers = gcnew BitArray(1); &lt;/p&gt;  &lt;p&gt;D. BitArray^ answers = gcnew BitArray(-1); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Q: mem &amp;amp; Init all to True A: True so -1 &amp;amp; BitVector32 for mem. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 165 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;write&lt;/b&gt; a multicast &lt;b&gt;delegate&lt;/b&gt; that &lt;b&gt;accepts a DateTime&lt;/b&gt; argument and &lt;b&gt;returns a Boolean&lt;/b&gt; value. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public delegate int PowerDeviceOn(bool, &lt;/p&gt;  &lt;p&gt;DateTime); &lt;/p&gt;  &lt;p&gt;B. public delegate bool PowerDeviceOn(Object, &lt;/p&gt;  &lt;p&gt;EventArgs); &lt;/p&gt;  &lt;p&gt;C. public delegate void PowerDeviceOn(DateTime); &lt;/p&gt;  &lt;p&gt;D. public delegate bool PowerDeviceOn(DateTime); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: Delagate Accepts DateTime Returns Bool   &lt;br /&gt;A: delegate int PowerDeviceOn(bool, DateTime); &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 166 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a server application that will transmit sensitive information on a network. You create an X509Certificate object named certificate and a TcpClient object named client. You need to create an SslStream to communicate by using the Transport Layer Security 1.0 protocol. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. SslStream^ ssl = gcnew &lt;/p&gt;  &lt;p&gt;SslStream(Client-&amp;gt;GetStream());ssl-&amp;gt;AuthenticateAsServer(certificate, false,&lt;/p&gt;  &lt;p&gt;SslProtocols::None, true); &lt;/p&gt;  &lt;p&gt;B. SslStream ^ssl = gcnew &lt;/p&gt;  &lt;p&gt;SslStream(Client-&amp;gt;GetStream());ssl-&amp;gt;AuthenticateAsServer(certificate, false,&lt;/p&gt;  &lt;p&gt;SslProtocols::SSl3, true); &lt;/p&gt;  &lt;p&gt;C. SslStream ^ssl = gcnew &lt;/p&gt;  &lt;p&gt;SslStream(Client-&amp;gt;GetStream());ssl-&amp;gt;AuthenticateAsServer(certificate, false,&lt;/p&gt;  &lt;p&gt;SslProtocols::SSl2, true); &lt;/p&gt;  &lt;p&gt;D. SslStream ^ssl = gcnew &lt;/p&gt;  &lt;p&gt;SslStream(Client-&amp;gt;GetStream());ssl-&amp;gt;AuthenticateAsServer(certificate, false, SslProtocols::&lt;b&gt;Tls&lt;/b&gt;,&lt;/p&gt;  &lt;p&gt;true); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – I’ve seen this question enough to know TLS Transport Layer Security&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-4000839296870958555?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-net-foundations-questions-30.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-1581152969836183775</guid><pubDate>Thu, 27 Aug 2009 01:38:00 +0000</pubDate><atom:updated>2009-08-26T21:38:08.661-04:00</atom:updated><title>70-536 NET Foundations #29</title><description>&lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx, &lt;/p&gt;  &lt;p&gt;Catto &lt;/p&gt;  &lt;p&gt;Q#140 Q#150&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 140 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code to call a function from the Win32 Application Programming Interface (API) by using platform invoke. int rc = &lt;b&gt;MessageBox&lt;/b&gt;(hWnd, text, caption, type); You need to define a methon prototype. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. [DllImport(&amp;quot;user32&amp;quot;)]public static extern int MessageBox(int hWnd, String text, String caption, uint type); &lt;/p&gt;  &lt;p&gt;B. [DllImport(&amp;quot;user32&amp;quot;)]public static extern int MessageBoxA(int hWnd, String text, String caption, uint type); &lt;/p&gt;  &lt;p&gt;C. [DllImport(&amp;quot;user32&amp;quot;)]public static extern int Win32API_User32_MessageBox(    &lt;br /&gt;int hWnd, String text, String caption, uint type); &lt;/p&gt;  &lt;p&gt;D. [DllImport(@&amp;quot;C:\WINDOWS\system32\user32.dll&amp;quot;)]public static extern int    &lt;br /&gt;MessageBox(int hWnd, String text,     &lt;br /&gt;String caption, uint type); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 User32 &amp;amp; MessageBox &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 141 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to generate a report that &lt;b&gt;lists language codes&lt;/b&gt; and &lt;b&gt;region codes&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. foreach (CultureInfo culture in    &lt;br /&gt;CultureInfo.GetCultures(CultureTypes.SpecificCultures)) {     &lt;br /&gt;// Output the culture information...} &lt;/p&gt;  &lt;p&gt;B. CultureInfo culture = new CultureInfo(“”); CultureTypes types = culture.Culture Types;    &lt;br /&gt;// Output the culture information... &lt;/p&gt;  &lt;p&gt;C. foreach (CultureInfo culture in    &lt;br /&gt;CultureInfo.GetCultures(CultureTypes.NeutralCultures)) {     &lt;br /&gt;// Output the culture information...} &lt;/p&gt;  &lt;p&gt;D. foreach (CultureInfo culture in    &lt;br /&gt;CultureInfo.GetCultures(CultureTypes.ReplacementCultures)) {     &lt;br /&gt;// Output the culture information...} &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: list of languages A: loop threw them &amp;amp; use SpecificCultures&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 142 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a fiscal report for a customer. Your customer has a main office in the United States and a satellite office in Mexico. You need to ensure that when users in the satellite office generate the report, the &lt;b&gt;current date is displayed in Mexican Spanish &lt;/b&gt;format. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. &lt;b&gt;DateTimeFormatInfo&lt;/b&gt; dtfi = new &lt;b&gt;CultureInfo&lt;/b&gt;(“es-MX”, false).DateTimeFormat;     &lt;br /&gt;DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month,     &lt;br /&gt;DateTime.Today.Day); string dateString = dt.ToString(dtfi.LongDatePattern); &lt;/p&gt;  &lt;p&gt;B. Calendar cal = new CultureInfo(“es-MX”, false).Calendar; DateTime dt = new   &lt;br /&gt;DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day);     &lt;br /&gt;Strong DateString = dt.ToString(); &lt;/p&gt;  &lt;p&gt;C. string dateString = DateTimeFormatInfo.CurrentInfo    &lt;br /&gt;GetMonthName(DateTime.Today.Month); &lt;/p&gt;  &lt;p&gt;D. string dateString = DateTime.Today.Month.ToString(“es-MX”); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Date info from other locations &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 143 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an application that &lt;b&gt;lists processes&lt;/b&gt; on remote computers. The application requires a method that performs the following tasks: Accept the remote computer name as a    &lt;br /&gt;string parameter named &lt;b&gt;strComputer&lt;/b&gt;. Return an ArrayList object that contains the names of all processes that are running on that computer. You need to write a code segment that &lt;b&gt;retrieves the name of each process&lt;/b&gt; that is running on the remote computer and adds the name to the ArrayList     &lt;br /&gt;object. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. ArrayList^ al = gcnew ArrayList();   &lt;br /&gt;array&amp;lt;Process^&amp;gt; procs =    &lt;br /&gt;Process::GetProcessesByName(StrComputer);    &lt;br /&gt;for each (Process^ proc in procs) {     &lt;br /&gt;al-&amp;gt;Add(proc);} &lt;/p&gt;  &lt;p&gt;B. ArrayList^ al = gcnew ArrayList();   &lt;br /&gt;array&amp;lt;Process^&amp;gt; procs =    &lt;br /&gt;Process::GetProcesses(StrComputer);    &lt;br /&gt;for each (Process^ proc in procs) {     &lt;br /&gt;al-&amp;gt;Add(proc);} &lt;/p&gt;  &lt;p&gt;C. ArrayList^ al = gcnew ArrayList();   &lt;br /&gt;array&amp;lt;Process^&amp;gt; procs =    &lt;br /&gt;Process::GetProcessesByName(StrComputer);    &lt;br /&gt;for each (Process^ proc in procs) {     &lt;br /&gt;al-&amp;gt;Add(proc-&amp;gt;ProcessName);} &lt;/p&gt;  &lt;p&gt;D. ArrayList^ al = gcnew ArrayList();   &lt;br /&gt;array&amp;lt;Process^&amp;gt; procs =    &lt;br /&gt;Process::&lt;b&gt;GetProcesses&lt;/b&gt;(StrComputer);    &lt;br /&gt;for each (Process^ proc in procs) {     &lt;br /&gt;al-&amp;gt;Add(proc-&amp;gt;&lt;b&gt;ProcessName&lt;/b&gt;);} &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Get Process names A: Use GetProcesses &amp;amp; add ProcessName&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 144 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You develop a service application named &lt;b&gt;FileService&lt;/b&gt;. You deploy the service application to multiple servers on your network. You implement the following code segment. (Line numbers are included for reference only.) &lt;/p&gt;  &lt;p&gt;01 Public Sub StartService(ByVal serverName As String) &lt;/p&gt;  &lt;p&gt;02 Dim crtl As ServiceController = _ &lt;/p&gt;  &lt;p&gt;03 New ServiceController(&amp;quot;FileService&amp;quot;) &lt;/p&gt;  &lt;p&gt;04 If crtl.Status = ServiceControllerStatus.Stopped Then &lt;/p&gt;  &lt;p&gt;05 End If &lt;/p&gt;  &lt;p&gt;06 End Sub &lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;dev&lt;/b&gt;elop a routine that will &lt;b&gt;start FileService&lt;/b&gt; if it stops. The routine must start FileService on the server identified by the serverName input parameter. Which two lines of code should you add to the code segment? (Each correct answer presents part of the solution. Choose two.) &lt;/p&gt;  &lt;p&gt;A. Insert the following line of code between lines 03 and 04:crtl.ServiceName = serverName &lt;/p&gt;  &lt;p&gt;B. Insert the following line of code between lines 03 and 04:crtl.&lt;b&gt;MachineName&lt;/b&gt; = serverName &lt;/p&gt;  &lt;p&gt;C. Insert the following line of code between lines 03 and 04:crtl.Site.Name = serverName &lt;/p&gt;  &lt;p&gt;D. Insert the following line of code between lines 04 and 05:crtl.Continue() &lt;/p&gt;  &lt;p&gt;E. Insert the following line of code between lines 04 and 05:crtl.&lt;b&gt;Start&lt;/b&gt;() &lt;/p&gt;  &lt;p&gt;F. Insert the following line of code between lines 04 and 05:crtl.ExecuteCommand(0) &lt;/p&gt;  &lt;p&gt;Answer: B, E &lt;/p&gt;  &lt;p&gt;K8 – Q: Start app on server A: ctrl.MachineName &amp;amp; crtl.Start() &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 145 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an &lt;b&gt;app&lt;/b&gt;lication that &lt;b&gt;retrieves values&lt;/b&gt; from a &lt;b&gt;custom section &lt;/b&gt;of the application &lt;b&gt;config&lt;/b&gt;uration file. The custom section uses XML as shown in the following block. &lt;/p&gt;  &lt;p&gt;&amp;lt;ProjectSection name=&amp;quot;ProjectCompany&amp;quot;&amp;gt;    &lt;br /&gt;&amp;lt;role name=&amp;quot;administrator&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;role name=&amp;quot;manager&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;role name=&amp;quot;support&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;/ProjectSection&amp;gt; &lt;/p&gt;  &lt;p&gt;You need to write a code segment to define a &lt;b&gt;class &lt;/b&gt;named &lt;b&gt;Role&lt;/b&gt;. You need to ensure that the Role class is &lt;b&gt;initialized&lt;/b&gt; with &lt;b&gt;values&lt;/b&gt; that are retrieved from the custom section of the configuration file. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public class Role : ConfigurationElement {   &lt;br /&gt;internal string_ElementName = “name”;     &lt;br /&gt;[ConfigurationProperty(&amp;quot;role&amp;quot;)]     &lt;br /&gt;public string Name {     &lt;br /&gt;get {     &lt;br /&gt;return ((string)base[“role”]);     &lt;br /&gt;} } } &lt;/p&gt;  &lt;p&gt;B. public class Role : ConfigurationElement {    &lt;br /&gt;internal string_ElementName = “&lt;b&gt;role&lt;/b&gt;”;     &lt;br /&gt;[ConfigurationProperty(&amp;quot;name&amp;quot;, RequiredValue = true)]     &lt;br /&gt;public string Name {     &lt;br /&gt;get {     &lt;br /&gt;&lt;b&gt;return ((string)base[“name”]);&lt;/b&gt;    &lt;br /&gt;} } } &lt;/p&gt;  &lt;p&gt;C. public class Role : ConfigurationElement {    &lt;br /&gt;internal string_ElementName = “role”;     &lt;br /&gt;private String_name;     &lt;br /&gt;[ConfigurationProperty(&amp;quot;name&amp;quot;)]     &lt;br /&gt;public string Name {     &lt;br /&gt;get {     &lt;br /&gt;return_name;     &lt;br /&gt;} } } &lt;/p&gt;  &lt;p&gt;D. public class Role : ConfigurationElement {    &lt;br /&gt;internal string_ElementName = “name”;     &lt;br /&gt;private String_name;     &lt;br /&gt;[ConfigurationProperty(&amp;quot;role&amp;quot;, RequiredValue = true)]     &lt;br /&gt;public string Name {     &lt;br /&gt;get {     &lt;br /&gt;return_name;     &lt;br /&gt;} } } &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Q: Retrieve values from config A: Role &amp;amp; ConfgProperty required value = True&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 146 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to create a class definition that is &lt;b&gt;interoperable&lt;/b&gt; along with COM. You need to ensure that COM applications can create instances of the class and can &lt;b&gt;call the GetAddress method&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public ref class Customer {    &lt;br /&gt;string addressString;    &lt;br /&gt;public: Customer(string address) : addressString(address) { }     &lt;br /&gt;&lt;b&gt;String&lt;/b&gt;^ GetAddress() { return addressString; }} &lt;/p&gt;  &lt;p&gt;B. public ref class Customer {    &lt;br /&gt;static string addressString;    &lt;br /&gt;public: Customer() { }     &lt;br /&gt;static String^ GetAddress() { return addressString; }} &lt;/p&gt;  &lt;p&gt;C. public ref class Customer {    &lt;br /&gt;&lt;b&gt;string&lt;/b&gt;; addressString    &lt;br /&gt;public: &lt;b&gt;Customer&lt;/b&gt;() { }     &lt;br /&gt;&lt;b&gt;String&lt;/b&gt;^ GetAddress() { return addressString; }} &lt;/p&gt;  &lt;p&gt;D. public ref class Customer {    &lt;br /&gt;string addressString;    &lt;br /&gt;public: Customer() { }    &lt;br /&gt;private: String^ GetAddress() { return addressString; }} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – String GetAddress() Customer()&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 147 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application to perform mathematical calculations. You develop a class named CalculationValues. You write a procedure named PerformCalculation that operates on an instance of the class. You need to ensure that the user &lt;b&gt;interface of the application continues to respond while calculations are being performed.&lt;/b&gt; You need to write a code segment that calls the &lt;b&gt;PerformCalculation&lt;/b&gt; procedure to achieve this goal. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Private Sub PerformCalculation()...End Sub Private Sub DoWork()    &lt;br /&gt;Dim myValues As New CalculationValues()     &lt;br /&gt;Dim newThread As New Thread( _     &lt;br /&gt;New ThreadStart(AddressOf PerformCalculation))     &lt;br /&gt;newThread.Start(myValues)End Sub &lt;/p&gt;  &lt;p&gt;B. Private Sub PerformCalculation()...End Sub Private Sub DoWork() &lt;/p&gt;  &lt;p&gt;Dim myValues As New CalculationValues()    &lt;br /&gt;Dim delStart As New &lt;b&gt;ThreadStart&lt;/b&gt;( _AddressOf PerformCalculation)     &lt;br /&gt;Dim newThread As New Thread(delStart)If newThread.IsAlive     &lt;br /&gt;ThennewThread.Start(myValues)End IfEnd Sub &lt;/p&gt;  &lt;p&gt;C. Private Sub PerformCalculation ( _ByVal values As CalculationValues)...End Sub    &lt;br /&gt;Private Sub DoWork()     &lt;br /&gt;Dim myValues As New CalculationValues()     &lt;br /&gt;Application.DoEvents()     &lt;br /&gt;PerformCalculation(myValues)     &lt;br /&gt;Application.DoEvents()End Sub &lt;/p&gt;  &lt;p&gt;D. Private Sub PerformCalculation ( _ByVal values As Object)...End Sub Private Sub    &lt;br /&gt;DoWork()     &lt;br /&gt;Dim myValues As New CalculationValues()     &lt;br /&gt;Dim newThread As New Thread( _     &lt;br /&gt;New &lt;b&gt;ParameterizedThreadStart&lt;/b&gt;( _AddressOf PerformCalculation))     &lt;br /&gt;newThread.Start(myValues)End Sub &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Calculations &amp;amp; app continues to respond A: &lt;b&gt;ParameterizedThreadStart&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 148 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are testing a method that examines a running process. This &lt;b&gt;method returns an ArrayList&lt;/b&gt; containing the &lt;b&gt;name&lt;/b&gt; and &lt;b&gt;full path&lt;/b&gt; of all &lt;b&gt;modules&lt;/b&gt; that are loaded by the process. You need to list the modules loaded by a process named C:\TestApps\&lt;b&gt;Process1.exe&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. ArrayList^ ar = gcnew ArrayList();   &lt;br /&gt;array&amp;lt;Process^&amp;gt; procs;    &lt;br /&gt;ProcessModuleCollection^ modules;    &lt;br /&gt;procs = Process::GetProcesses(@”Process1”);    &lt;br /&gt;if(procs-&amp;gt;Length &amp;gt; 0) {     &lt;br /&gt;modules = procs[0]-&amp;gt;Modules;     &lt;br /&gt;for each (ProcessModule^ mod in modules) {     &lt;br /&gt;ar-&amp;gt;Add(mod-&amp;gt;ModuleName);     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;B. ArrayList^ ar = gcnew ArrayList();   &lt;br /&gt;array&amp;lt;Process^&amp;gt; procs;    &lt;br /&gt;ProcessModuleCollection modules;    &lt;br /&gt;procs = Process::GetProcesses(@”C:\TestApps\Process1.exe”);    &lt;br /&gt;if (procs-&amp;gt;Length &amp;gt; 0) {     &lt;br /&gt;modules = procs[0]-&amp;gt;Modules;     &lt;br /&gt;for each (ProcessModule^ mod in modules) {     &lt;br /&gt;ar-&amp;gt;Add(mod-&amp;gt;&lt;b&gt;ModuleName&lt;/b&gt;);     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;C. ArrayList^ ar = gcnew ArrayList();   &lt;br /&gt;array&amp;lt;Process^&amp;gt; procs;    &lt;br /&gt;ProcessModuleCollection modules;    &lt;br /&gt;procs = Process::GetProcesses(@”&lt;b&gt;Process1&lt;/b&gt;”);    &lt;br /&gt;if (procs-&amp;gt;Length &amp;gt; 0) {     &lt;br /&gt;modules = procs[0]-&amp;gt;Modules;     &lt;br /&gt;for each (ProcessModule^ mod in modules) {     &lt;br /&gt;ar-&amp;gt;Add(mod-&amp;gt;&lt;b&gt;FileName&lt;/b&gt;);     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;D. ArrayList^ ar = gcnew ArrayList();   &lt;br /&gt;array&amp;lt;Process^&amp;gt; procs;    &lt;br /&gt;ProcessModuleCollection modules;procs = Process-&amp;gt;GetProcessesByName(@”C:\TestApps\Process1.exe”);    &lt;br /&gt;if (procs-&amp;gt;Length &amp;gt; 0) {     &lt;br /&gt;modules = procs[0]-&amp;gt;Modules;     &lt;br /&gt;for each (ProcessModule^ mod in modules) {     &lt;br /&gt;ar-&amp;gt;Add(mod-&amp;gt;FileName);     &lt;br /&gt;}} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Q: Array name &amp;amp; path of modules loaded by an app Process1.exe A: @”Process1” &amp;amp; Filename &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 149 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following custom exception class named &lt;b&gt;CustomException&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;public class &lt;b&gt;CustomException&lt;/b&gt; : ApplicationException {     &lt;br /&gt;public static int COR_E_ARGUMENT =     &lt;br /&gt;unchecked((int)0x80070057);     &lt;br /&gt;public CustomException(string msg) : base(msg) {     &lt;br /&gt;HResult = COR_E_ARGUMENT;     &lt;br /&gt;}} You need to write a code segment that will use the &lt;b&gt;CustomException&lt;/b&gt; class to i&lt;b&gt;mmediately return control to the COM caller&lt;/b&gt;. You also need to ensure that the caller has access to the error code. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. return Marshal.GetExceptionForHR(    &lt;br /&gt;CustomException.COR_E_ARGUMENT); &lt;/p&gt;  &lt;p&gt;B. return CustomException.COR_E_ARGUMENT; &lt;/p&gt;  &lt;p&gt;C. Marshal.ThrowExceptionForHR(    &lt;br /&gt;CustomException.COR_E_ARGUMENT); &lt;/p&gt;  &lt;p&gt;D. throw new &lt;b&gt;CustomException&lt;/b&gt;(“Argument is out of bounds”); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: CustomerException that immediately return control to COM A: throw exception.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 150 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a class library that contains the class hierarchy defined in the following code segment. &lt;/p&gt;  &lt;p&gt;(Line numbers are included for reference only.)    &lt;br /&gt;01 public class Group {     &lt;br /&gt;02 public Employee[] Employees;     &lt;br /&gt;03 }     &lt;br /&gt;04 public class Employee {     &lt;br /&gt;05 public string Name;     &lt;br /&gt;06 }     &lt;br /&gt;07 public class Manager : Employee {     &lt;br /&gt;08 public int Level;     &lt;br /&gt;09 } &lt;/p&gt;  &lt;p&gt;You create an instance of the Group class. You populate the fields of the instance. When you attempt to &lt;b&gt;serialize&lt;/b&gt; the instance by using the Serialize method of the XmlSerializer class, you receive &lt;b&gt;InvalidOperationException&lt;/b&gt;. You also receive the following error message: &amp;quot;There was an error generating the XML document.&amp;quot; You need to modify the code segment so that you can successfully &lt;b&gt;serialize instances&lt;/b&gt; of the Group class by using the XmlSerializer class. You also need to &lt;b&gt;ensure that the XML output contains an element for all public fields&lt;/b&gt; in the class hierarchy. What should you do? &lt;/p&gt;  &lt;p&gt;A. Insert the following code between lines 1 and 2 of the code segment:    &lt;br /&gt;[XmlArrayItem(Type = typeof(Employee))]     &lt;br /&gt;[XmlArrayItem(Type = typeof(Manager))] &lt;/p&gt;  &lt;p&gt;B. Insert the following code between lines 1 and 2 of the code segment:    &lt;br /&gt;[XmlElement(Type = typeof(Employees))] &lt;/p&gt;  &lt;p&gt;C. Insert the following code between lines 1 and 2 of the code segment:    &lt;br /&gt;[XmlArray(ElementName=&amp;quot;Employees&amp;quot;)] &lt;/p&gt;  &lt;p&gt;D. Insert the following code between lines 3 and 4 of the code segment:    &lt;br /&gt;[XmlElement(Type = typeof(Employee))]     &lt;br /&gt;andInsert the following code between lines 6 and 7 of the code segment:     &lt;br /&gt;[XmlElement(Type = typeof(Manager))] &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: Serialize instances of Group Class A: Both Employee &amp;amp; Manager&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-1581152969836183775?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-net-foundations-29.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-1187138186582448066</guid><pubDate>Wed, 26 Aug 2009 02:15:00 +0000</pubDate><atom:updated>2009-08-26T20:32:30.953-04:00</atom:updated><title>70-536 NET Foundations #28</title><description>&lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.    &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx, &lt;/p&gt;  &lt;p&gt;Catto &lt;/p&gt;  &lt;p&gt;Q#121 – Q#39&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 121 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;return&lt;/b&gt; the contents of an &lt;b&gt;isolated storage file&lt;/b&gt; as a &lt;b&gt;string&lt;/b&gt;. The file is machine-scoped and is named &lt;b&gt;Settings.dat. &lt;/b&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objStream As IsolatedStorageFileStreamobjStream = New IsolatedStorageFileStream( _ "Settings.dat", FileMode.Open)Dim result As String = New   &lt;br /&gt;StreamReader(objStream).ReadToEnd &lt;/p&gt;  &lt;p&gt;B. Dim objFile As &lt;b&gt;IsolatedStorageFileobjFile&lt;/b&gt; =    &lt;br /&gt;IsolatedStorageFile.GetMachineStoreForAssembly   &lt;br /&gt;Dim objStream As IsolatedStorageFileStreamobjStream = New IsolatedStorageFileStream( _    &lt;br /&gt;"Settings.dat", FileMode.Open, objFile)   &lt;br /&gt;Dim result As String = New StreamReader(objStream).&lt;b&gt;ReadToEnd&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;C. Dim objStream As IsolatedStorageFileStreamobjStream = New   &lt;br /&gt;IsolatedStorageFileStream( _    &lt;br /&gt;"Settings.dat", FileMode.Open)Dim result As String objStream.toString &lt;/p&gt;  &lt;p&gt;D. Dim objFile As IsolatedStorageFileobjFile =   &lt;br /&gt;IsolatedStorageFile.GetMachineStoreForAssembly   &lt;br /&gt;Dim objStream As IsolatedStorageFileStreamobjStream = New IsolatedStorageFileStream( _    &lt;br /&gt;"Settings.dat", FileMode.Open, objFile)   &lt;br /&gt;Dim result As String = objStream.ToString &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – IsolatedStorageFileobjFile along with ReadToEnd&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 122 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a utility screen for a new client application. The &lt;b&gt;utility screen displays a thermometer&lt;/b&gt; that conveys the current &lt;b&gt;status of processes&lt;/b&gt; being carried out by the application. You need to &lt;b&gt;draw a rectangle&lt;/b&gt; on the screen to serve as the background of the thermometer as shown in the exhibit. The rectangle must be filled with &lt;b&gt;gradient shading&lt;/b&gt;. Which code segment should you choose? &lt;/p&gt;  &lt;p&gt;Exhibit:&lt;/p&gt;  &lt;p&gt;A. Rectangle rectangle = new Rectangle(10, 10, 450, 25); LinearGradientBrush rectangleBrush =   &lt;br /&gt;new LinearGradientBrush(rectangle, Color.AliceBlue,    &lt;br /&gt;Color.CornflowerBlue,    &lt;br /&gt;LinearGradientMode.ForwardDiagonal);    &lt;br /&gt;Pen rectanglePen = new Pen(rectangleBrush);    &lt;br /&gt;Graphics g = this.CreateGraphics(); g.DrawRectangle(rectanglePen, rectangle); &lt;/p&gt;  &lt;p&gt;B. Rectangle rectangle = new &lt;b&gt;Rectangle&lt;/b&gt;(10, 10, 450, 25); LinearGradientBrush rectangleBrush =    &lt;br /&gt;new LinearGradientBrush(rectangle, Color.AliceBlue,    &lt;br /&gt;Color.CornflowerBlue,    &lt;br /&gt;LinearGradientMode.ForwardDiagonal);    &lt;br /&gt;Pen rectanglePen = new Pen(rectangleBrush);    &lt;br /&gt;Graphics g = this.CreateGraphics(); g.FillRectangle(&lt;b&gt;rectangleBrush&lt;/b&gt;, rectangle); &lt;/p&gt;  &lt;p&gt;C. RectangleF rectangle = new RectangleF(10f, 10f, 450f, 25f); Point[] points = new Point[] {new Point(0, 0), new Point(110, 145)};   &lt;br /&gt;LinearGradientBrush rectangelBrush = new LinearGradientBrush(rectangle, Color.AliceBlue, Color.CornflowerBlue, LinearGradientMode.ForwardDiagonal);   &lt;br /&gt;Pen rectanglePen = new Pen(rectangleBrsh);   &lt;br /&gt;Graphics g = this.CreateGraphics(); g.DrawPolygon(rectanglePen, points); &lt;/p&gt;  &lt;p&gt;D. RectangleF rectangle = new RectangleF(10f, 10f, 450f, 25f); SolidBrush rectangleBrush =   &lt;br /&gt;new SolidBrush(Color.AliceBlue); Pen rectanglePen = new Pen(rectangleBrush);    &lt;br /&gt;Graphics g = this.CreateGraphics(); g.DrawRectangle(rectangleBrush, rectangle); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Just Rectangle not RectangleF &amp;amp; when filling use the brush not pen. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 123 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are &lt;b&gt;dev&lt;/b&gt;eloping an &lt;b&gt;app&lt;/b&gt;lication to perform mathematical calculations. You develop a &lt;b&gt;class&lt;/b&gt; named &lt;b&gt;CalculationValues&lt;/b&gt;. You write a procedure named PerformCalculation that operates on an instance of the class. You need to ensure that the &lt;b&gt;user interface of the application continues to respond while calculations are being performe&lt;/b&gt;d. You need to write a code segment that calls the PerformCalculation procedure to achieve this goal. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public ref class CalculationValues {}; public ref class Calculator {   &lt;br /&gt;public :    &lt;br /&gt;void PerformCalculation() {} }; public ref class ThreadTest{    &lt;br /&gt;private :    &lt;br /&gt;void DoWork (){    &lt;br /&gt;CalculationValues^ myValues = gcnew CalculationValues();    &lt;br /&gt;Calculator^ calc = gcnew Calculator();    &lt;br /&gt;Thread^ newThread = gcnew Thread(    &lt;br /&gt;gcnew ThreadStart(calc, &amp;amp;Calculator::PerformCalculation));    &lt;br /&gt;newThread-&amp;gt;Start(myValues);    &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;B. public ref class Calculation Values {}; public ref class Calculator {   &lt;br /&gt;public :void PerformCalculation() {}}; public ref class ThreadTest{    &lt;br /&gt;private : &lt;/p&gt;  &lt;p&gt;void DoWork (){   &lt;br /&gt;CalculationValues^ myValues = gcnew CalculationValues();    &lt;br /&gt;Calculator^ calc = gcnew Calculator();    &lt;br /&gt;ThreadStart^ delStart = gcnew    &lt;br /&gt;ThreadStart(calc, &amp;amp;Calculator::PerformCalculation);    &lt;br /&gt;Thread^ newThread = gcnew Thread(delStart);    &lt;br /&gt;if (newThread-&amp;gt;IsAlive) {    &lt;br /&gt;newThread-&amp;gt;Start(myValues);    &lt;br /&gt;}    &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;C. public ref class Calculation Values {}; public ref class Calculator {   &lt;br /&gt;public :    &lt;br /&gt;void PerformCalculation(CalculationValues^ values) {} };    &lt;br /&gt;public ref class ThreadTest{    &lt;br /&gt;private :    &lt;br /&gt;void DoWork (){    &lt;br /&gt;CalculationValues^ myValues = gcnew CalculationValues();    &lt;br /&gt;Calculator^ calc = gcnew Calculator();    &lt;br /&gt;Application::DoEvents();    &lt;br /&gt;calc-&amp;gt;PerformCalculation(myValues);    &lt;br /&gt;Application::DoEvents();    &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;D. public ref class Calculation Values {}; public ref class Calculator {   &lt;br /&gt;public :    &lt;br /&gt;void PerformCalculation(Object^ values) {} }; public ref class ThreadTest{    &lt;br /&gt;private :    &lt;br /&gt;void DoWork (){    &lt;br /&gt;CalculationValues^ myValues = gcnew CalculationValues();    &lt;br /&gt;Calculator^ calc = gcnew Calculator();    &lt;br /&gt;Thread^ newThread = gcnew Thread(    &lt;br /&gt;gcnew &lt;b&gt;ParameterizedThreadStart&lt;/b&gt;(calc,    &lt;br /&gt;&amp;amp;Calculator::PerformCalculation));    &lt;br /&gt;newThread-&amp;gt;Start(myValues);    &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Do calculations while still responding use ParameterizedTreadStart&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 124 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method &lt;b&gt;to decrypt data&lt;/b&gt; that was encrypted with the &lt;b&gt;Triple DES&lt;/b&gt; Algorithm. The method accepts the following parameters: The byte array to be decrypted, which is named cipherMessageThe key, which is named keyAn initialization vector, which is named iv You need to decrypt the message by using the TripleDES class and place the result in a string. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objDES As New TripleDESCryptoServiceProviderobjDES.&lt;b&gt;BlockSize&lt;/b&gt; =    &lt;br /&gt;cipherMessage.Length   &lt;br /&gt;Dim objCrypto As ICryptoTransform = _    &lt;br /&gt;objDES.&lt;b&gt;CreateDecryptor&lt;/b&gt;(key, iv)   &lt;br /&gt;Dim cipherStream As New    &lt;br /&gt;MemoryStream(cipherMessage)   &lt;br /&gt;Dim cryptoStream As New CryptoStream( _   &lt;br /&gt;cipherStream, objCrypto, CryptoStreamMode.Read)   &lt;br /&gt;Dim message As Stringmessage =    &lt;br /&gt;New StreamReader(cryptoStream).&lt;b&gt;ReadToEnd&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;B. Dim objDES As New TripleDESCryptoServiceProviderobjDES.&lt;b&gt;FeedbackSize&lt;/b&gt; =    &lt;br /&gt;cipherMessage.Length   &lt;br /&gt;Dim objCrypto As ICryptoTransform = _    &lt;br /&gt;objDES.&lt;b&gt;CreateDecryptor&lt;/b&gt;(key, iv)   &lt;br /&gt;Dim cipherStream As New    &lt;br /&gt;MemoryStream(cipherMessage)   &lt;br /&gt;Dim cryptoStream As New CryptoStream( _    &lt;br /&gt;cipherStream, objCrypto, CryptoStreamMode.Read)   &lt;br /&gt;Dim message As Stringmessage =    &lt;br /&gt;New StreamReader(cryptoStream).ReadToEnd &lt;/p&gt;  &lt;p&gt;C. Dim objDES As New TripleDESCryptoServiceProvider  &lt;br /&gt;Dim objCrypto As ICryptoTransform = _    &lt;br /&gt;objDES.CreateDecryptor()   &lt;br /&gt;Dim cipherStream As New    &lt;br /&gt;MemoryStream(cipherMessage)   &lt;br /&gt;Dim cryptoStream As New CryptoStream( _    &lt;br /&gt;cipherStream, objCrypto, CryptoStreamMode.Read)Dim message As Stringmessage =    &lt;br /&gt;New StreamReader(cryptoStream).ReadToEnd &lt;/p&gt;  &lt;p&gt;D. Dim objDES As New &lt;b&gt;TripleDESCryptoServiceProvider&lt;/b&gt;   &lt;br /&gt;Dim objCrypto As    &lt;br /&gt;ICryptoTransform = _    &lt;br /&gt;objDES.&lt;b&gt;CreateDecryptor&lt;/b&gt;(key, iv)   &lt;br /&gt;Dim cipherStream As New    &lt;br /&gt;MemoryStream(cipherMessage)   &lt;br /&gt;Dim cryptoStream As New CryptoStream( _    &lt;br /&gt;cipherStream, objCrypto, CryptoStreamMode.Read)Dim message As Stringmessage =    &lt;br /&gt;New StreamReader(cryptoStream).ReadToEnd &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – with &lt;b&gt;TripleDESCryptoServiceProvider no block or feedbacksize&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 125 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a &lt;b&gt;custom event handler&lt;/b&gt; to automatically &lt;b&gt;print all open documents&lt;/b&gt;. The event handler helps specify the number of copies to be printed. You need to &lt;b&gt;develop a custom event arguments class &lt;/b&gt;to pass as a parameter to the event handler. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public ref class PrintingArgs {   &lt;br /&gt;public :    &lt;br /&gt;int Copies ;    &lt;br /&gt;PrintingArgs (int numberOfCopies) {    &lt;br /&gt;this-&amp;gt;Copies = numberOfCopies;    &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;B. public ref class PrintingArgs : public EventArgs {   &lt;br /&gt;public :    &lt;br /&gt;int Copies ;    &lt;br /&gt;PrintingArgs(int numberOfCopies) {    &lt;br /&gt;this-&amp;gt;Copies = numberOfCopies;    &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;C. public ref class PrintingArgs {  &lt;br /&gt;public :    &lt;br /&gt;EventArgs Args;    &lt;br /&gt;PrintingArgs(EventArgs ea) {    &lt;br /&gt;this-&amp;gt;Args = ea;    &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;D. public ref class PrintingArgs : public EventArgs {   &lt;br /&gt;public :    &lt;br /&gt;int Copies;}; &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – class PrintingArgs &amp;amp; event handler EventArgs print all copies &amp;amp; increment counter. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 126 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method to &lt;b&gt;compress an array of bytes&lt;/b&gt;. The array is passed to the method in a parameter named &lt;b&gt;document&lt;/b&gt;. You need to compress the incoming array of bytes and return the result as an array of bytes. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. MemoryStream^ strm = gcnew MemoryStream(document);  &lt;br /&gt;DeflateStream^ deflate = gcnew DeflateStream(strm,    &lt;br /&gt;CompressionMode::Compress);    &lt;br /&gt;array&amp;lt;Byte&amp;gt;^ result = gcnew array&amp;lt;Byte&amp;gt;(document-&amp;gt;Length);    &lt;br /&gt;deflate-&amp;gt;Write(result, 0, result-&amp;gt;Length);    &lt;br /&gt;return result; &lt;/p&gt;  &lt;p&gt;B. MemoryStream^ strm = gcnew MemoryStream(document);   &lt;br /&gt;DeflateStream^ deflate = gcnew DeflateStream(strm,    &lt;br /&gt;CompressionMode::Compress);    &lt;br /&gt;deflate-&amp;gt;Write(document, 0, document-&amp;gt;Length);    &lt;br /&gt;deflate-&amp;gt;Close();return strm-&amp;gt;ToArray(); &lt;/p&gt;  &lt;p&gt;C. MemoryStream^ strm = gcnew &lt;b&gt;MemoryStream();&lt;/b&gt;   &lt;br /&gt;DeflateStream^ deflate = gcnew    &lt;br /&gt;DeflateStream(strm,CompressionMode::Compress);   &lt;br /&gt;deflate-&amp;gt;Write(&lt;b&gt;document&lt;/b&gt;, 0, document-&amp;gt;Length);   &lt;br /&gt;deflate-&amp;gt;Close();    &lt;br /&gt;return strm-&amp;gt;ToArray(); &lt;/p&gt;  &lt;p&gt;D. MemoryStream^ inStream = gcnew MemoryStream(document);DeflateStream^  &lt;br /&gt;deflate = gcnew DeflateStream(inStream,    &lt;br /&gt;CompressionMode::Compress);    &lt;br /&gt;MemoryStream^ outStream = gcnew MemoryStream()    &lt;br /&gt;;int b;    &lt;br /&gt;while ((b = deflate-&amp;gt;ReadByte()) != -1) {    &lt;br /&gt;outStream-&amp;gt;WriteByte((Byte)b);    &lt;br /&gt;}    &lt;br /&gt;return outStream-&amp;gt;ToArray(); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – &lt;b&gt;MemoryStream()&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 127 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a class that performs complex financial calculations. The class contains a method named &lt;b&gt;GetCurrentRate&lt;/b&gt; that retrieves the current interest rate and a variable named &lt;b&gt;currRate&lt;/b&gt; that stores the current interest rate. You write &lt;b&gt;serialized&lt;/b&gt; representations of the class. You need to write a code segment that updates the currRate variable with the current interest rate &lt;b&gt;when an instance of the class is deserialized.&lt;/b&gt; Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;OnSerializing&amp;gt; _Friend Sub UpdateValue (ByVal context As StreamingContext) &lt;/p&gt;  &lt;p&gt;currRate = GetCurrentRate()End Sub &lt;/p&gt;  &lt;p&gt;B. &amp;lt;OnSerializing&amp;gt; _ Friend Sub UpdateValue(ByVal info As SerializationInfo) &lt;/p&gt;  &lt;p&gt;info.AddValue("currentRate", GetCurrentRate())End Sub &lt;/p&gt;  &lt;p&gt;C. &amp;lt;OnDeserializing&amp;gt; _ Friend Sub UpdateValue(ByVal info As SerializationInfo) &lt;/p&gt;  &lt;p&gt;info.AddValue("currentRate", GetCurrentRate())End Sub &lt;/p&gt;  &lt;p&gt;D. &amp;lt;&lt;b&gt;OnDeserialized&lt;/b&gt;&amp;gt; _Friend Sub UpdateValue (ByVal context As StreamingContext) &lt;/p&gt;  &lt;p&gt;currRate = GetCurrentRate()End Sub &lt;/p&gt;  &lt;p&gt;Answer: D&lt;/p&gt;  &lt;p&gt;K8 - &lt;b&gt;OnDeserialized – when the instance of the class is deserialized. &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing an application that &lt;b&gt;uses isolated storage&lt;/b&gt; to &lt;b&gt;store user preferences&lt;/b&gt;. The application uses multiple assemblies. Multiple users will use this application on the same computer. You need to create a &lt;b&gt;directory&lt;/b&gt; named &lt;b&gt;Preferences&lt;/b&gt; in the isolated storage area that is scoped to the current Microsoft &lt;b&gt;Windows identity&lt;/b&gt; and assembly. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objStore As IsolatedStorageFileobjStore = &lt;/p&gt;  &lt;p&gt;IsolatedStorageFile.&lt;b&gt;GetUserStoreForAssemblyobjStore&lt;/b&gt;.CreateDirectory("Preferences") &lt;/p&gt;  &lt;p&gt;B. Dim objStore As IsolatedStorageFileobjStore =   &lt;br /&gt;IsolatedStorageFile.GetMachineStoreForAssemblyobjStore.CreateDirectory("Preferences") &lt;/p&gt;  &lt;p&gt;C. Dim objStore As IsolatedStorageFileobjStore =   &lt;br /&gt;IsolatedStorageFile.GetUserStoreForDomainobjStore.CreateDirectory("Preferences") &lt;/p&gt;  &lt;p&gt;D. Dim objStore As IsolatedStorageFileobjStore =   &lt;br /&gt;IsolatedStorageFile.GetUserStoreForApplicationobjStore.CreateDirectory("Preferences") &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: multiple assemblies A: &lt;b&gt;GetUserStoreForAssemblyobjStore&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 129 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method that &lt;b&gt;searches a string for a substring.&lt;/b&gt; The method will be localized to Italy. Your method accepts the following parameters: The string to be searched, which is named searchList. The string for which to search, which is named searchValue You need to write the code. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A return searchList.IndexOf(searchValue); &lt;/p&gt;  &lt;p&gt;B. CompareInfo comparer = new CultureInfo(“it-IT”).CompareInfo;   &lt;br /&gt;return comparer.Compare(searchList, searchValue); &lt;/p&gt;  &lt;p&gt;C. CultureInfo Comparer = new CultureInfo(“it-IT”);  &lt;br /&gt;if(searchList.IndexOf(searchValue)    &lt;br /&gt;&amp;gt; 0) {    &lt;br /&gt;return true;} else {    &lt;br /&gt;return false;} &lt;/p&gt;  &lt;p&gt;D. CompareInfo comparer =   &lt;br /&gt;new CultureInfo(“it-IT”).CompareInfo;   &lt;br /&gt;if (comparer.IndexOf(searchList, searchValue) &amp;gt; 0) {    &lt;br /&gt;return true;} else {    &lt;br /&gt;return false;} &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Use comparer.IndexOf &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 130 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a &lt;b&gt;class&lt;/b&gt; named &lt;b&gt;Age&lt;/b&gt;. You need to ensure that the Age class is written such that &lt;b&gt;collections of Age objects can be sorted&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Public Class Age   &lt;br /&gt;Public Value As Integer    &lt;br /&gt;Public Function CompareTo(ByVal obj As Object) As Objec t    &lt;br /&gt;If TypeOf obj Is Age Then    &lt;br /&gt;Dim _age As Age = CType(obj, Age)    &lt;br /&gt;Return Value.CompareTo(obj)    &lt;br /&gt;End If    &lt;br /&gt;Throw New ArgumentException("object not an Age")    &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;B. Public Class Age   &lt;br /&gt;Public Value As Integer    &lt;br /&gt;Public Function CompareTo(ByVal iValue As Integer) As Object    &lt;br /&gt;Try    &lt;br /&gt;Return Value.CompareTo(iValue)    &lt;br /&gt;Catch    &lt;br /&gt;Throw New ArgumentException ("object not an Age")    &lt;br /&gt;End Try    &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;C. Public Class Age   &lt;br /&gt;Implements IComparable    &lt;br /&gt;Public Value As Integer    &lt;br /&gt;Public Function CompareTo(ByVal obj As Object) As Integer _    &lt;br /&gt;Implements &lt;b&gt;IComparable&lt;/b&gt;.CompareTo    &lt;br /&gt;If TypeOf obj Is Age Then    &lt;br /&gt;Dim _age As Age = CType(obj, Age)    &lt;br /&gt;Return Value.&lt;b&gt;CompareTo&lt;/b&gt;(_age.Value)    &lt;br /&gt;End If    &lt;br /&gt;Throw New ArgumentException("object not an Age")    &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;D. Public Class Age   &lt;br /&gt;Implements IComparable    &lt;br /&gt;Public Value As Integer    &lt;br /&gt;Public Function CompareTo(ByVal obj As Object) As Integer _    &lt;br /&gt;Implements IComparable.CompareTo    &lt;br /&gt;Try    &lt;br /&gt;Return Value.CompareTo((CType(obj, Age)).Value)    &lt;br /&gt;Catch    &lt;br /&gt;Return -1    &lt;br /&gt;End Try    &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Able to sort A: Icomparable &amp;amp; not try needed. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 131 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a class library. Portions of your code need to access system environment variables. You need to force a runtime SecurityException only when callers that are higher in the call stack do not have the necessary &lt;b&gt;permissions&lt;/b&gt;. Which call method should you use? &lt;/p&gt;  &lt;p&gt;A. &lt;b&gt;Demand()&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;B. Assert() &lt;/p&gt;  &lt;p&gt;C. PermitOnly() &lt;/p&gt;  &lt;p&gt;D. Deny() &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: force rentime securityException when callers that don’t have permission. A: Demand()&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 132 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are testing a component that &lt;b&gt;serializes&lt;/b&gt; the Meeting class instances so that they can be saved to the file system. The Meeting class has the following definition: &lt;/p&gt;  &lt;p&gt;Public Class Meeting   &lt;br /&gt;Private title As String    &lt;br /&gt;Public roomNumber As Integer    &lt;br /&gt;Public invitees As String()    &lt;br /&gt;Public Sub New()End Sub    &lt;br /&gt;Public Sub New(ByVal t As String)    &lt;br /&gt;title = t    &lt;br /&gt;End Sub End Class    &lt;br /&gt;The component contains a procedure with the following code segment. &lt;/p&gt;  &lt;p&gt;Dim myMeeting As New Meeting("Goals") myMeeting.roomNumber = 1100   &lt;br /&gt;Dim attendees As String() = New String(1) {"Company", "Mary"} myMeeting.invitees = attendees    &lt;br /&gt;Dim xs As New XmlSerializer(GetType(Meeting)) Dim writer As New    &lt;br /&gt;StreamWriter("C:\Meeting.xml") xs.Serialize(writer, myMeeting) writer.Close()    &lt;br /&gt;You need to identify the XML block that is written to the C:\Meeting.xml file as a result of running this procedure. Which XML block represents &lt;b&gt;the content that will be written to the C:\Meeting.xml file&lt;/b&gt;? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;   &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&lt;a href="http://www.w3.org/2001/XMLSchema"&gt;http://www.w3.org/2001/XMLSchema&lt;/a&gt;   &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;    &lt;br /&gt;&amp;lt;title&amp;gt;Goals&amp;lt;/title&amp;gt;    &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;    &lt;br /&gt;&amp;lt;invitee&amp;gt;Company&amp;lt;/invitee&amp;gt;    &lt;br /&gt;&amp;lt;invitee&amp;gt;Mary&amp;lt;/invitee&amp;gt;    &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;B. &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;   &lt;br /&gt;&amp;lt;Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema"    &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;    &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;    &lt;br /&gt;&amp;lt;invitees&amp;gt;    &lt;br /&gt;&amp;lt;string&amp;gt;Company&amp;lt;/string&amp;gt;    &lt;br /&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;    &lt;br /&gt;&amp;lt;/invitees&amp;gt;    &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;C. &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;   &lt;br /&gt;&amp;lt;Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema"    &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &lt;/p&gt;  &lt;p&gt;&lt;b&gt;title="Goals"&amp;gt;&lt;/b&gt;   &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;    &lt;br /&gt;&amp;lt;invitees&amp;gt;    &lt;br /&gt;&amp;lt;string&amp;gt;Company&amp;lt;/string&amp;gt;    &lt;br /&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;    &lt;br /&gt;&amp;lt;/invitees&amp;gt;    &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;D. &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;   &lt;br /&gt;&amp;lt;Meeting xmlns:xsd="http://www.w3.org/2001/XMLSchema"    &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;    &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;    &lt;br /&gt;&amp;lt;invitees&amp;gt;    &lt;br /&gt;&amp;lt;string&amp;gt;Company&amp;lt;/string&amp;gt;    &lt;br /&gt;&amp;lt;/invitees&amp;gt;    &lt;br /&gt;&amp;lt;invitees&amp;gt;    &lt;br /&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;    &lt;br /&gt;&amp;lt;/invitees&amp;gt;    &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – no title tag like in C&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 133 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method that &lt;b&gt;searches a string for a substring.&lt;/b&gt; The method will be localized to Italy. Your method accepts the following parameters: The string to be searched, which is named SearchListThe string for which to search, which is named SearchValue You need to write the code. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Return SearchList.IndexOf(SearchValue) &lt;/p&gt;  &lt;p&gt;B. Dim objComparer As CompareInfo = _   &lt;br /&gt;New CultureInfo("it-IT").CompareInfoReturn objComparer.Compare(SearchList, SearchValue) &lt;/p&gt;  &lt;p&gt;C. Dim objComparer As CompareInfo = _   &lt;br /&gt;New CultureInfo("it-IT").CompareInfoIf SearchList.IndexOf(SearchValue) &amp;gt; 0 Then    &lt;br /&gt;Return TrueElse    &lt;br /&gt;Return FalseEnd If &lt;/p&gt;  &lt;p&gt;D. Dim &lt;b&gt;objComparer&lt;/b&gt; As CompareInfo = _    &lt;br /&gt;New CultureInfo("it-IT").CompareInfoIf &lt;b&gt;objComparer&lt;/b&gt;.IndexOf(SearchList,    &lt;br /&gt;SearchValue) &amp;gt; 0 Then    &lt;br /&gt;Return TrueElse    &lt;br /&gt;Return FalseEnd If &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 - String from substring &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 134 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to &lt;b&gt;encrypt&lt;/b&gt; sensitive data with the Data Encryption Standard (&lt;b&gt;DES&lt;/b&gt;) algorithm. Your method accepts the following parameters: &lt;/p&gt;  &lt;p&gt;The byte array to be encrypted, which is named messageAn encryption key, which is named keyAn initialization vector, which is named iv You need to encrypt the data. You also need to write the encrypted data to a MemoryStream object. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objDES As New DESCryptoServiceProviderobjDES.BlockSize =   &lt;br /&gt;message.Length    &lt;br /&gt;Dim objCrypto As ICryptoTransform = obj    &lt;br /&gt;DES.CreateDecryptor(key, iv)    &lt;br /&gt;Dim cipherStream As New MemoryStream    &lt;br /&gt;Dim cryptoStream As New CryptoStream(cipherStream, objCrypto, CryptoStreamMode.Write) &lt;/p&gt;  &lt;p&gt;B. Dim objDES As New DESCryptoServiceProvider &lt;/p&gt;  &lt;p&gt;Dim objCrypto As ICryptoTransform = objDES.CreateDecryptor(key, iv)  &lt;br /&gt;Dim cipherStream As New MemoryStream    &lt;br /&gt;Dim cryptoStream As New CryptoStream(cipherStream, objCrypto, CryptoStreamMode.Write)   &lt;br /&gt;cryptoStream.Write(message, 0, message.Length) &lt;/p&gt;  &lt;p&gt;C. Dim objDES As New DESCryptoServiceProvider   &lt;br /&gt;Dim objCrypto As ICryptoTransform = obj    &lt;br /&gt;DES.CreateDecryptor()    &lt;br /&gt;Dim cipherStream As New MemoryStream    &lt;br /&gt;Dim cryptoStream As New CryptoStream(cipherStream, objCrypto, CryptoStreamMode.Write)    &lt;br /&gt;cryptoStream.Write(message, 0, message.Length) &lt;/p&gt;  &lt;p&gt;D. Dim objDES As New DESCryptoServiceProvider   &lt;br /&gt;Dim objCrypto As ICryptoTransform =&lt;/p&gt;  &lt;p&gt;objDES.&lt;b&gt;CreateEncryptor&lt;/b&gt;(key, iv)    &lt;br /&gt;Dim cipherStream As New MemoryStream    &lt;br /&gt;Dim cryptoStream As New CryptoStream(cipherStream, objCrypto, CryptoStreamMode.Write)    &lt;br /&gt;cryptoStream.Write(message, 0, message.Length) &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – CreateEncryptor since encrypting&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 135 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an application that retrieves values from a &lt;b&gt;custom section of the application configuration&lt;/b&gt; file. The custom section uses XML as shown in the following block. &lt;/p&gt;  &lt;p&gt;&amp;lt;ProjectSection name="ProjectCompany"&amp;gt;   &lt;br /&gt;&amp;lt;role name="administrator" /&amp;gt;    &lt;br /&gt;&amp;lt;role name="manager" /&amp;gt;    &lt;br /&gt;&amp;lt;role name="support" /&amp;gt;    &lt;br /&gt;&amp;lt;/ProjectSection&amp;gt; &lt;/p&gt;  &lt;p&gt;You need to write a code segment to define a class named Role. You need to ensure that the &lt;b&gt;Role class&lt;/b&gt; is &lt;b&gt;initialized with values&lt;/b&gt; that are retrieved from the custom section of the configuration    &lt;br /&gt;file. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Public Class RoleInherits ConfigurationElementFriend _ElementName As String =   &lt;br /&gt;"name"    &lt;br /&gt;&amp;lt;ConfigurationProperty("role")&amp;gt; _    &lt;br /&gt;Public ReadOnly Property Name() As String    &lt;br /&gt;Get    &lt;br /&gt;Return CType(Me("role"), String)    &lt;br /&gt;End Get    &lt;br /&gt;End PropertyEnd Class &lt;/p&gt;  &lt;p&gt;B. Public Class Role &lt;/p&gt;  &lt;p&gt;Inherits ConfigurationElement   &lt;br /&gt;Friend _ElementName As String = "role"    &lt;br /&gt;&amp;lt;ConfigurationProperty("name&lt;b&gt;", IsRequired:=True)&amp;gt;&lt;/b&gt; _    &lt;br /&gt;Public ReadOnly Property Name() As String    &lt;br /&gt;Get    &lt;br /&gt;Return CType(Me("name"), String)    &lt;br /&gt;End Get    &lt;br /&gt;End PropertyEnd Class &lt;/p&gt;  &lt;p&gt;C. Public Class Role   &lt;br /&gt;Inherits ConfigurationElement    &lt;br /&gt;Friend _ElementName As String = "role"    &lt;br /&gt;Private _name As String    &lt;br /&gt;&amp;lt;ConfigurationProperty("name")&amp;gt; _    &lt;br /&gt;Public ReadOnly Property Name() As String    &lt;br /&gt;Get    &lt;br /&gt;Return _name    &lt;br /&gt;End Get    &lt;br /&gt;End PropertyEnd Class    &lt;br /&gt;D. Public Class Role    &lt;br /&gt;Inherits ConfigurationElement    &lt;br /&gt;Friend _ElementName As String = "name"    &lt;br /&gt;Private _name As String    &lt;br /&gt;&amp;lt;ConfigurationProperty("role", IsRequired:=True)&amp;gt; _    &lt;br /&gt;Public ReadOnly Property Name() As String    &lt;br /&gt;Get    &lt;br /&gt;Return _name    &lt;br /&gt;End Get    &lt;br /&gt;End PropertyEnd Class &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - &lt;b&gt;", IsRequired:=True)&amp;gt; &amp;amp; return Name&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 136 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;serialize&lt;/b&gt; an object &lt;b&gt;of type List&amp;lt;int&amp;gt;&lt;/b&gt; in a binary format. The object is named data. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. BinaryFormatter formatter = new BinaryFormatter();  &lt;br /&gt;MemoryStream stream = new MemoryStream();   &lt;br /&gt;&lt;b&gt;formatter.Serialize(stream, data);&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;B. BinaryFormatter formatter = new BinaryFormatter();  &lt;br /&gt;MemoryStream stream = new   &lt;br /&gt;MemoryStream();    &lt;br /&gt;for (int i = 0; i &amp;lt; data.Count, i++) {    &lt;br /&gt;formatter.Serialize(stream, data[i]);} &lt;/p&gt;  &lt;p&gt;C. BinaryFormatter formatter = new BinaryFormatter();  &lt;br /&gt;byte[] buffer = new byte[data.Count];   &lt;br /&gt;MemoryStream stream = new MemoryStream(buffer, true);    &lt;br /&gt;formatter.Serialize(s tream, data); &lt;/p&gt;  &lt;p&gt;D. BinaryFormatter formatter = new BinaryFormatter();  &lt;br /&gt;MemoryStream stream = new MemoryStream();   &lt;br /&gt;data.ForEach(delegate(int num)    &lt;br /&gt;{ formatter.Serialize(stream, data); }    &lt;br /&gt;); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – BinaryFormatter &lt;b&gt;formatter.Serialize(stream, data);&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 137 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method to &lt;b&gt;compress an array of bytes&lt;/b&gt;. The bytes to be compressed are passed to the method in a parameter named &lt;b&gt;document&lt;/b&gt;. You need &lt;b&gt;to compress the contents of the incoming parameter&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. MemoryStream inStream = new MemoryStream(document);  &lt;br /&gt;GZipStream zipStream = new GZipStream(inStream,    &lt;br /&gt;CompressionMode.Compress);    &lt;br /&gt;byte[] result = new &lt;/p&gt;  &lt;p&gt;Byte[document.Length];  &lt;br /&gt;zipStream.Write(result, 0, result.Length);    &lt;br /&gt;return result; &lt;/p&gt;  &lt;p&gt;B. MemoryStream Stream = new MemoryStream(document);  &lt;br /&gt;GZipStream zipStream = new GZipStream(stream,    &lt;br /&gt;CompressionMode.Compress);   &lt;br /&gt;zipStream.Write(document, 0, document.Length);   &lt;br /&gt;zipStream.Close();   &lt;br /&gt;return stream.ToArray(); &lt;/p&gt;  &lt;p&gt;C. MemoryStream outStream = new MemoryStream();  &lt;br /&gt;GZipStream zipStream = new GZipStream(outStream,    &lt;br /&gt;CompressionMode.Compress);   &lt;br /&gt;zipStream.Write(&lt;b&gt;document&lt;/b&gt;, 0, document.Length);   &lt;br /&gt;zipStream.Close();   &lt;br /&gt;return outStream.ToArray(); &lt;/p&gt;  &lt;p&gt;D. MemoryStream inStream = new MemoryStream(document);GZipStream zipStream =   &lt;br /&gt;new GZipStream(inStream,    &lt;br /&gt;CompressionMode.Compress);    &lt;br /&gt;MemoryStream outStream = new MemoryStream();int b;while   &lt;br /&gt;((b = zipStream.ReadByte()) != -1) {    &lt;br /&gt;outStream.WriteByte((byte)b);   &lt;br /&gt;} return outStream.ToArray(); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Q: compress A: MemoryStream(); Gzip compress &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 138 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code to implement the CompanyClass.MyMethod function.   &lt;br /&gt;Public Class NewClass    &lt;br /&gt;Public Function MyMethod(ByVal Arg As Integer) As Integer    &lt;br /&gt;Return Arg    &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;call the CompanyClass.MyMethod function dynamically from an unrelated class in your assembly&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objNewClass As New NewClassDim objType As Type =   &lt;br /&gt;objNewClass.GetType   &lt;br /&gt;Dim objInfo As MethodInfo = _   &lt;br /&gt;objType.GetMethod("MyMethod")   &lt;br /&gt;Dim objParams() As Object = {1}   &lt;br /&gt;Dim i As Integer = _   &lt;br /&gt;DirectCast(objInfo.Invoke(Me, objParams), Integer) &lt;/p&gt;  &lt;p&gt;B. Dim objNewClass As New NewClass  &lt;br /&gt;Dim objType As Type = objNewClass.GetType   &lt;br /&gt;Dim objInfo As MethodInfo =    &lt;br /&gt;objType.GetMethod("MyMethod")   &lt;br /&gt;Dim objParams() As Object = {1}   &lt;br /&gt;Dim i As Integer = _   &lt;br /&gt;DirectCast(objInfo.Invoke(&lt;b&gt;objNewClass&lt;/b&gt;, objParams), Integer) &lt;/p&gt;  &lt;p&gt;C. Dim objNewClass As New NewClass  &lt;br /&gt;Dim objType As Type =    &lt;br /&gt;objNewClass.GetTypeDim objInfo As MethodInfo = _    &lt;br /&gt;objType.GetMethod("NewClass.MyMethod")Dim objParams() As Object = {1}Dim i As    &lt;br /&gt;Integer = _    &lt;br /&gt;DirectCast(objInfo.Invoke(objNewClass, objParams), Integer) &lt;/p&gt;  &lt;p&gt;D. Dim objType As Type = Type.GetType("NewClass")  &lt;br /&gt;Dim objInfo As MethodInfo =    &lt;br /&gt;objType.GetMethod("MyMethod")   &lt;br /&gt;Dim objParams() As Object = {1}   &lt;br /&gt;Dim i As Integer = _   &lt;br /&gt;DirectCast(objInfo.Invoke(Me, objParams), Integer) &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - Invoke(&lt;b&gt;objNewClass&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 139 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to &lt;b&gt;decrypt&lt;/b&gt; data that was encrypted with the &lt;b&gt;Triple DES&lt;/b&gt; Algorithm. The method accepts the following parameters: The byte array to be decrypted, which is named cipherMessageThe key, which is named keyAn initialization vector, which is named iv You need to decrypt the message by using the TripleDES class and place the result in a string. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. TripleDES^ des = gcnew TripleDESCryptoServiceProvider();des-&amp;gt;BlockSize = cipherMessage-&amp;gt;Length;   &lt;br /&gt;ICryptoTransform^ crypto = des-&amp;gt;CreateDecryptor(key, iv);    &lt;br /&gt;MemoryStream^ cipherStream = gcnew MemoryStream(cipherMessage);    &lt;br /&gt;CryptoStream ^cryptoStream = gcnew CryptoStream(cipherStream, crypto, CryptoStreamMode::Read);    &lt;br /&gt;String^ message;StreamReader^ sReader = gcnew StreamReader(cryptoStream);    &lt;br /&gt;message = sReader-&amp;gt;ReadToEnd(); &lt;/p&gt;  &lt;p&gt;B. TripleDES^ des = gcnew TripleDESCryptoServiceProvider();  &lt;br /&gt;des-&amp;gt;FeedbackSize = cipherMessage-&amp;gt;Length;    &lt;br /&gt;ICryptoTransform^ crypto = des-&amp;gt;CreateDecryptor(key, iv);   &lt;br /&gt;MemoryStream^ cipherStream = gcnew MemoryStream(cipherMessage);    &lt;br /&gt;CryptoStream^ cryptoStream = gcnew CryptoStream(cipherStream, crypto,CryptoStreamMode::Read);    &lt;br /&gt;String^ message;StreamReader^ sReader = gcnew StreamReader(cryptoStream);    &lt;br /&gt;message = sReader-&amp;gt;ReadToEnd(); &lt;/p&gt;  &lt;p&gt;C. TripleDES^ des = gcnew TripleDESCryptoServiceProvider();   &lt;br /&gt;ICryptoTransform^ crypto = des-&amp;gt;CreateDecryptor();    &lt;br /&gt;MemoryStream^ cipherStream = gcnew MemoryStream(cipherMessage);    &lt;br /&gt;CryptoStream^ cryptoStream = gcnew CryptoStream(cipherStream, crypto,    &lt;br /&gt;CryptoStreamMode::Read);String^ message;    &lt;br /&gt;StreamReader^ sReader = gcnew StreamReader(cryptoStream);    &lt;br /&gt;message = sReader-&amp;gt;ReadToEnd(); &lt;/p&gt;  &lt;p&gt;D. TripleDES^ des = gcnew TripleDESCryptoServiceProvider();   &lt;br /&gt;ICryptoTransform^ crypto = des-&amp;gt;&lt;b&gt;CreateDecryptor(key, iv); &lt;/b&gt;   &lt;br /&gt;MemoryStream^ cipherStream = gcnew MemoryStream(cipherMessage);    &lt;br /&gt;CryptoStream^ cryptoStream = gcnew CryptoStream( cipherStream, crypto,    &lt;br /&gt;CryptoStreamMode::Read); &lt;/p&gt;  &lt;p&gt;String^ message;StreamReader^ sReader = gcnew StreamReader(cryptoStream);   &lt;br /&gt;message = sReader-&amp;gt;ReadToEnd(); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – TripleDes Decrypting&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-1187138186582448066?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/cts-net-foundations-28.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-3219000719683137851</guid><pubDate>Wed, 26 Aug 2009 00:46:00 +0000</pubDate><atom:updated>2009-08-25T20:46:52.019-04:00</atom:updated><title>70-536 MCTS .NET Foundations #27</title><description>&lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments.&lt;/p&gt;  &lt;p&gt;Thx, &lt;/p&gt;  &lt;p&gt;Catto &lt;/p&gt;  &lt;p&gt;Q#111 – Q#120&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 111 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a fiscal report for Company.com. Company.com has a main office in the United States and a satellite office in the UK. You need to ensure that when users in the satellite office generate the report, the &lt;b&gt;current date is displayed in &lt;/b&gt;Mexican Spanish format. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim &lt;b&gt;DTFormat&lt;/b&gt; As DateTimeFormatInfo = _ New CultureInfo(&amp;quot;es-MX&amp;quot;, &lt;/p&gt;  &lt;p&gt;False).DateTimeFormatDim DT As New DateTime( _ DateTime.Today.Year, &lt;/p&gt;  &lt;p&gt;DateTime.Today.Month, DateTime.Today.Day)Dim strDate As String = _ &lt;/p&gt;  &lt;p&gt;DT.ToString(DTFormat.LongDatePattern) &lt;/p&gt;  &lt;p&gt;B. Dim objCalendar As Calendar = _ New CultureInfo(&amp;quot;es-MX&amp;quot;, False).CalendarDim DT As New &lt;/p&gt;  &lt;p&gt;DateTime( _ DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day)Dim &lt;/p&gt;  &lt;p&gt;strDate As String = DT.ToString &lt;/p&gt;  &lt;p&gt;C. Dim strDate As String = _ DateTimeFormatInfo.CurrentInfo.GetMonthName( _ &lt;/p&gt;  &lt;p&gt;DateTime.Today.Month) &lt;/p&gt;  &lt;p&gt;D. Dim strDate As String = _ DateTime.Today.Month.ToString(&amp;quot;es-MX&amp;quot;) &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Good Old &lt;b&gt;DTFormat&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 112 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create an application that stores information about your customers who reside in various regions. You are developing internal utilities for this application. You need to gather &lt;b&gt;regional information about your customers in Canada&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) { //    &lt;br /&gt;Output the region information...} &lt;/p&gt;  &lt;p&gt;B. CultureInfo cultureInfo = new CultureInfo(“CA”); // Output the region information… &lt;/p&gt;  &lt;p&gt;C. RegionInfo regionInfo = new RegionInfo(“CA”); // Output the region information… &lt;/p&gt;  &lt;p&gt;D. RegionInfo regionInfo = new RegionInfo(“”);if(regionInfo.Name == “CA”) { &lt;/p&gt;  &lt;p&gt;// Output the region information...} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Q: regional info A: RegionInfo&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 113 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;serialize&lt;/b&gt; an object of &lt;b&gt;type List&amp;lt;int&amp;gt;&lt;/b&gt; in a binary format. The object is named data. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. BinaryFormatter^ formatter = gcnew BinaryFormatter();MemoryStream^ stream = gcnew   &lt;br /&gt;MemoryStream();    &lt;br /&gt;formatter-&amp;gt;Serialize(stream, data); &lt;/p&gt;  &lt;p&gt;B. BinaryFromatter formatter = gcnew BinaryFormatter();MemoryStream^ stream = gcnew   &lt;br /&gt;MemoryStream();    &lt;br /&gt;for (int i = 0; i &amp;lt; data-&amp;gt;Count; i++) {     &lt;br /&gt;formatter-&amp;gt;Serialize(stream, data[i]);} &lt;/p&gt;  &lt;p&gt;C. BinaryFormatter^ formatter = gcnew BinaryFormatter();array&amp;lt;Byte&amp;gt;^ buffer = gcnew   &lt;br /&gt;array&amp;lt;Byte&amp;gt;(data-&amp;gt;Count);MemoryStream^ stream = gcnew MemoryStream(buffer, true);    &lt;br /&gt;formatter-&amp;gt;Serialize(stream, data); &lt;/p&gt;  &lt;p&gt;D. BinaryFormatter^ formatter = gcnew BinaryFormatter();   &lt;br /&gt;MemoryStream^ stream = gcnew    &lt;br /&gt;MemoryStream();Capture c(formatter, stream);data-&amp;gt;ForEach(gcnew Action&amp;lt;int&amp;gt;(%c, &amp;amp;Capture::Action)); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – no for loop needed&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 114 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a &lt;b&gt;server app&lt;/b&gt;lication that will transmit sensitive information on a network. You create an X509Certificate object named certificate and a TcpClient object named client. You need to create an SslStream to communicate by using the &lt;b&gt;Transport Layer Security&lt;/b&gt; 1.0 protocol. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer(certificate, false, SslProtocols.None, true); &lt;/p&gt;  &lt;p&gt;B. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer(certificate, false, SslProtocols.Ssl3, true); &lt;/p&gt;  &lt;p&gt;C. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer(certificate, false, SslProtocols.Ssl2, true); &lt;/p&gt;  &lt;p&gt;D. SslStream ssl = new SslStream(client.GetStream()); ssl.AuthenticateAsServer(certificate, false, &lt;b&gt;SslProtocols.Tls&lt;/b&gt;, true); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 - &lt;b&gt;SslProtocols.Tls Tls&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Q: Transmit Layer Security A: Tls&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 115 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to call a COM component. You need to use &lt;b&gt;declarative&lt;/b&gt; &lt;b&gt;security&lt;/b&gt; to explicitly request the runtime to perform a full stack walk. You must ensure that all callers have the required &lt;b&gt;level of trust&lt;/b&gt; for COM interop before the callers execute your method. Which attribute should you place on the method? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;SecurityPermission( _ &lt;/p&gt;  &lt;p&gt;SecurityAction.&lt;b&gt;Demand&lt;/b&gt;, _ &lt;/p&gt;  &lt;p&gt;Flags:=SecurityPermissionFlag.UnmanagedCode) _&amp;gt; &lt;/p&gt;  &lt;p&gt;B. &amp;lt;SecurityPermission( _ &lt;/p&gt;  &lt;p&gt;SecurityAction.LinkDemand, _ &lt;/p&gt;  &lt;p&gt;Flags:=SecurityPermissionFlag.UnmanagedCode) _&amp;gt; &lt;/p&gt;  &lt;p&gt;C. &amp;lt;SecurityPermission( _ &lt;/p&gt;  &lt;p&gt;SecurityAction.As sert, _ &lt;/p&gt;  &lt;p&gt;Flags:=SecurityPermissionFlag.UnmanagedCode) _&amp;gt; &lt;/p&gt;  &lt;p&gt;D. &amp;lt;SecurityPermission( _ &lt;/p&gt;  &lt;p&gt;SecurityAction.Deny, _ &lt;/p&gt;  &lt;p&gt;Flags:=SecurityPermissionFlag.UnmanagedCode) _&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: Level of trust COM A: SecurityAction.Deman&lt;/p&gt;  &lt;p&gt;Questio&lt;b&gt;n: 116 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a &lt;b&gt;method&lt;/b&gt; that &lt;b&gt;accepts a string&lt;/b&gt; parameter named message. Your method must &lt;b&gt;break the message&lt;/b&gt; parameter into individual lines of text and pass each line to a second method named Process. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. StringReader reader = new StringReader(message);   &lt;br /&gt;Process(reader.ReadToEnd());    &lt;br /&gt;reader.Close(); &lt;/p&gt;  &lt;p&gt;B. StringReader reader = new StringReader(message);   &lt;br /&gt;while (reader.Peek() != -1) { &lt;/p&gt;  &lt;p&gt;string line = reader.Read().ToString();    &lt;br /&gt;Process(line);}reader.Close(); &lt;/p&gt;  &lt;p&gt;C. StringReader reader = new    &lt;br /&gt;StringReader(message);    &lt;br /&gt;Process(reader.ToString());    &lt;br /&gt;reader.Close(); &lt;/p&gt;  &lt;p&gt;D. StringReader reader = new StringReader(message);   &lt;br /&gt;while (reader.&lt;b&gt;Peek()&lt;/b&gt; != -1) { &lt;/p&gt;  &lt;p&gt;Process(reader.ReadLine());   &lt;br /&gt;}reader.Close(); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Break the message into individual lines A: use Peek()&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 117 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to &lt;b&gt;encrypt&lt;/b&gt; sensitive &lt;b&gt;data&lt;/b&gt; with the Data Encryption Standard (&lt;b&gt;DES&lt;/b&gt;) algorithm. Your method accepts the following parameters: &lt;/p&gt;  &lt;p&gt;The byte array to be encrypted, which is named &lt;b&gt;messageAn encryption&lt;/b&gt; key, which is named &lt;b&gt;keyAn&lt;/b&gt; initialization vector, which is named iv You need to encrypt the data. You also need to write the &lt;b&gt;encrypted data to a MemoryStream object&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. DES des = new DESCryptoServiceProvider();    &lt;br /&gt;des.BlockSize = message.Length;    &lt;br /&gt;ICryptoTransform crypto = des.CreateEncryptor(key, iv); MemoryStream cipherStream = new MemoryStream();     &lt;br /&gt;CryptoStream c ryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write);     &lt;br /&gt;cryptoStream.Write(message, 0, message.Length); &lt;/p&gt;  &lt;p&gt;B. DES des = new DESCryptoServiceProvider();    &lt;br /&gt;ICryptoTransform crypto = des.CreateDecryptor(key, iv);     &lt;br /&gt;MemoryStream cipherStream = new MemoryStream();CryptoStream cryptoStream =     &lt;br /&gt;new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write);     &lt;br /&gt;cryptoStream.Write(message, 0, message.Length); &lt;/p&gt;  &lt;p&gt;C. DES des = new DESCryptoServiceProvider();ICryptoTrans form crypto =   &lt;br /&gt;des.CreateEncryptor();     &lt;br /&gt;MemoryStream cipherStream = new MemoryStream();CryptoStream cryptoStream = &lt;/p&gt;  &lt;p&gt;new CryptoStream(cipherStream,    &lt;br /&gt;crypto, CryptoStreamMode.Write);     &lt;br /&gt;cryptoStream.Write(message, 0, message.Length); &lt;/p&gt;  &lt;p&gt;D. DES des = new DESCryptoServiceProvider();   &lt;br /&gt;ICryptoTrans form crypto =    &lt;br /&gt;des.CreateEncryptor(key, iv);     &lt;br /&gt;MemoryStream cipherStream = new &lt;b&gt;MemoryStream&lt;/b&gt;();    &lt;br /&gt;CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, &lt;b&gt;CryptoStreamMode&lt;/b&gt;.Write);    &lt;br /&gt;cryptoStream.Write(message, 0, message.Length); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Q: Encrypt using DES A: des.CreateDecryptor(key, iv); &amp;amp; MemoryStream();&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 118 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a new security policy for an application domain. You write the following lines of code. &lt;/p&gt;  &lt;p&gt;PolicyLevel policy = PolicyLevel.CreateAppDomainLevel();    &lt;br /&gt;PolicyStatement noTrustStatement =     &lt;br /&gt;new PolicyStatement(     &lt;br /&gt;policy.GetNamedPermissionSet(“Nothing”));     &lt;br /&gt;PolicyStatement fullTrustStatement =     &lt;br /&gt;new PolicyStatement(     &lt;br /&gt;policy.GetNamedPermissionSet(“&lt;b&gt;FullTrust&lt;/b&gt;”)); &lt;/p&gt;  &lt;p&gt;You need to arrange code groups for the policy so that &lt;b&gt;loaded assemblies default to the Nothing permission set&lt;/b&gt;. If the assembly originates from a &lt;b&gt;trusted zone&lt;/b&gt;, the security policy must grant the assembly the &lt;b&gt;FullTrust&lt;/b&gt; permission set. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. CodeGroup group1 = new FirstMatchCodeGroup(    &lt;br /&gt;new ZoneMembershipCondition(SecurityZone.Trusted),     &lt;br /&gt;fullTrustStatement);     &lt;br /&gt;CodeGroup group2 = new UnionCodegroup( new AllMembershipCondition(),     &lt;br /&gt;noTrustStatement); group1.AddChild(group2); &lt;/p&gt;  &lt;p&gt;B. CodeGroup group1 = new FirstMatchCodeGroup(    &lt;br /&gt;new &lt;b&gt;AllMembershipCondition&lt;/b&gt;(), noTrustStatement); CodeGroup group2 = new UnionCodeGroup(    &lt;br /&gt;new ZoneMembershipCondition(SecurityZone.Trusted),     &lt;br /&gt;fullTrustStatement);     &lt;br /&gt;group1.AddChild(group2); &lt;/p&gt;  &lt;p&gt;C. CodeGroup group = new UnionCodeGroup(    &lt;br /&gt;new ZoneMembershipCondition(SecurityZone.Trusted),     &lt;br /&gt;fullTrustStatement); &lt;/p&gt;  &lt;p&gt;D. CodeGroup group = new FirstMatchCodeGroup(    &lt;br /&gt;new AllMembershipCondition(), noTrustStatement); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – 2 code groups needed. First use &lt;b&gt;AllMembershipCondition to all &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 119 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You develop a service application named PollingService that periodically calls long-running procedures. These procedures are called from the DoWork method. You use the following service application code:&lt;/p&gt;  &lt;p&gt;partial class PollingService :    &lt;br /&gt;ServiceBase {     &lt;br /&gt;bool blnExit = false;     &lt;br /&gt;public PollingService() {}     &lt;br /&gt;protected override void &lt;b&gt;OnStart&lt;/b&gt;(string[] args) {     &lt;br /&gt;do {     &lt;br /&gt;DoWork();     &lt;br /&gt;} while &lt;b&gt;(!blnExit&lt;/b&gt;);     &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;protected override void OnStop() {    &lt;br /&gt;blnExit = true;     &lt;br /&gt;}    &lt;br /&gt;private void DoWork() { &lt;/p&gt;  &lt;p&gt;.. &lt;/p&gt;  &lt;p&gt;} } &lt;/p&gt;  &lt;p&gt;When you attempt to &lt;b&gt;start the service&lt;/b&gt;, you receive the following error message: Could not start the PollingService service on the local computer. Error 1053: The &lt;b&gt;service did not respond to the start &lt;/b&gt;or control &lt;b&gt;request in a timely fashion&lt;/b&gt;. You need to modify the service application code so that the service starts properly. What should you do? &lt;/p&gt;  &lt;p&gt;A. Move the loop code into the constructor of the service class from the OnStart method. &lt;/p&gt;  &lt;p&gt;B. Drag a &lt;b&gt;timer&lt;/b&gt; component onto the design surface of the service. Move the calls to the long-running procedure from the OnStart method into the Tick event procedure of the timer, set     &lt;br /&gt;the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method. &lt;/p&gt;  &lt;p&gt;C. &lt;b&gt;Add a class-level System.Timers.Timer&lt;/b&gt; variable to the service class code. Move the call to the DoWork method into the Elapsed event procedure of the timer, set the Enabled property of the &lt;b&gt;timer to True&lt;/b&gt;, and &lt;b&gt;call the Start&lt;/b&gt; method of the timer in the OnStart method. &lt;/p&gt;  &lt;p&gt;D. Move the loop code from the OnStart method into the DoWork method. &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 Add a class level timer&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 120 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a code segment that &lt;b&gt;transfers&lt;/b&gt; the contents of a &lt;b&gt;byte array named dataToSend&lt;/b&gt; by using a &lt;b&gt;NetworkStream&lt;/b&gt; object named &lt;b&gt;netStream&lt;/b&gt;. You need to use a &lt;b&gt;cache of size 8,192&lt;/b&gt;    &lt;br /&gt;bytes. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. MemoryStream memStream = new    &lt;br /&gt;MemoryStream(8192);    &lt;br /&gt;memStream.Write(dataToSend, 0, (int) netStream.Length); &lt;/p&gt;  &lt;p&gt;B. MemoryStream memStream = new    &lt;br /&gt;MemoryStream(8192);    &lt;br /&gt;netStream.Write(dataToSend, 0, (int) memStream.Length); &lt;/p&gt;  &lt;p&gt;C. BufferedStream &lt;b&gt;bufStream&lt;/b&gt; = new &lt;b&gt;BufferedStream&lt;/b&gt;(&lt;b&gt;netStream&lt;/b&gt;, 8192);     &lt;br /&gt;bufStream.Write(dataToSend, 0, dataToSend.Length); &lt;/p&gt;  &lt;p&gt;D. BufferedStream bufStream = new BufferedStream(netStream);    &lt;br /&gt;bufStream.Write(dataToSend, 0, 8192); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Transfer contents of byte array with cashe limit use BufferedsTream(netStream, 8192)&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-3219000719683137851?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-foundations-27.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-1898040065745431976</guid><pubDate>Tue, 25 Aug 2009 02:38:00 +0000</pubDate><atom:updated>2009-08-24T22:38:57.491-04:00</atom:updated><title>70-536 MCTS .NET Foundations #26</title><description>&lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx" target="_blank"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx, &lt;/p&gt;  &lt;p&gt;Catto &lt;/p&gt;  &lt;p&gt;Q#100 – Q#110&lt;/p&gt;  &lt;p&gt;#26 below&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 100 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing code for user authentication and authorization. The username, password, and roles are stored in your application data store. You need to establish a &lt;b&gt;user security context&lt;/b&gt; that will be used for authorization checks such as &lt;b&gt;IsInRole&lt;/b&gt;. You write the following code segment to authorize the user. &lt;/p&gt;  &lt;p&gt;if (!TestPassword(userName, password))    &lt;br /&gt;throw new Exception(“could not authenticate user”);    &lt;br /&gt;String[] userRolesArray = LookupUserRoles(userName);     &lt;br /&gt;You need to complete this code so that it &lt;b&gt;establishes the user      &lt;br /&gt;security context.&lt;/b&gt; Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. GenericIdentity ident = new GenericIdentity(userName);   &lt;br /&gt;GenericPrincipal currentUser = New GenericPrincipal(ident, userRolesArray);    &lt;br /&gt;Thread.CurrentPrincipal = currentUser; &lt;/p&gt;  &lt;p&gt;B. WindowsIdentity ident = new WindowsIdentity(userName);   &lt;br /&gt;WindowsPrincipal currentUser = new WindowsPrincipal(ident);    &lt;br /&gt;Thread.CurrentPrincipal = currentUser; &lt;/p&gt;  &lt;p&gt;C. NTAccount userNTName = new NTAccount(userName);   &lt;br /&gt;GenericIdentity ident = new enericIdentity(userNTName.Value);    &lt;br /&gt;GenericPrincipal currentUser = new GenericPrincipal(ident, userRolesArray);    &lt;br /&gt;Thread.CurrentPrincipal = currentUser; &lt;/p&gt;  &lt;p&gt;D. IntPtr token = IntPtr.Zero;token = LogonUserUsingInterop(username, encryptedPassword);   &lt;br /&gt;WindowsImpersonationContext ctx = WindowsIdentity.Impersonate(token); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – GenericIdentity &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 101 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create an application that stores information about your customers who reside in various regions. You are developing internal utilities for this application. You need to &lt;b&gt;gather regional information about your customers in Canada&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. For Each objCulture As CultureInfo In    &lt;br /&gt;_CultureInfo.GetCultures(CultureTypes .SpecificCultures)     &lt;br /&gt;...Next &lt;/p&gt;  &lt;p&gt;B. Dim objCulture As New CultureInfo(&amp;quot;CA&amp;quot;) &lt;/p&gt;  &lt;p&gt;C. Dim objRegion As New RegionInfo(&amp;quot;CA&amp;quot;) &lt;/p&gt;  &lt;p&gt;D. Dim objRegion As New RegionInfo(&amp;quot;&amp;quot;)If objRegion.Name = &amp;quot;CA&amp;quot; Then &lt;/p&gt;  &lt;p&gt;...End If &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;Gather regional information RegionInfo&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 102 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create an application to &lt;b&gt;send a message by e-mail&lt;/b&gt;. An SMTP server is available on the local subnet. The SMTP server is named smtp.Company.com. To test the application, you use a source address, me@Company.com, and a target address, you@Company.com. You need to transmit the e-mail message. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. MailAddress addrFrom(“me@Company.com”, “Me”);   &lt;br /&gt;MailAddress addrTo(“you@Company.com”, “You”);    &lt;br /&gt;MailMessage message(%addrFrom, %addrTo);    &lt;br /&gt;message.Subject = “Greetings!”;    &lt;br /&gt;message.Body = “Test”;message.Dispose(); &lt;/p&gt;  &lt;p&gt;B. String^strSmtpClient = “smtp.Company.com”;   &lt;br /&gt;String^ strFrom = “me@Company.com”;    &lt;br /&gt;String^ strTo = “you@Company.com”;    &lt;br /&gt;String^ strSubject = “Greetings!”;String^ strBody = “Test”;    &lt;br /&gt;MailMessage msg(strFrom, strTo, strSubject, strSmtpClient); &lt;/p&gt;  &lt;p&gt;C. MailAddress addrFrom(“me@Company.com”);   &lt;br /&gt;MailAddress addrTo(“you@Company.com”);    &lt;br /&gt;MailMessage message(%addrFrom, %addrTo);    &lt;br /&gt;message.Subject = “Greetings!”;    &lt;br /&gt;message.body = “Test”;SmtpClient lient(“smtp.Company.com”);    &lt;br /&gt;client.Send(%message); &lt;/p&gt;  &lt;p&gt;D. MailAddress^ addrFrom = gcnew MailAddress(“me@Company.com”, “Me”);   &lt;br /&gt;MailAddress^ addrTo = gcnew MailAddress(“you@Company.com”, “You”);    &lt;br /&gt;MailMessage^ message = gcnew MailMessage(addrFrom, addrTo);    &lt;br /&gt;message-&amp;gt;Subject = “Greetings!”;    &lt;br /&gt;message-&amp;gt;Body = “Test”;    &lt;br /&gt;SocketInformation info;    &lt;br /&gt;Socket^ client = gcnew Socket(info);    &lt;br /&gt;System::Text::ASCIIEncoding^ enc = gcnew System::Text::ASCIIEncoding();    &lt;br /&gt;array&amp;lt;unsigned char&amp;gt;^ msgBytes = enc-    &lt;br /&gt;&amp;gt;GetBytes(message-&amp;gt;ToString());    &lt;br /&gt;client-&amp;gt;Send(msgBytes); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 - Need sent at end&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 103&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code segment to call a function from the Win32 Application Programming Interface (API) by using &lt;b&gt;platform invoke.&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;String^ personName = “N?el”;   &lt;br /&gt;String^ msg = &amp;quot;Welcome &amp;quot; + personName + &amp;quot; to club &amp;quot;!&amp;quot;;bool rc = User32API::MessageBox(0, ms g, personName, 0);     &lt;br /&gt;You need to define a method prototype that can &lt;b&gt;best marshal the string data. &lt;/b&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. [DllImport(&amp;quot;user32&amp;quot;, CharSet = CharSet::Ansi)]extern bool MessageBox(int hWnd,    &lt;br /&gt;String^ text,     &lt;br /&gt;String^ caption,     &lt;br /&gt;unsigned int type);} &lt;/p&gt;  &lt;p&gt;B. [DllImport(&amp;quot;user32&amp;quot;, EntryPoint = &amp;quot;MessageBoxA&amp;quot;, CharSet = CharSet::Ansi)]extern    &lt;br /&gt;bool MessageBox(int hWnd,     &lt;br /&gt;[MarshalAs(UnmanagedType::LPWStr)]String^ text,     &lt;br /&gt;[MarshalAs(UnmanagedType::LPWStr)]String^ caption,     &lt;br /&gt;unsigned int type);} &lt;/p&gt;  &lt;p&gt;C. [DllImport(&amp;quot;user32&amp;quot;, CharSet = CharSet::&lt;b&gt;Unicode&lt;/b&gt;)]extern bool MessageBox(int hWnd,    &lt;br /&gt;String^ text,     &lt;br /&gt;String^ caption,     &lt;br /&gt;unsigned int type);} &lt;/p&gt;  &lt;p&gt;D. [DllImport(&amp;quot;user32&amp;quot;, EntryPoint = &amp;quot;MessageBoxA&amp;quot;, CharSet =    &lt;br /&gt;CharSet::Unicode)]extern bool MessageBox(int hWnd,     &lt;br /&gt;[MarshalAs(UnmanagedType.LPWStr)]String^ text,     &lt;br /&gt;[MarshalAs(UnmanagedType.LPWStr)]String^ caption,     &lt;br /&gt;unsigned int type);} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Q: best marshal the string data. A: Unicode CharSet&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 104 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an application that retrieves values from a custom section of the application configuration file. The custom section uses XML as shown in the following block. &lt;/p&gt;  &lt;p&gt;&amp;lt;ProjectSection name=&amp;quot;ProjectCompany&amp;quot;&amp;gt;    &lt;br /&gt;&amp;lt;role name=&amp;quot;administrator&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;role name=&amp;quot;manager&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;role name=&amp;quot;support&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;/ProjectSection&amp;gt; &lt;/p&gt;  &lt;p&gt;You need to write a code segment to define a class named Role. You need to ensure that the &lt;b&gt;Role class is initialized with values&lt;/b&gt; that are retrieved from the custom section of the configuration     &lt;br /&gt;file. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public ref class Role : public ConfigurationElement {    &lt;br /&gt;protected :     &lt;br /&gt;static String^ _ElementName = “name”;     &lt;br /&gt;public :     &lt;br /&gt;[ConfigurationProperty(&amp;quot;role&amp;quot;)]     &lt;br /&gt;property String^ Name {     &lt;br /&gt;String^ get() {return ((String^)base[“role”]);} &lt;/p&gt;  &lt;p&gt;}}; &lt;/p&gt;  &lt;p&gt;B. public ref class Role : public ConfigurationElement {    &lt;br /&gt;protected :     &lt;br /&gt;static String^ _ElementName = “role”;     &lt;br /&gt;public :     &lt;br /&gt;[ConfigurationProperty(&amp;quot;name&amp;quot;, IsRequired = true)]     &lt;br /&gt;property String^ Name {     &lt;br /&gt;String^ get() {return ((String^)base[“name”]);}     &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;C. public ref class Role : public ConfigurationElement {    &lt;br /&gt;private :     &lt;br /&gt;String^ _name;     &lt;br /&gt;protected :     &lt;br /&gt;static String^ _ElementName = “role”;     &lt;br /&gt;public :     &lt;br /&gt;[ConfigurationProperty(&amp;quot;name&amp;quot;)]     &lt;br /&gt;property String^ Name {     &lt;br /&gt;String^ get() {return_name;}     &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;D. public ref class Role : public ConfigurationElement {    &lt;br /&gt;private :     &lt;br /&gt;String^ _name;     &lt;br /&gt;protected :     &lt;br /&gt;static String^ _ElementName = “name”;     &lt;br /&gt;public :     &lt;br /&gt;[ConfigurationProperty(&amp;quot;role&amp;quot;, IsRequired = true)]     &lt;br /&gt;property String^ Name {     &lt;br /&gt;String^ get() {return_name;}     &lt;br /&gt;}}; &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - ElementName role &amp;amp; protected&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 105 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a method that runs by using the credentials of the end user. You need to use Microsoft Windows groups to &lt;b&gt;authorize&lt;/b&gt; the user. You must add a code segment that &lt;b&gt;identifies whether a user is in the local group named Clerk&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. WindowsIdentity currentUser = WindowsIdentity.GetCurrent();   &lt;br /&gt;foreach    &lt;br /&gt;(IdentityReference grp in currentUser.Groups) {     &lt;br /&gt;NTAccount grpAccount =     &lt;br /&gt;((NTAccount)grp.Translate(typeof(NTAccount)));     &lt;br /&gt;isAuthorized = grpAccount.Value.Equals(Environment.MachineName + @”\Clerk”);     &lt;br /&gt;if(isAuthorized) break;} &lt;/p&gt;  &lt;p&gt;B. WindowsPrincipal currentUser =    &lt;br /&gt;(WindowsPrincipal)Thread.CurrentPrincipal;    &lt;br /&gt;isAuthorized = currentUser.IsInRole(“Clerk”); &lt;/p&gt;  &lt;p&gt;C. GenericPrincipal currentUser =    &lt;br /&gt;(GenericPrincipal) Thread.CurrentPrincipal;    &lt;br /&gt;isAuthorized = currentUser.IsInRole(“Clerk”): &lt;/p&gt;  &lt;p&gt;D. WindowsPrincipal currentUser =    &lt;br /&gt;(WindowsPrincipal)Thread.CurrentPrincipal;    &lt;br /&gt;isAuthorized = currentUser.IsInRole(Environment.MachineName); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Authorize user &amp;amp; user in local group WindowsPrincipal &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 106 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create an application to &lt;b&gt;send a message by e-mail&lt;/b&gt;. An SMTP server is available on the local subnet. The SMTP server is named smtp.Company.com. To test the application, you use a source address, me@Company.com, and a target address, you@Company.com. You need to transmit the e-mail message. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim MailFrom As New MailAddress(&amp;quot;me@Company.com&amp;quot;, &amp;quot;Me&amp;quot;)    &lt;br /&gt;Dim MailTo As New MailAddress(&amp;quot;you@Company.com&amp;quot;, &amp;quot;You&amp;quot;)     &lt;br /&gt;Dim Message As New MailMessage(MailFrom, MailTo)Message.Subject =     &lt;br /&gt;&amp;quot;Greetings&amp;quot;Message.Body = &amp;quot;Test&amp;quot;Message.Dispose() &lt;/p&gt;  &lt;p&gt;B. Dim SMTPClient As String = &amp;quot;smtp.Company.com&amp;quot;    &lt;br /&gt;Dim MailFrom As String = me@Company.com     &lt;br /&gt;Dim MailTo As String = you@Company.com     &lt;br /&gt;Dim Subject As String = &amp;quot;Greetings&amp;quot;     &lt;br /&gt;Dim Body As String = &amp;quot;Test&amp;quot;Dim Message As New MailMessage(MailFrom, MailTo, Subject, SMTPClient) &lt;/p&gt;  &lt;p&gt;C. Dim MailFrom As New MailAddress(&amp;quot;me@Company.com&amp;quot;, &amp;quot;Me&amp;quot;)    &lt;br /&gt;Dim MailTo As New MailAddress(&amp;quot;you@Company.com&amp;quot;, &amp;quot;You&amp;quot;)     &lt;br /&gt;Dim Message As New MailMessage(MailFrom, MailTo)Message.Subject =     &lt;br /&gt;&amp;quot;Greetings&amp;quot;Message.Body = &amp;quot;Test&amp;quot;     &lt;br /&gt;Dim objClient As New SmtpClient(&amp;quot;smtp.Company.com&amp;quot;)objClient.Send(Message) &lt;/p&gt;  &lt;p&gt;D. Dim MailFrom As New MailAddress(&amp;quot;me@Company.com&amp;quot;, &amp;quot;Me&amp;quot;) &lt;/p&gt;  &lt;p&gt;Dim MailTo As New MailAddress(&amp;quot;you@Company.com&amp;quot;, &amp;quot;You&amp;quot;)    &lt;br /&gt;Dim Message As New MailMessage(MailFrom, MailTo)Message.Subject =     &lt;br /&gt;&amp;quot;Greetings&amp;quot;Message.Body = &amp;quot;Test&amp;quot;     &lt;br /&gt;Dim Info As New SocketInformationDim Client As New Socket(Info)     &lt;br /&gt;Dim Enc As New ASCIIEncodingDim Bytes() As Byte =     &lt;br /&gt;Enc.GetBytes(Message.ToString)Client.Send(Bytes) &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Send email objClient.Send( &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 107 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a code segment that performs the following tasks: &lt;b&gt;Retrieves the name of each paused service&lt;/b&gt;. &lt;b&gt;Passes&lt;/b&gt; the name to the &lt;b&gt;Add method&lt;/b&gt; of Collection1. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. ManagementObjectSearcher searcher =    &lt;br /&gt;new ManagementObjectSearcher(     &lt;br /&gt;“Select * from Win32_Service where State = ‘Paused’”); foreach (ManagementObject svc in searcher.Get()) {     &lt;br /&gt;Collection1.Add(svc[“DisplayName”]);} &lt;/p&gt;  &lt;p&gt;B. ManagementObjectSearcher searcher =    &lt;br /&gt;new ManagementObjectSearcher( &amp;quot;Select * from Win32_Service&amp;quot;, &amp;quot;State =     &lt;br /&gt;‘Paused’”);foreach (ManagementObject svc in searcher.Get()) { Collection1.Add(svc[“DisplayName”]);} &lt;/p&gt;  &lt;p&gt;C. ManagementObjectSearcher searcher =    &lt;br /&gt;new ManagementObjectSearcher(     &lt;br /&gt;“Select * from Win32_Service”);foreach (ManagemetnObject svc in searcher.Get()) {     &lt;br /&gt;if ((string) svc[&amp;quot;State&amp;quot;] == &amp;quot;'Paused'&amp;quot;) {     &lt;br /&gt;Collection1.Add(svc[“DisplayName”]); }} &lt;/p&gt;  &lt;p&gt;D. ManagementObjectSearcher searcher =    &lt;br /&gt;new ManagementObjectSearcher();searcher.Scope = new    &lt;br /&gt;ManagementScope(“Win32_Service”);foreach (ManagementObject svc in     &lt;br /&gt;searcher.Get()) {     &lt;br /&gt;if ((string)svc[&amp;quot;State&amp;quot;] == &amp;quot;Paused&amp;quot;) {     &lt;br /&gt;Collection1.Add(svc[“DisplayName”]); }} &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – inline T-SQL where State = ‘Paused’ will work&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 108 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a class library that is used by applications in three departments of your company. The library contains a Department class with the following definition. &lt;/p&gt;  &lt;p&gt;public class Department {    &lt;br /&gt;public string name;     &lt;br /&gt;public string manager;     &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;Each application uses a custom &lt;b&gt;configuration section&lt;/b&gt; to store department-specific values in the application configuration file as shown in the following code. &lt;/p&gt;  &lt;p&gt;&amp;lt;Department&amp;gt;    &lt;br /&gt;&amp;lt;name&amp;gt;Hardware&amp;lt;/name&amp;gt;     &lt;br /&gt;&amp;lt;manager&amp;gt;Company&amp;lt;/manager&amp;gt;     &lt;br /&gt;&amp;lt;/Department&amp;gt; &lt;/p&gt;  &lt;p&gt;You need to write a code segment that &lt;b&gt;creates a Department object i&lt;/b&gt;nstance by using the field values retrieved from the application configuration file. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public class deptElement : ConfigurationElement {    &lt;br /&gt;protected override void DeserializeElement(     &lt;br /&gt;XmlReader reader, bool serializeCollectionKey) {     &lt;br /&gt;Department dept = new Department();     &lt;br /&gt;dept.name = ConfigurationManager.AppSettings[“name”];     &lt;br /&gt;dept.manager =     &lt;br /&gt;ConfigurationManager.AppSettings[“manager”];     &lt;br /&gt;return dept; } } &lt;/p&gt;  &lt;p&gt;B. public class deptElement: ConfigurationElement {    &lt;br /&gt;protected override void DeserializeElement(     &lt;br /&gt;XmlReader reader, bool serializeCollectionKey) {     &lt;br /&gt;Department dept = new Department();     &lt;br /&gt;dept.name = reader.GetAttribute(“name”);     &lt;br /&gt;dept.manager = reader.GetAttribute(“manager”); } } &lt;/p&gt;  &lt;p&gt;C. public class deptHandler : IConfigurationSectionHandler {   &lt;br /&gt;public object Create(object parent, object configContext,     &lt;br /&gt;System.Xml.XmlNode section) {     &lt;br /&gt;Department dept = new Department();     &lt;br /&gt;dept.name = section.&lt;b&gt;SelectSingleNode&lt;/b&gt;(“name”).InnerText;     &lt;br /&gt;dept.manager = section.SelectSingleNode(“manager”).InnerText;     &lt;br /&gt;return dept; } } &lt;/p&gt;  &lt;p&gt;D. public class deptHandler : IConfigurationSectionHandler {   &lt;br /&gt;public object Create(object parent, object configContext,     &lt;br /&gt;System.Xml.XmlNode section) {     &lt;br /&gt;Department dept = new Deprtment();     &lt;br /&gt;dept.name = section.Attributes[“name”].Value;     &lt;br /&gt;dept.manager = section.Attributes[“manager”].Value;     &lt;br /&gt;return dept; } } &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – &lt;b&gt;SelectSingleNode &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 109 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a code segment that transfers the &lt;b&gt;first 80 bytes from a stream variable&lt;/b&gt; named stream1 into a new byte array named &lt;b&gt;byteArray&lt;/b&gt;. You also need to ensure that the code segment assigns the number of bytes that are transferred to an integer variable named &lt;b&gt;bytesTransferred&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. bytesTransferred = stream1.Read(byteArray, 0, 80); &lt;/p&gt;  &lt;p&gt;B. for (int i = 0; i &amp;lt; 80; i++) {    &lt;br /&gt;stream1.WriteByte(byteArray[i]);     &lt;br /&gt;bytesTransferred = i;     &lt;br /&gt;if (!stream1.CanWrite) {     &lt;br /&gt;break; }} &lt;/p&gt;  &lt;p&gt;C. while (bytesTransferred &amp;lt; 80) {   &lt;br /&gt;stream1.Seek(1, SeekOrigin.Current);     &lt;br /&gt;byteArray[bytesTransferred++] =     &lt;br /&gt;Convert.ToByte(stream1.ReadByte());} &lt;/p&gt;  &lt;p&gt;D. stream1.Write(byteArray, 0, 80);   &lt;br /&gt;bytesTransferred = byteArray.Length; &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Bytes from stream1 read into byteArray&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 110 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are testing a component that serializes the Meeting class instances so that they can be saved to the file system. The Meeting class has the following definition: public ref &lt;/p&gt;  &lt;p&gt;class Meeting {    &lt;br /&gt;private :     &lt;br /&gt;String^ title;     &lt;br /&gt;public :     &lt;br /&gt;int roomNumber;     &lt;br /&gt;array&amp;lt;String^&amp;gt;^ invitees;     &lt;br /&gt;Meeting(){}     &lt;br /&gt;Meeting(String^ t){     &lt;br /&gt;title = t; } }; &lt;/p&gt;  &lt;p&gt;The component contains a procedure with the following code segment.    &lt;br /&gt;Meeting^ myMeeting = gcnew Meeting(“Goals”); myMeeting-&amp;gt;roomNumber = 1100;     &lt;br /&gt;array&amp;lt;String^&amp;gt;^ attendees = gcnew array&amp;lt;String^&amp;gt;(2)     &lt;br /&gt;{“Company”, “Mary”}; myMeeting-&amp;gt;invitees = attendees;     &lt;br /&gt;XmlSerializer^ xs = gcnew XmlSerializer(__typeof(Meeting));     &lt;br /&gt;StreamWriter^ writer = gcnew StreamWriter(“C:\\Meeting.xml”);     &lt;br /&gt;xs-&amp;gt;Serialize(writer, myMeeting);     &lt;br /&gt;writer-&amp;gt;Close(); &lt;/p&gt;  &lt;p&gt;You need to identify the XML block that is written to the C:\Meeting.xml file as a result of running this procedure. Which &lt;b&gt;XML block represents the content that will be written to the C:\Meeting.xml file&lt;/b&gt;? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;title&amp;gt;Goals&amp;lt;/title&amp;gt;     &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;     &lt;br /&gt;&amp;lt;invitee&amp;gt;Company&amp;lt;/invitee&amp;gt;     &lt;br /&gt;&amp;lt;invitee&amp;gt;Mary&amp;lt;/invitee&amp;gt;     &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;B. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt; |   &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;     &lt;br /&gt;&amp;lt;invitees&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Company&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;/invitees&amp;gt;     &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;C. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;     &lt;br /&gt;title=&amp;quot;Goals&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;     &lt;br /&gt;&amp;lt;invitees&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Company&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;/invitees&amp;gt;     &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;D. &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;    &lt;br /&gt;&amp;lt;Meeting xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;     &lt;br /&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;roomNumber&amp;gt;1100&amp;lt;/roomNumber&amp;gt;     &lt;br /&gt;&amp;lt;invitees&amp;gt;     &lt;br /&gt;&amp;lt;string&amp;gt;Company&amp;lt;/string&amp;gt;     &lt;br /&gt;&amp;lt;/invitees&amp;gt;     &lt;br /&gt;&amp;lt;invitees&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;string&amp;gt;Mary&amp;lt;/string&amp;gt;    &lt;br /&gt;&amp;lt;/invitees&amp;gt;     &lt;br /&gt;&amp;lt;/Meeting&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-1898040065745431976?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-foundations-26.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-7820734687978961488</guid><pubDate>Tue, 25 Aug 2009 01:49:00 +0000</pubDate><atom:updated>2009-08-24T21:49:19.166-04:00</atom:updated><title>70-536 MCTS .NET Foundations #25</title><description>&lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx" target="_blank"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it. &lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx, &lt;/p&gt;  &lt;p&gt;Catto &lt;/p&gt;  &lt;p&gt;Q#80 – Q#99&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 80 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You work as a developer at Company.com. You are developing an application to create a new file on the local file system. &lt;/p&gt;  &lt;p&gt;You need to define specific &lt;b&gt;security settings&lt;/b&gt; for the file. You must &lt;b&gt;deny&lt;/b&gt; the file inheritance of any default security settings.    &lt;br /&gt;What should you do? &lt;/p&gt;  &lt;p&gt;Answer: ?&lt;/p&gt;  &lt;p&gt;K8 – not so good of a question. No answers or answer. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 81 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a class to compare a specially-formatted string. The default collation comparisons do not apply. You need to implement the IComparable(Of String) interface. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Public Class Person &lt;/p&gt;  &lt;p&gt;Implements &lt;b&gt;IComparable&lt;/b&gt;(Of String)Public Function CompareTo(ByVal other As &lt;b&gt;String&lt;/b&gt;) &lt;/p&gt;  &lt;p&gt;As _Integer Implements &lt;b&gt;IComparable&lt;/b&gt;(Of &lt;b&gt;String&lt;/b&gt;).CompareTo...End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;B. Public Class Person &lt;/p&gt;  &lt;p&gt;Implements IComparable(Of String)Public Function CompareTo(ByVal other As Object) &lt;/p&gt;  &lt;p&gt;As _Integer Implements IComparable(Of String).CompareTo...End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;C. Public Class Person &lt;/p&gt;  &lt;p&gt;Implements IComparable(Of String)Public Function CompareTo(ByVal other As String) &lt;/p&gt;  &lt;p&gt;_As Boolean Implements IComparable(Of String).CompareTo...End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;D. Public Class Person &lt;/p&gt;  &lt;p&gt;Implements IComparable(Of String)Public Function CompareTo(ByVal other As Object) &lt;/p&gt;  &lt;p&gt;_As Boolean Implements IComparable(Of String).CompareTo...End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – String &amp;amp; IComparable as int&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 82 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You work as a developer at Company.com. You create a service application that monitors free space on a hard disk drive. You must ensure that the service &lt;b&gt;application runs in the background&lt;/b&gt; and monitors the free space every minute. &lt;/p&gt;  &lt;p&gt;What should you do? &lt;/p&gt;  &lt;p&gt;Answer: &lt;/p&gt;  &lt;p&gt;K8 – Another not so good question no answers&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 83 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a class that performs complex financial calculations. The class contains a method named &lt;b&gt;GetCurrentRate&lt;/b&gt; that retrieves the current interest rate and a variable named &lt;b&gt;currRate&lt;/b&gt; that stores the current interest rate.     &lt;br /&gt;You write &lt;b&gt;serialized&lt;/b&gt; representations of the class. You need to write a code segment that updates the currRate variable with the current interest rate &lt;b&gt;when an instance of the class is deserialized&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. [OnSerializing]internal void UpdateValue (StreamingContext context) { &lt;/p&gt;  &lt;p&gt;currRate = GetCurrentRate();} &lt;/p&gt;  &lt;p&gt;B. [OnSerializing]internal void UpdateValue(SerializationInfo info) { &lt;/p&gt;  &lt;p&gt;info.AddValue(“currentRate”, GetCurrentRate());} &lt;/p&gt;  &lt;p&gt;C. [OnDeserializing]internal void UpdateValue(SerializationInfo info) { &lt;/p&gt;  &lt;p&gt;info.AddValue(“currentRate”, GetCurrentRate());} &lt;/p&gt;  &lt;p&gt;D. [&lt;b&gt;OnDeserialized&lt;/b&gt;]internal void UpdateValue(StreamingContext context) { &lt;/p&gt;  &lt;p&gt;currRate = GetCurrentRate();} &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – question reads when instance of class is deserialized. Answer is &lt;b&gt;OnDeserialized&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 84 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a &lt;b&gt;multicast&lt;/b&gt; d&lt;b&gt;elegate that accepts a DateTime argument. &lt;/b&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Public Delegate Function PowerDeviceOn( _ &lt;/p&gt;  &lt;p&gt;ByVal result As Boolean, _ &lt;/p&gt;  &lt;p&gt;ByVal autoPowerOff As DateTime) _ &lt;/p&gt;  &lt;p&gt;As Integer &lt;/p&gt;  &lt;p&gt;B. Public Delegate Function PowerDeviceOn( _ &lt;/p&gt;  &lt;p&gt;ByVal sender As Object, _ &lt;/p&gt;  &lt;p&gt;ByVal autoPowerOff As EventArgs) _ &lt;/p&gt;  &lt;p&gt;As Boolean &lt;/p&gt;  &lt;p&gt;C. Public Delegate &lt;b&gt;Sub&lt;/b&gt; PowerDeviceOn( _ &lt;/p&gt;  &lt;p&gt;ByVal autoPowerOff As DateTime) &lt;/p&gt;  &lt;p&gt;D. Public Delegate &lt;b&gt;Function&lt;/b&gt; PowerDeviceOn( _ &lt;/p&gt;  &lt;p&gt;ByVal autoPowerOff As DateTime) _ &lt;/p&gt;  &lt;p&gt;As Boolean &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – c is the only Sub not a function isn’t that something? &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 85 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a class library that is used by applications in three departments of your company. The library contains a Department class with the following definition. public &lt;/p&gt;  &lt;p&gt;ref class Department { &lt;/p&gt;  &lt;p&gt;public : &lt;/p&gt;  &lt;p&gt;String^ name; &lt;/p&gt;  &lt;p&gt;String^ manager;}; Each application uses a custom configuration section to store &lt;/p&gt;  &lt;p&gt;department-specific values in the application configuration file as shown in the following &lt;/p&gt;  &lt;p&gt;code. &lt;/p&gt;  &lt;p&gt;&amp;lt;Department&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;name&amp;gt;Hardware&amp;lt;/name&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;manager&amp;gt;Company&amp;lt;/manager&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;/Department&amp;gt; &lt;/p&gt;  &lt;p&gt;You need to write a code segment that creates a Department object instance by using the field values retrieved from the application configuration file. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public ref class deptElement : public ConfigurationElement { &lt;/p&gt;  &lt;p&gt;protected :    &lt;br /&gt;override void DeserializeElement(XmlReader^ reader,     &lt;br /&gt;bool^ serializeCollectionKey) {     &lt;br /&gt;Department^ dept = gcnew Department();     &lt;br /&gt;dept-&amp;gt;name = ConfigurationManager::AppSettings[“name”];     &lt;br /&gt;dept-&amp;gt;manager = ConfigurationManager::AppSettings[“manager”];     &lt;br /&gt;return dept; }}; &lt;/p&gt;  &lt;p&gt;B. public ref class deptElement : public ConfigurationElement {    &lt;br /&gt;protected :     &lt;br /&gt;override void DeserializeElement(XmlReader^ reader,     &lt;br /&gt;bool^ serializeCollectionKey) {     &lt;br /&gt;Department^ dept = gcnew Department();     &lt;br /&gt;dept-&amp;gt;name = reader-&amp;gt;GetAttribute(“name”);     &lt;br /&gt;dept-&amp;gt;manager = reader-&amp;gt;GetAttribute(“manager”); }}; &lt;/p&gt;  &lt;p&gt;C. public ref class deptHandler :    &lt;br /&gt;public &lt;b&gt;IConfigurationSectionHandler&lt;/b&gt; {     &lt;br /&gt;public :     &lt;br /&gt;Object^ Create(Object^ parent, Object^ configContext,     &lt;br /&gt;System.Xml.XmlNode section) {     &lt;br /&gt;Department^ dept = gcnew Department();     &lt;br /&gt;dept-&amp;gt;name = section-&amp;gt;SelectSingleNode(“name”)-&amp;gt;InnerText;     &lt;br /&gt;dept-&amp;gt;manager = section-&amp;gt;SelectSinglenode(“manager”)-&amp;gt;InnerText;     &lt;br /&gt;return dept; }};     &lt;br /&gt;D. public ref class deptHandler : public IConfigurationSectionHandler { &lt;/p&gt;  &lt;p&gt;public :    &lt;br /&gt;Object^ Create(Object^ parent, Object^ configContext,     &lt;br /&gt;System.Xml.XmlNode^ section) {     &lt;br /&gt;Department^ dept = gcnew Department();     &lt;br /&gt;dept-&amp;gt;name = section-&amp;gt;Attributes[“name”].Value;     &lt;br /&gt;dept-&amp;gt;manager = section-&amp;gt;Attributes[“manager”].Value;     &lt;br /&gt;return dept; }}; &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – IconfigurationSectionHandler &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 86 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to read the entire contents of a file named Message.txt into a single string variable. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. String^ result = nullptr;StreamReader^ reader = gcnew &lt;/p&gt;  &lt;p&gt;StreamReader(“Message.txt”);result = reader-&amp;gt;Read().ToString(); &lt;/p&gt;  &lt;p&gt;B. String^ result = nullptr;StreamReader^ reader = gcnew &lt;/p&gt;  &lt;p&gt;StreamReader(“Message.txt”);   &lt;br /&gt;result = reader-&amp;gt;&lt;b&gt;ReadToEnd&lt;/b&gt;(); &lt;/p&gt;  &lt;p&gt;C. String^ result =String::Empty;StreamReader^ reader = gcnew &lt;/p&gt;  &lt;p&gt;StreamReader(“Message.txt”); while (!reader-&amp;gt;EndOfStream) { &lt;/p&gt;  &lt;p&gt;result += reader-&amp;gt;ToString();} &lt;/p&gt;  &lt;p&gt;D. String^ result = nullptr;StreamReader^ reader = gcnew StreamReader(“Message.txt”); result =&lt;/p&gt;  &lt;p&gt;reader-&amp;gt;ReadLine(); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – &lt;b&gt;ReadToEnd &lt;/b&gt;Now that I’ve seen this question a few times it gets easier.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 87 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code to call a function from the Win32 Application Programming Interface (API) by using &lt;b&gt;platform invoke&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;Dim r As Integer = MessageBox(hWnd, strText, strCaption, strType) &lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;define a method prototype&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. &amp;lt;DllImport(&amp;quot;user32&amp;quot;)&amp;gt; _Function &lt;b&gt;MessageBox&lt;/b&gt;( _ &lt;/p&gt;  &lt;p&gt;ByVal hWnd As IntPtr, ByVal text As String, _ &lt;/p&gt;  &lt;p&gt;ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function &lt;/p&gt;  &lt;p&gt;B. &amp;lt;DllImport(&amp;quot;user32&amp;quot;)&amp;gt; _Function MessageBox&lt;b&gt;A&lt;/b&gt;( _ &lt;/p&gt;  &lt;p&gt;ByVal hWnd As IntPtr, ByVal text As String, _ &lt;/p&gt;  &lt;p&gt;ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function &lt;/p&gt;  &lt;p&gt;C. &amp;lt;DllImport(&amp;quot;user32&amp;quot;)&amp;gt; _Function Win32API_User32_MessageBox ( _ &lt;/p&gt;  &lt;p&gt;ByVal hWnd As IntPtr, ByVal text As String, _ &lt;/p&gt;  &lt;p&gt;ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function &lt;/p&gt;  &lt;p&gt;D. &amp;lt;DllImport(&amp;quot;C:\WINDOWS\system32\user32.dll &amp;quot;)&amp;gt; _Function MessageBox( _ &lt;/p&gt;  &lt;p&gt;ByVal hWnd As IntPtr, ByVal text As String, _ &lt;/p&gt;  &lt;p&gt;ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – User32 &amp;amp; function messagebox&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 88 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing an application that uses &lt;b&gt;isolated storage&lt;/b&gt; to store user preferences. The application uses multiple assemblies. Multiple users will use this application on the same &lt;/p&gt;  &lt;p&gt;computer. You need to create a directory named Preferences in the isolated storage area that is scoped to the current &lt;b&gt;Microsoft Windows identity&lt;/b&gt; and assembly. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. IsolatedStorageFile^ store;store = IsolatedStorageFile::&lt;b&gt;GetUserStoreForAssembly&lt;/b&gt;();store-&lt;/p&gt;  &lt;p&gt;&amp;gt;CreateDirectory(“Preferences”); &lt;/p&gt;  &lt;p&gt;B. IsolatedStorageFile^ store;store = &lt;/p&gt;  &lt;p&gt;IsolatedStorageFile::GetMachineStoreForAssembly();store-&amp;gt;CreateDirectory(“Preferences”); &lt;/p&gt;  &lt;p&gt;C. IsolatedStorageFile^ store;store = IsolatedStorageFile::GetUserStoreForDomain();store-&lt;/p&gt;  &lt;p&gt;&amp;gt;CreateDirectory(“Preferences”); &lt;/p&gt;  &lt;p&gt;D. IsolatedStorageFile^ store;store = &lt;/p&gt;  &lt;p&gt;IsolatedStorageFile::GetMachineStoreForApplication();store-&lt;/p&gt;  &lt;p&gt;&amp;gt;CreateDirectory(“Preferences”); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – &lt;b&gt;GetUserStoreForAssembly &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 89 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing an application that uses isolated storage to store user preferences. The application uses multiple assemblies. Multiple users will use this application on the same   &lt;br /&gt;computer. You need to create a directory named Preferences in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. IsolatedStorageFile store;store =&lt;/p&gt;  &lt;p&gt;IsolatedStorageFile.&lt;b&gt;GetUserStoreForAssembly&lt;/b&gt;();store.CreateDirectory(“Preferences”); &lt;/p&gt;  &lt;p&gt;B. IsolatedStorageFile store;store = &lt;/p&gt;  &lt;p&gt;IsolatedStorageFile.GetMachineStoreForAssembly();store.CreateDirectory(“Preferences”); &lt;/p&gt;  &lt;p&gt;C. IsolatedStorageFile store;store = &lt;/p&gt;  &lt;p&gt;IsolatedStorageFile.GetUserStoreForDomain();store.CreateDirectory(“Preferences”); &lt;/p&gt;  &lt;p&gt;D. IsolatedStorageFile store;store = &lt;/p&gt;  &lt;p&gt;IsolatedStorageFile.GetMachineStoreForApplication();store.CreateDirectory(“Preferences”); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 - &lt;b&gt;GetUserStoreForAssembly&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 90 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to call a COM component. You need to use &lt;b&gt;declarative&lt;/b&gt; security to explicitly request the runtime to perform a full stack walk. You must ensure that all callers have the required level of trust for COM interop before the callers execute your method. Which attribute should you place on the method? &lt;/p&gt;  &lt;p&gt;A. [SecurityPermission( &lt;/p&gt;  &lt;p&gt;SecurityAction::&lt;b&gt;Demand&lt;/b&gt;, &lt;/p&gt;  &lt;p&gt;Flags=SecurityPermissionFlag::UnmanagedCode)] &lt;/p&gt;  &lt;p&gt;B. [SecurityPermission( &lt;/p&gt;  &lt;p&gt;SecurityAction::LinkDemand, &lt;/p&gt;  &lt;p&gt;Flags=SecurityPermissionFlag::UnmanagedCode)] &lt;/p&gt;  &lt;p&gt;C. [SecurityPermission( &lt;/p&gt;  &lt;p&gt;SecurityAction::Assert, &lt;/p&gt;  &lt;p&gt;Flags = SecurityPermissionFlag::UnmanagedCode)] &lt;/p&gt;  &lt;p&gt;D. [SecurityPermission( &lt;/p&gt;  &lt;p&gt;SecurityAction::Deny, &lt;/p&gt;  &lt;p&gt;Flags = SecurityPermissionFlag::UnmanagedCode)] &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Demand to ensure all callers have required level of trust&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 91 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are using the Microsoft Visual Studio 2005 IDE to examine the output of a method that returns a string. You assign the output of the method to a string variable named fName. You need to write a code segment that prints the following on a single line The message: &amp;quot;Test Failed: &amp;quot; The value of fName if the value of fName does not equal &amp;quot;Company&amp;quot; You also need to ensure that the code segment simultaneously facilitates uninterrupted execution of the application. Which code    &lt;br /&gt;segment should you use? &lt;/p&gt;  &lt;p&gt;A. Debug::Assert(fName == “Company”, “Test Failed: ”, fName); &lt;/p&gt;  &lt;p&gt;B. Debug::&lt;b&gt;WriteLinelf&lt;/b&gt;(fName != “Company”, fName, “Test Failed”); &lt;/p&gt;  &lt;p&gt;C. if (fName != &amp;quot;Company&amp;quot;) { &lt;/p&gt;  &lt;p&gt;Debug::Print(“Test Failed: ”); &lt;/p&gt;  &lt;p&gt;Debug::Print(fName);} &lt;/p&gt;  &lt;p&gt;D. if (fName != &amp;quot;Company&amp;quot;) { &lt;/p&gt;  &lt;p&gt;Debug::WriteLine(“Test Failed: ”); &lt;/p&gt;  &lt;p&gt;Debug::WriteLine(fName);} &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;&lt;b&gt;K8 - WriteLinelf &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 92 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Your company uses an application named Application1 that was compiled by using the .NET Framework version 1.0. The application currently runs on a shared computer on which the .NET Framework versions 1.0 and 1.1 are installed. You need to move the application to a new computer on which the .NET Framework versions 1.1 and 2.0 are installed. The application is compatible with the .NET Framework 1.1, but it is incompatible with the .NET Framework 2.0. You need to ensure that the application will use the .NET Framework version 1.1 on the new computer. What should you do? &lt;/p&gt;  &lt;p&gt;A. Add the following XML element to the application configuration file. &lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;    &lt;br /&gt;&amp;lt;startup&amp;gt;     &lt;br /&gt;&amp;lt;supportedRuntime version=&amp;quot;1.1.4322&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;startup&amp;gt;     &lt;br /&gt;&amp;lt;/configuration&amp;gt; &lt;/p&gt;  &lt;p&gt;B. Add the following XML element to the application configuration file. &lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;    &lt;br /&gt;&amp;lt;runtime&amp;gt;     &lt;br /&gt;&amp;lt;assemblyBinding xmlns=&amp;quot;urn:schemas-microsoft-com:asm.v1&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;dependentAssembly&amp;gt;     &lt;br /&gt;&amp;lt;assemblyIdentity name=&amp;quot;Application1&amp;quot; publicKeyToken=&amp;quot;32ab4ba45e0a69a1&amp;quot; culture=&amp;quot;neutral&amp;quot; /&amp;gt;    &lt;br /&gt;&amp;lt;bindingRedirect oldVersion=&amp;quot;1.0.3075.0&amp;quot; newVersion=&amp;quot;1.1.4322.0&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;lt;/dependentAssembly&amp;gt;     &lt;br /&gt;&amp;lt;/assemblyBinding&amp;gt;     &lt;br /&gt;&amp;lt;/runtime&amp;gt;     &lt;br /&gt;&amp;lt;/configuration&amp;gt; &lt;/p&gt;  &lt;p&gt;C. Add the following XML element to the machine configuration file. &lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;    &lt;br /&gt;&amp;lt;startup&amp;gt;     &lt;br /&gt;&amp;lt;requiredRuntime version=&amp;quot;1.1.4322&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;startup&amp;gt;     &lt;br /&gt;&amp;lt;/configuration&amp;gt; &lt;/p&gt;  &lt;p&gt;D. Add the following XML element to the machine configuration file. &lt;/p&gt;  &lt;p&gt;&amp;lt;configuration&amp;gt;    &lt;br /&gt;&amp;lt;runtime&amp;gt;     &lt;br /&gt;&amp;lt;assemblyBinding xmlns=&amp;quot;urn:schemas-microsoft-com:asm.v1&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;dependentAssembly&amp;gt;     &lt;br /&gt;&amp;lt;assemblyIdentity name=&amp;quot;Application1&amp;quot;     &lt;br /&gt;publicKeyToken=&amp;quot;32ab4ba45e0a69a1&amp;quot; culture=&amp;quot;neutral&amp;quot; /&amp;gt;    &lt;br /&gt;&amp;lt;bindingRedirect oldVersion=&amp;quot;1.0.3075.0&amp;quot; newVersion=&amp;quot;1.1.4322.0&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;lt;/dependentAssembly&amp;gt;     &lt;br /&gt;&amp;lt;/assemblyBinding&amp;gt;     &lt;br /&gt;&amp;lt;/runtime&amp;gt;     &lt;br /&gt;&amp;lt;/configuration&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – set supportedRuntime version=&amp;quot;1.1.4322&amp;quot;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 93 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are &lt;b&gt;dev&lt;/b&gt;eloping a &lt;b&gt;method&lt;/b&gt; that &lt;b&gt;searches a string&lt;/b&gt; for a substring. The method will be localized to Italy. Your method &lt;b&gt;accepts&lt;/b&gt; the following &lt;b&gt;parameters&lt;/b&gt;: The &lt;b&gt;string&lt;/b&gt; to be searched, which is named &lt;b&gt;searchListThe&lt;/b&gt; &lt;b&gt;string&lt;/b&gt; for which to search, which is named searchValue You need to write the code. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. return searchList-&amp;gt;IndexOf(searchValue); &lt;/p&gt;  &lt;p&gt;B. CompareInfo^ comparer =    &lt;br /&gt;gcnew CultureInfo(“it-IT”)::CompareInfo; return comparer-&amp;gt;Compare(searchList, search Value); &lt;/p&gt;  &lt;p&gt;C. CultureInfo^ comarer = gcnew CultureInfo(“it-IT”);   &lt;br /&gt;if (searchList-&amp;gt;IndexOf(searchValue) &amp;gt; 0) {     &lt;br /&gt;return true;} else {     &lt;br /&gt;return false;} &lt;/p&gt;  &lt;p&gt;D. CompareInfo^ comparer = gcnew CultureInfo(“it-IT”)::CompareInfo;   &lt;br /&gt;if (comparer-&amp;gt;IndexOf(searchList, searchValue) &amp;gt; 0) {     &lt;br /&gt;return true;    &lt;br /&gt;} else {     &lt;br /&gt;return false;} &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Method that searches string for substring CompareInfo IndexOf&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 94 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a code segment that will &lt;b&gt;create&lt;/b&gt; a common language runtime (&lt;b&gt;CLR&lt;/b&gt;) unit of &lt;b&gt;isolation&lt;/b&gt; within an &lt;b&gt;app&lt;/b&gt;lication. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. AppDomainSetup^ mySetup =    &lt;br /&gt;AppDomain::CurrentDomain::SetuupInformation;    &lt;br /&gt;mySetup-&amp;gt;ShadowCopyFiles = “true”; &lt;/p&gt;  &lt;p&gt;B. System::Diagnostics::Process^ myProcess;   &lt;br /&gt;myProcess = gcnew System::Diagnostics::Process(); &lt;/p&gt;  &lt;p&gt;C. AppDomain^ domain;   &lt;br /&gt;domain = AppDomain::CreateDomain(“CompanyDomain”); &lt;/p&gt;  &lt;p&gt;D. System::ComponentModel::Component^ myComponent;   &lt;br /&gt;myComponent = gcnew    &lt;br /&gt;System::ComponentModel::Component(); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – CLR isolation Appdomaion CreateDomain&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 95 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are &lt;b&gt;loading&lt;/b&gt; a new &lt;b&gt;assembly&lt;/b&gt; into an application. You need to override the default evidence for the assembly. You require the common language runtime (&lt;b&gt;CLR&lt;/b&gt;) to grant the assembly a     &lt;br /&gt;permission set, as if the assembly were loaded from the &lt;b&gt;local intranet zone&lt;/b&gt;. You need to build the evidence collection. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Evidence evidence = new Evidence(    &lt;br /&gt;Assembly.GetExecutingAssembly().Evidence ); &lt;/p&gt;  &lt;p&gt;B. Evidence evidence = new Evidence();   &lt;br /&gt;evidence.AddAssembly(new Zone(SecurityZone.Intranet)); &lt;/p&gt;  &lt;p&gt;C. Evidence evidence = new Evidence()   &lt;br /&gt;;evidence.AddHost(new Zone(SecurityZone.Intranet)); &lt;/p&gt;  &lt;p&gt;D. Evidence evidence = new Evidence(    &lt;br /&gt;AppDomain.CurrentDomain.Evidence ); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Loading Assembly use AddHost along with the Zone(SecurityZone.Intranet) &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 96 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a class library that will open the network socket connections to computers on the network. You will deploy the class library to the global assembly cache and grant it full trust. You write the following code to ensure usage of the socket connections.    &lt;br /&gt;SocketPermission permission = new &lt;/p&gt;  &lt;p&gt;SocketPermission(PermissionState.Unrestricted);   &lt;br /&gt;permission.Assert();    &lt;br /&gt;Some of the applications that use the class library might not have the necessary permissions to open the network socket    &lt;br /&gt;connections. You need to &lt;b&gt;cancel the assertion&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. CodeAccessPermission.RevertAssert(); &lt;/p&gt;  &lt;p&gt;B. CodeAccessPermission.RevertDeny(); &lt;/p&gt;  &lt;p&gt;C. permission.Deny(); &lt;/p&gt;  &lt;p&gt;D. permission.PermitOnly(); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 question text Cancel Assertion - Answer RevertAssert();&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 97 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are changing the &lt;b&gt;security settings&lt;/b&gt; of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to &lt;b&gt;prevent the access rules from inheriting changes &lt;/b&gt;in the future. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objSecurity As New FileSecurity( _    &lt;br /&gt;&amp;quot;MyData.xml&amp;quot;, AccessControlSections.All)objSecurity.&lt;b&gt;SetAccessRuleProtection&lt;/b&gt;(True, True)File.&lt;b&gt;SetAccessControl&lt;/b&gt;(&amp;quot;MyData.xml&amp;quot;, objSecurity) &lt;/p&gt;  &lt;p&gt;B. Dim objSecurity As New FileSecurity()objSecurity.SetAccessRuleProtection(True,   &lt;br /&gt;True)File.SetAccessControl(&amp;quot;MyData.xml&amp;quot;, objSecurity) &lt;/p&gt;  &lt;p&gt;C. Dim objSecurity As FileSecurity = _File.GetAccessControl(&amp;quot;MyData.xml&amp;quot;)objSecurity.SetAccessRuleProtection(True, True) &lt;/p&gt;  &lt;p&gt;D. Dim objSecurity As FileSecurity =    &lt;br /&gt;_File.GetAccessControl(&amp;quot;MyData.xml&amp;quot;)objSecurity.SetAuditRuleProtection(True, True)File.SetAccessControl(&amp;quot;myData.xml&amp;quot;, objSecurity) &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Q: &lt;b&gt;prevent the access rules from inheriting changes A: SetAccessRuleProtection &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 98 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You develop a service application named FileService. You deploy the service application to multiple servers on your network. You implement the following code segment. (Line numbers are included for reference only.) &lt;/p&gt;  &lt;p&gt;01 public void StartService(string serverName){ &lt;/p&gt;  &lt;p&gt;02 ServiceController crtl = new &lt;/p&gt;  &lt;p&gt;03 ServiceController(“FileService”); &lt;/p&gt;  &lt;p&gt;04 if (crtl.Status == ServiceControllerStatus.Stopped){ &lt;/p&gt;  &lt;p&gt;05 } &lt;/p&gt;  &lt;p&gt;06 } &lt;/p&gt;  &lt;p&gt;You need to develop a routine that will &lt;b&gt;start FileService if it stops&lt;/b&gt;. The routine must start FileService on the server identified by the serverName input parameter. Which two lines of code should you add to the code segment? (Each correct answer presents part of the solution. Choose two.) &lt;/p&gt;  &lt;p&gt;A. Insert the following line of code between lines 03 and 04:crtl.ServiceName = serverName; &lt;/p&gt;  &lt;p&gt;B. Insert the following line of code between lines 03 and 04:&lt;b&gt;crtl.MachineName = serverName;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;C. Insert the following line of code between lines 03 and 04:crtl.Site.Name = serverName; &lt;/p&gt;  &lt;p&gt;D. Insert the following line of code between lines 04 and 05:crtl.Continue(); &lt;/p&gt;  &lt;p&gt;E. Insert the following line of code between lines 04 and 05:&lt;b&gt;crtl.Start();&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;F. Insert the following line of code between lines 04 and 05:crtl.ExecuteCommand(0); &lt;/p&gt;  &lt;p&gt;Answer: B,E &lt;/p&gt;  &lt;p&gt;Q: need to start if stopped therefore E &amp;amp; &lt;b&gt;MachineName in B will start it on the serverName &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 99 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are using the Microsoft Visual Studio 2005 IDE to examine the output of a method that returns a string. You assign the output of the method to a string variable named fName. You need to write a code segment that prints the following on a single line The message: &amp;quot;Test Failed: &amp;quot; The value of fName if the value of fName does not equal &amp;quot;Company&amp;quot; You also need to ensure that the code segment simultaneously facilitates uninterrupted execution of the application. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Debug.Assert(fName = &amp;quot;Company&amp;quot;, &amp;quot;Test Failed: &amp;quot;, fName) &lt;/p&gt;  &lt;p&gt;B. Debug.WriteLineIf(fName &amp;lt;&amp;gt; &amp;quot;Company&amp;quot;, _ fName, &amp;quot;Test Failed&amp;quot;) &lt;/p&gt;  &lt;p&gt;C. If fName &amp;lt;&amp;gt; &amp;quot;Company&amp;quot; Then    &lt;br /&gt;Debug.Print(&amp;quot;Test Failed: &amp;quot;)     &lt;br /&gt;Debug.Print(fName)End If &lt;/p&gt;  &lt;p&gt;D. If fName &amp;lt;&amp;gt; &amp;quot;Company&amp;quot; Then    &lt;br /&gt;Debug.WriteLine(&amp;quot;Test Failed: &amp;quot;)     &lt;br /&gt;Debug.WriteLine(fName)End If &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – WriteLineIf prints the message if&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-7820734687978961488?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-foundations-25.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-4804465966439366177</guid><pubDate>Mon, 24 Aug 2009 00:22:00 +0000</pubDate><atom:updated>2009-08-23T20:22:42.966-04:00</atom:updated><title>70-536 MCTS .NET Sample Questions #24</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hey Now, &lt;/p&gt;  &lt;p&gt;Please feel free to &lt;a href="http://www.chriscatto.com/public/70-536.aspx" target="_blank"&gt;check out my MCTS 70-536 reference page on Chris Catto.com.&lt;/a&gt; It’s a page with a summary of all of my posts.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet &amp;amp; not sure the answers are correct. There were over 200 questions &amp;amp; some duplicates, I hope to study all of them. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx, &lt;/p&gt;  &lt;p&gt;Catto &lt;/p&gt;  &lt;p&gt;Q#60 – Q#79&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 60 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a &lt;b&gt;strong-named assembly&lt;/b&gt; named Company1 that will be used in multiple applications. Company1 will be rebuilt frequently during the development cycle. You need to ensure that each time the assembly is rebuilt it works correctly with each application that uses it. You need to &lt;b&gt;configure the computer on which you develop&lt;/b&gt; Company1 such that each application uses the latest build of Company1. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) &lt;/p&gt;  &lt;p&gt;A. Create a &lt;b&gt;DEVPATH environment variable&lt;/b&gt; that &lt;b&gt;points to the build &lt;/b&gt;output directory for the strong-named assembly. &lt;/p&gt;  &lt;p&gt;B. Add the following XML element to the machine configuration file: &lt;/p&gt;  &lt;p&gt;&amp;lt;developmentMode developerInstallation=&amp;quot;true&amp;quot;/&amp;gt; &lt;/p&gt;  &lt;p&gt;C. Add the following XML element to the machine configuration file: &lt;/p&gt;  &lt;p&gt;&amp;lt;dependentAssembly&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;assemblyIdentity name=&amp;quot;Company1&amp;quot; &lt;/p&gt;  &lt;p&gt;publicKeyToken=&amp;quot;32ab4ba45e0a69a1&amp;quot; &lt;/p&gt;  &lt;p&gt;language=&amp;quot;en-US&amp;quot; version=&amp;quot;*.*.*.*&amp;quot; /&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;publisherPolicy apply=&amp;quot;no&amp;quot; /&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;/dependentAssembly&amp;gt; &lt;/p&gt;  &lt;p&gt;D. Add the following XML element to the configuration file of each application that uses the&lt;/p&gt;  &lt;p&gt;strong-named assembly: &lt;/p&gt;  &lt;p&gt;&amp;lt;supportedRuntime version=&amp;quot;*.*.*.*&amp;quot; /&amp;gt; &lt;/p&gt;  &lt;p&gt;E. Add the following XML element to the configuration file of each application that uses the&lt;/p&gt;  &lt;p&gt;strong-named assembly: &lt;/p&gt;  &lt;p&gt;&amp;lt;dependentAssembly&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;assemblyIdentity name=&amp;quot;Company1&amp;quot; &lt;/p&gt;  &lt;p&gt;publicKeyToken=&amp;quot;32ab4ba45e0a69a1&amp;quot; &lt;/p&gt;  &lt;p&gt;language=&amp;quot;en-US&amp;quot; version=&amp;quot;*.*.*.*&amp;quot; /&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;bindingRedirect newVersion=&amp;quot;*.*.*.*&amp;quot;/&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;/dependentAssembly&amp;gt; &lt;/p&gt;  &lt;p&gt;Answer: A, B &lt;/p&gt;  &lt;p&gt;K8 – developerInstallation = true &amp;amp; create a devpath to point to build.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 61 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a &lt;b&gt;class&lt;/b&gt; to &lt;b&gt;compare a specially-formatted string&lt;/b&gt;. The default collation comparisons do not apply. You need to implement the &lt;b&gt;IComparable&lt;/b&gt;&amp;lt;string&amp;gt; interface. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public ref class Person : public IComparable&amp;lt;String^&amp;gt;{ &lt;/p&gt;  &lt;p&gt;public : virtual &lt;b&gt;Int32&lt;/b&gt; CompareTo(&lt;b&gt;String&lt;/b&gt;^ other){ &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;B. public ref class Person : public IComparable&amp;lt;String^&amp;gt;{ &lt;/p&gt;  &lt;p&gt;public : virtual Int32 CompareTo(Object^ other){ &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;C. public ref class Person : public IComparable&amp;lt;String^&amp;gt;{ &lt;/p&gt;  &lt;p&gt;public : virtual Boolean CompareTo(String^ other){ &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;D. public ref class Person : public IComparable&amp;lt;String^&amp;gt;{ &lt;/p&gt;  &lt;p&gt;public : virtual Boolean CompareTo(Object^ other){ &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – use &lt;b&gt;Int32&lt;/b&gt; &amp;amp; CompareTo &lt;b&gt;String&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 62 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to hash data for later verification by using the &lt;b&gt;MD5&lt;/b&gt; algorithm. The data is passed to your method as a &lt;b&gt;byte&lt;/b&gt; array named &lt;b&gt;message&lt;/b&gt;. You need to &lt;b&gt;compute the hash of the incoming parameter by using MD5&lt;/b&gt;. You also need to place the &lt;b&gt;result into a byte array&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objAlgo As HashAlgorithm = HashAlgorithm.Create(&amp;quot;MD5&amp;quot;)&lt;/p&gt;  &lt;p&gt;Dim hash() As Byte = objAlgo.ComputeHash(message) &lt;/p&gt;  &lt;p&gt;B. Dim objAlgo As HashAlgorithm = HashAlgorithm.Create(&amp;quot;MD5&amp;quot;)   &lt;br /&gt;Dim hash() As Byte = BitConverter.GetBytes(objAlgo.GetHashCode) &lt;/p&gt;  &lt;p&gt;C. Dim objAlgo As HashAlgorithmobjAlgo = &lt;/p&gt;  &lt;p&gt;HashAlgorithm.Create(message.ToString)   &lt;br /&gt;Dim hash() As Byte = objAlgo.Hash &lt;/p&gt;  &lt;p&gt;D. Dim objAlgo As HashAlgorithm = HashAlgorithm.Create(&amp;quot;MD5&amp;quot;)   &lt;br /&gt;Dim hash() As &lt;/p&gt;  &lt;p&gt;ByteobjAlgo.TransformBlock(message, 0, message.Length, hash, 0) &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – toss c out &amp;amp; ComputeHash is important method too.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 63 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following custom exception class named CustomException. &lt;/p&gt;  &lt;p&gt;Public Class CustomException &lt;/p&gt;  &lt;p&gt;Inherits ApplicationException &lt;/p&gt;  &lt;p&gt;Public Shared COR_E_ARGUMENT As Int32 = &amp;amp;H80070057 &lt;/p&gt;  &lt;p&gt;Public Sub New(ByVal strMessage As String) &lt;/p&gt;  &lt;p&gt;MyBase.New(strMessage) &lt;/p&gt;  &lt;p&gt;HResult = COR_E_ARGUMENT &lt;/p&gt;  &lt;p&gt;End SubEnd Class &lt;/p&gt;  &lt;p&gt;You need to write a code segment that will use the &lt;b&gt;CustomException&lt;/b&gt; class to &lt;b&gt;immediately return control&lt;/b&gt; to the COM caller. You also need to ensure that the &lt;b&gt;caller has access&lt;/b&gt; to the &lt;b&gt;error code.&lt;/b&gt; Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Return Marshal.GetExceptionForHR( _ &lt;/p&gt;  &lt;p&gt;CustomException.COR_E_ARGUMENT) &lt;/p&gt;  &lt;p&gt;B. Return CustomException.COR_E_ARGUMENT &lt;/p&gt;  &lt;p&gt;C. Marshal.ThrowExceptionForHR( _ &lt;/p&gt;  &lt;p&gt;CustomException.COR_E_ARGUMENT) &lt;/p&gt;  &lt;p&gt;D. Throw New CustomException(&amp;quot;Argument is out of bounds&amp;quot;) &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 Throw an exeption so the control will go to the COM&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 64 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to return the contents of an isolated storage file as a string. The file is machine-scoped and is named Settings.dat. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. IsolatedStorageFileStream^ isoStream;isoStream = gcnew IsolatedStorageFileStream( &lt;/p&gt;  &lt;p&gt;“Settings.dat”, FileMode::Open); String^ result = (gcnew StreamReader(isoStream))-&lt;/p&gt;  &lt;p&gt;&amp;gt;ReadToEnd(); &lt;/p&gt;  &lt;p&gt;B. IsolatedStorageFile^ isoFile;&lt;/p&gt;  &lt;p&gt;isoFile = IsolatedStorageFile::GetMachineStoreForAssembly(); &lt;/p&gt;  &lt;p&gt;IsolatedStorageFileStream^ isoStream;isoStream = gcnew IsolatedStorageFileStream( &lt;/p&gt;  &lt;p&gt;“Settings.dat”, FileMode::Open, &lt;b&gt;isoFile&lt;/b&gt;); String^ result = (gcnew StreamReader(isoStream))-&lt;/p&gt;  &lt;p&gt;&amp;gt;&lt;b&gt;ReadToEnd&lt;/b&gt;(); &lt;/p&gt;  &lt;p&gt;C. IsolatedStorageFileStream^ isoStream;isoStream = gcnew IsolatedStorageFileStream( &lt;/p&gt;  &lt;p&gt;“Settings.dat”, FileMode::Open);String^ result = isoStream-&amp;gt;ToString(); &lt;/p&gt;  &lt;p&gt;D. IsolatedStorageFile^ isoFile;isoFile = IsolatedStorageFile::GetMachineStoreForAssemblly(); &lt;/p&gt;  &lt;p&gt;IsolatedStorageFileStream^ isoStream;isoStream = gcnew IsolatedStorageFileStream( &lt;/p&gt;  &lt;p&gt;“Settings.dat”, FileMode::Open, isoFile); String^ result = isoStream-&amp;gt;ToString(); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 65 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a fiscal report for a customer. Your customer has a main office in the United States and a satellite office in Mexico. You need to ensure that when users in the satellite office generate the report, &lt;b&gt;the current date is displayed in Mexican Spanish&lt;/b&gt; format. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim DTFormat As DateTimeFormatInfo = _ &lt;/p&gt;  &lt;p&gt;New CultureInfo(&amp;quot;es-MX&amp;quot;, False).DateTimeFormat&lt;/p&gt;  &lt;p&gt;Dim DT As New DateTime( _ &lt;/p&gt;  &lt;p&gt;DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day)Dim strDate As &lt;/p&gt;  &lt;p&gt;String = _ &lt;/p&gt;  &lt;p&gt;DT.ToString(DTFormat.LongDatePattern) &lt;/p&gt;  &lt;p&gt;B. Dim objCalendar As Calendar = _ &lt;/p&gt;  &lt;p&gt;New CultureInfo(&amp;quot;es-MX&amp;quot;, False).CalendarDim DT As New DateTime( _ &lt;/p&gt;  &lt;p&gt;DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day)Dim strDate As &lt;/p&gt;  &lt;p&gt;String = DT.ToString &lt;/p&gt;  &lt;p&gt;C. Dim strDate As String = _ &lt;/p&gt;  &lt;p&gt;DateTimeFormatInfo.CurrentInfo.GetMonthName( _ &lt;/p&gt;  &lt;p&gt;DateTime.Today.Month) &lt;/p&gt;  &lt;p&gt;D. Dim strDate As String = _ &lt;/p&gt;  &lt;p&gt;DateTime.Today.Month.ToString(&amp;quot;es-MX&amp;quot;) &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 - DateTimeFormat&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 66 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are defining a class named CompanyClass that contains several child objects. CompanyClass contains a method named ProcessChildren that performs actions on the child objects. CompanyClass objects will be &lt;b&gt;serializable&lt;/b&gt;. You need to ensure that the ProcessChildren &lt;b&gt;method is executed after the CompanyClass object&lt;/b&gt; and all its child objects are reconstructed. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) &lt;/p&gt;  &lt;p&gt;A. Apply the &lt;b&gt;OnDeserializing&lt;/b&gt; attribute to the ProcessChildren method. &lt;/p&gt;  &lt;p&gt;B. Specify that CompanyClass implements the &lt;b&gt;IDeserializationCallback&lt;/b&gt; interface. &lt;/p&gt;  &lt;p&gt;C. Specify that CompanyClass inherits from the ObjectManager class. &lt;/p&gt;  &lt;p&gt;D. Apply the &lt;b&gt;OnSerialized&lt;/b&gt; attribute to the ProcessChildren method. &lt;/p&gt;  &lt;p&gt;E. Create a GetObjectData method that calls ProcessChildren. &lt;/p&gt;  &lt;p&gt;F. Create an &lt;b&gt;OnDeserialization&lt;/b&gt; method that calls ProcessChildren. &lt;/p&gt;  &lt;p&gt;Answer: B, F &lt;/p&gt;  &lt;p&gt;K8 – Key words in question ‘executed after the class object’ &lt;b&gt;OnDeserialization &amp;amp; IDeserializationCallback&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 67 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to create a method &lt;b&gt;to clear a Queue&lt;/b&gt; named q. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. for each (Object^ e in q) { &lt;/p&gt;  &lt;p&gt;q.Dequeue();} &lt;/p&gt;  &lt;p&gt;B. for each (Object^ e in q) { &lt;/p&gt;  &lt;p&gt;q.Enqueue(0);} &lt;/p&gt;  &lt;p&gt;C. q.Clear(); &lt;/p&gt;  &lt;p&gt;D. q.Dequeue(); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – I think 87 year old Granny could get this one right&lt;/p&gt;  &lt;p&gt;Question: 71 &lt;/p&gt;  &lt;p&gt;You need to create a method to clear a Queue named q. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim e As ObjectFor Each e In qq.Dequeue()Next &lt;/p&gt;  &lt;p&gt;B. Dim e As ObjectFor Each e In qq.Enqueue(Nothing)Next &lt;/p&gt;  &lt;p&gt;C. q.Clear() &lt;/p&gt;  &lt;p&gt;D. q.Dequeue() &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question&lt;/b&gt;: 68 &lt;/p&gt;  &lt;p&gt;You need to write a code segment that transfers the first 80 bytes from a stream variable named stream1 into a new byte array named byteArray. You also need to ensure that the code segment assigns the number of bytes that are transferred to an integer variable named bytesTransferred. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. bytesTransferred = stream1-&amp;gt;&lt;b&gt;Read&lt;/b&gt;(byteArray, 0, 80); &lt;/p&gt;  &lt;p&gt;B. for(int i = 0; i &amp;lt; 80; i++){ &lt;/p&gt;  &lt;p&gt;stream1-&amp;gt;WriteByte(byteArray[i]); &lt;/p&gt;  &lt;p&gt;bytesTransferred = i; &lt;/p&gt;  &lt;p&gt;if (!stream1-&amp;gt;CanWrite) { &lt;/p&gt;  &lt;p&gt;break; &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;C. while (bytesTransferred &amp;lt; 80) { &lt;/p&gt;  &lt;p&gt;stream1-&amp;gt;Seek(1, SeekOrigin::Current); &lt;/p&gt;  &lt;p&gt;byteArray[bytesTransferred++] = &lt;/p&gt;  &lt;p&gt;Convert::ToByte(stream1-&amp;gt;ReadByte());} &lt;/p&gt;  &lt;p&gt;D. stream1-&amp;gt;Write(byteArray, 0, 80);bytesTransferred = byteArray-&amp;gt;Length; &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Read(byteArray, 0, 80); is the syntax&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 69 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application that &lt;b&gt;dynamically loads&lt;/b&gt; assemblies from an application directory. You need to write a code segment that loads an assembly named Company1.dll into the current application domain. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. AppDomain domain = AppDomain.CurrentDomain;   &lt;br /&gt;string myPath = Path.Combine(domain.BaseDirectory, &lt;/p&gt;  &lt;p&gt;“Company1.dll”);   &lt;br /&gt;Assembly asm = Assembly.&lt;b&gt;LoadFrom&lt;/b&gt;(myPath); &lt;/p&gt;  &lt;p&gt;B. AppDomain domain = AppDomain.CurrentDomain;   &lt;br /&gt;string myPath = &lt;/p&gt;  &lt;p&gt;Path.Combine(domain.BaseDirectory, “Company1.dll”);   &lt;br /&gt;Assembly asm = Assembly.Load(myPath); &lt;/p&gt;  &lt;p&gt;C. AppDomain domain = AppDomain.CurrentDomain;string myPath =&lt;/p&gt;  &lt;p&gt;Path.Combine(domain.DynamicDirectory, “Company1.dll”);Assembly asm =&lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomain.Load(myPath); &lt;/p&gt;  &lt;p&gt;D. AppDomain domain = AppDomain.CurrentDomain;Assembly asm =&lt;/p&gt;  &lt;p&gt;domain.GetData(“Company1.dll”); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Load From is important in this question&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 70 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application that will &lt;b&gt;use custom authentication and role-based security&lt;/b&gt;. You need to write a code segment to make &lt;b&gt;the runtime assign an unauthenticated principal object to each running thread&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objDomain As AppDomain = &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomainobjDomain.SetPrincipalPolicy( _ &lt;/p&gt;  &lt;p&gt;&lt;b&gt;PrincipalPolicy&lt;/b&gt;.&lt;b&gt;WindowsPrincipal&lt;/b&gt;) &lt;/p&gt;  &lt;p&gt;B. Dim objDomain As AppDomain = &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomainobjDomain.SetThreadPrincipal(New &lt;/p&gt;  &lt;p&gt;&lt;b&gt;WindowsPrincipal&lt;/b&gt;(Nothing)) &lt;/p&gt;  &lt;p&gt;C. Dim objDomain As AppDomain = &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomainobjDomain.SetAppDomainPolicy( _ &lt;/p&gt;  &lt;p&gt;PolicyLevel.&lt;b&gt;CreateAppDomainLevel&lt;/b&gt;()) &lt;/p&gt;  &lt;p&gt;D. Dim objDomain As AppDomain = &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomainobjDomain.SetPrincipalPolicy( _ &lt;/p&gt;  &lt;p&gt;&lt;b&gt;PrincipalPolicy&lt;/b&gt;.&lt;b&gt;UnauthenticatedPrincipal&lt;/b&gt;) &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – (&lt;b&gt;PrincipalPolicy&lt;/b&gt;.&lt;b&gt;UnauthenticatedPrincipal&lt;/b&gt;)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 72 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You develop a service application that needs to be deployed. Your network administrator creates a specific user account for your service application. You need to &lt;b&gt;configure&lt;/b&gt; your service &lt;b&gt;app&lt;/b&gt;lication &lt;b&gt;to run in the context of this specific user account&lt;/b&gt;. What should you do? &lt;/p&gt;  &lt;p&gt;A. Prior to installation, set the StartType property of the ServiceInstaller class. &lt;/p&gt;  &lt;p&gt;B. Prior to installation, set the Account, Username, and Password properties of the &lt;b&gt;ServiceProcessInstaller&lt;/b&gt; class. &lt;/p&gt;  &lt;p&gt;C. Use the CONFIG option of the net.exe command-line tool to install the service. &lt;/p&gt;  &lt;p&gt;D. Use the installutil.exe command-line tool to install the service. &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – &lt;b&gt;ServiceProcessInstaller class when run app as user &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 73 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to create a class definition that is interoperable along with COM. You need to ensure that &lt;b&gt;COM applications can create instances &lt;/b&gt;of the class and can call the GetAddress method. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Public Class Customer    &lt;br /&gt;Private m_AddressString As String     &lt;br /&gt;Public Sub New(&lt;b&gt;ByVal Address As String&lt;/b&gt;)     &lt;br /&gt;m_AddressString = Address     &lt;br /&gt;End Sub &lt;/p&gt;  &lt;p&gt;Public Function GetAddress() As String    &lt;br /&gt;Return m_AddressString     &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;B. Public Class Customer    &lt;br /&gt;&lt;b&gt;Shared&lt;/b&gt; m_AddressString As String     &lt;br /&gt;Public Sub New()     &lt;br /&gt;End Sub     &lt;br /&gt;&lt;b&gt;Public&lt;/b&gt; Shared Function GetAddress() As String     &lt;br /&gt;Return m_AddressString     &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;C. Public Class Customer    &lt;br /&gt;Private m_AddressString As String     &lt;br /&gt;Public Sub New()     &lt;br /&gt;End Sub     &lt;br /&gt;&lt;b&gt;Public&lt;/b&gt; Function GetAddress() As String     &lt;br /&gt;Return m_AddressString     &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;D. Public Class Customer    &lt;br /&gt;Private m_AddressString As String     &lt;br /&gt;Public Sub New()     &lt;br /&gt;End Sub     &lt;br /&gt;&lt;b&gt;Private&lt;/b&gt; Function GetAddress() As String     &lt;br /&gt;Return m_AddressString     &lt;br /&gt;End FunctionEnd Class &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – GetAddress should be Public&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 74 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a new &lt;b&gt;security policy &lt;/b&gt;for an application domain. You write the following lines of code.     &lt;br /&gt;Dim objPolicy As PolicyLevel = PolicyLevel.CreateAppDomainLevelDim &lt;/p&gt;  &lt;p&gt;noTrustStatement As New PolicyStatement( _ &lt;/p&gt;  &lt;p&gt;objPolicy.GetNamedPermissionSet(&amp;quot;Nothing&amp;quot;)) &lt;/p&gt;  &lt;p&gt;Dim fullTrustStatement As New PolicyStatement( _ &lt;/p&gt;  &lt;p&gt;objPolicy.GetNamedPermissionSet(&amp;quot;&lt;b&gt;FullTrust&lt;/b&gt;&amp;quot;)) &lt;/p&gt;  &lt;p&gt;You need to arrange code groups for the policy so that loaded assemblies default to the Nothing permission set. If the assembly originates from a trusted zone, the security policy must grant the assembly the FullTrust permission set. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objGroup1 As CodeGroup = New FirstMatchCodeGroup(    &lt;br /&gt;_ New ZoneMembershipCondition(SecurityZone.Trusted), _ &lt;/p&gt;  &lt;p&gt;fullTrustStatement)   &lt;br /&gt;Dim objGroup2 As CodeGroup = New UnionCodeGroup( _ &lt;/p&gt;  &lt;p&gt;New AllMembershipCondition, noTrustStatement) &lt;/p&gt;  &lt;p&gt;B. Dim objGroup1 As CodeGroup = New &lt;b&gt;FirstMatchCodeGroup&lt;/b&gt;( _ New &lt;b&gt;AllMembershipCondition&lt;/b&gt;, noTrustStatement)    &lt;br /&gt;Dim objGroup2 As CodeGroup = New UnionCodeGroup( _ &lt;/p&gt;  &lt;p&gt;New ZoneMembershipCondition(&lt;b&gt;SecurityZone.Trusted&lt;/b&gt;), _     &lt;br /&gt;fullTrustStatement) &lt;/p&gt;  &lt;p&gt;C. Dim objGroup As CodeGroup = New &lt;b&gt;UnionCodeGroup&lt;/b&gt;( _     &lt;br /&gt;New ZoneMembershipCondition(SecurityZone.Trusted), _     &lt;br /&gt;fullTrustStatement) &lt;/p&gt;  &lt;p&gt;D. Dim objGroup As CodeGroup = New &lt;b&gt;FirstMatchCodeGroup&lt;/b&gt;( _     &lt;br /&gt;New ZoneMembershipCondition(SecurityZone.Trusted), _     &lt;br /&gt;fullTrustStatement) &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – &lt;b&gt;AllMembershipCondition &amp;amp; SecurityZone.Trusted&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 75 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are loading a new assembly into an application. You need to override the default evidence for the assembly. You require the common language runtime (CLR) to grant the assembly a &lt;/p&gt;  &lt;p&gt;&lt;b&gt;permission set&lt;/b&gt;, as if the assembly were loaded from &lt;b&gt;the local intranet zone&lt;/b&gt;. You need to build the evidence collection. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Evidence^ evidence = gcnew &lt;/p&gt;  &lt;p&gt;Evidence(Assembly::GetExecutingAssembly()-&amp;gt;Evidence); &lt;/p&gt;  &lt;p&gt;B. Evidence^ evidence = gcnew Evidence();   &lt;br /&gt;evidence-&amp;gt;AddAssembly(gcnew Zone(SecurityZone::Intranet)); &lt;/p&gt;  &lt;p&gt;C. Evidence^ evidence = gcnew Evidence();   &lt;br /&gt;evidence-&amp;gt;AddHost(gcnew Zone(&lt;b&gt;SecurityZone::Intranet&lt;/b&gt;)); &lt;/p&gt;  &lt;p&gt;D. Evidence^ evidence = gcnew Evidence(AppDomain::CurrentDomain-&amp;gt;Evidence); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Question states internet security zone &lt;b&gt;SecurityZone::Intranet&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 76 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;read the entire contents of a file named Message.txt&lt;/b&gt; into a single &lt;b&gt;string&lt;/b&gt; variable. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. string result = null;StreamReader reader = new StreamReader(“Message.txt”);result =&lt;/p&gt;  &lt;p&gt;reader.Read().ToString(); &lt;/p&gt;  &lt;p&gt;B. string result = null;   &lt;br /&gt;StreamReader reader = new StreamReader(“Message.txt”);    &lt;br /&gt;result = reader.&lt;b&gt;ReadToEnd&lt;/b&gt;(); &lt;/p&gt;  &lt;p&gt;C. string result = string.Empty;StreamReader reader = new StreamReader(“Message.txt”);    &lt;br /&gt;while&lt;/p&gt;  &lt;p&gt;(!reader.EndOfStream) { &lt;/p&gt;  &lt;p&gt;result += reader.ToString();} &lt;/p&gt;  &lt;p&gt;D. string result = null;StreamReader reader = new StreamReader(“Message.txt”);result =&lt;/p&gt;  &lt;p&gt;reader.ReadLine(); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – ReadToEnd works to read the entire file. Toss D out readline won’t get entire file&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 77 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to generate a report that &lt;b&gt;lists language codes and region codes. &lt;/b&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. For Each objCulture As CultureInfo In &lt;/p&gt;  &lt;p&gt;_CultureInfo.GetCultures(CultureTypes .&lt;b&gt;SpecificCultures&lt;/b&gt;) &lt;/p&gt;  &lt;p&gt;...Next &lt;/p&gt;  &lt;p&gt;B. Dim objCulture As New CultureInfo(&amp;quot;&amp;quot;)Dim objTypes As CultureTypes = objCulture.CultureTypes ... &lt;/p&gt;  &lt;p&gt;C. For Each objCulture As CultureInfo In &lt;/p&gt;  &lt;p&gt;_CultureInfo.GetCultures(CultureTypes.NeutralCultures) &lt;/p&gt;  &lt;p&gt;...Next &lt;/p&gt;  &lt;p&gt;D. For Each objCulture As CultureInfo In &lt;/p&gt;  &lt;p&gt;_CultureInfo.GetCultures(CultureTypes.ReplacementCultures) &lt;/p&gt;  &lt;p&gt;...Next &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – &lt;b&gt;SpecificCultures is needed &amp;amp; loop till we get them all.&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 78 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a &lt;b&gt;class library&lt;/b&gt; that will open the network &lt;b&gt;socket connections&lt;/b&gt; to computers on the network. You will deploy the class library to the global assembly cache and grant it &lt;b&gt;full trust&lt;/b&gt;. You write the following code to ensure usage of the socket connections. &lt;/p&gt;  &lt;p&gt;Dim objPermission As SocketPermission = New &lt;/p&gt;  &lt;p&gt;_SocketPermission(System.Security.Permissions.PermissionState.Unrestricted)objPermission.As&lt;/p&gt;  &lt;p&gt;sert() &lt;/p&gt;  &lt;p&gt;Some of the applications that use the class library might not have the necessary &lt;/p&gt;  &lt;p&gt;permissions to open the network socket connections. &lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;cancel the assertion&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. CodeAccessPermission.&lt;b&gt;RevertAssert&lt;/b&gt;() &lt;/p&gt;  &lt;p&gt;B. CodeAccessPermission.RevertDeny() &lt;/p&gt;  &lt;p&gt;C. objPermission.Deny() &lt;/p&gt;  &lt;p&gt;D. objPermission.PermitOnly() &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Cancel the assertion – doesn’t RevertAssert() fit like a glove? &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 79 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing an application that uses SOAP to exchange data with other applications. You use a Department class that inherits from ArrayList to send objects to another application.   &lt;br /&gt;The Department object is named dept. You need to ensure that the application &lt;b&gt;serializes&lt;/b&gt; the Department object for transport by using SOAP. Which code should you use? &lt;/p&gt;  &lt;p&gt;A. Dim formatter As New SoapFormatter()Dim buffer As Byte() = New &lt;/p&gt;  &lt;p&gt;Byte(dept.Capacity) {}Dim myStream As New MemoryStream(buffer) Dim o As &lt;/p&gt;  &lt;p&gt;ObjectFor Each o In dept &lt;/p&gt;  &lt;p&gt;formatter.Serialize(myStream, &lt;b&gt;o&lt;/b&gt;)Next &lt;/p&gt;  &lt;p&gt;B. Dim formatter As New SoapFormatter()   &lt;br /&gt;Dim &lt;b&gt;buffer As Byte&lt;/b&gt;() = New Byte(dept.Capacity)Dim myStream As New &lt;/p&gt;  &lt;p&gt;MemoryStream(buffer)formatter.Serialize(myStream, dept) &lt;/p&gt;  &lt;p&gt;C. Dim formatter As New SoapFormatter()Dim myStream As New MemoryStream()Dim &lt;/p&gt;  &lt;p&gt;o as ObjectFor Each o In dept &lt;/p&gt;  &lt;p&gt;formatter.Serialize(myStream, o)Next &lt;/p&gt;  &lt;p&gt;D. Dim formatter As New SoapFormatter()   &lt;br /&gt;Dim &lt;b&gt;myStream &lt;/b&gt;As New &lt;/p&gt;  &lt;p&gt;MemoryStream()formatter.Serialize(myStream, &lt;b&gt;dept&lt;/b&gt;) &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – for the serialize the object name dept is needed.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-4804465966439366177?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-sample-questions-24.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-2058775157094276961</guid><pubDate>Sun, 23 Aug 2009 17:34:00 +0000</pubDate><atom:updated>2009-08-23T13:34:50.922-04:00</atom:updated><title>70-536 MCTS .NET Sample Questions #23</title><description>&lt;p&gt;Hey Now,&lt;/p&gt;  &lt;p&gt;Please feel free to check out my &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;MCTS 70-536 reference page on Chris Catto.com. It’s a page with a summary of all of my posts&lt;/a&gt;.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.ChrisCatto.com"&gt;Catto&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Q#51 – Q#59 &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 51 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to create a dynamic assembly named MyAssembly. You also need to &lt;b&gt;save&lt;/b&gt; the assembly to disk. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. AssemblyName myAssemblyName = &lt;/p&gt;  &lt;p&gt;new AssemblyName();myAssemblyName.Name = “MyAssembly”;AssemblyBuilder &lt;/p&gt;  &lt;p&gt;myAssemblyBuilder = &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomain.DefineDynamicAssembly &lt;/p&gt;  &lt;p&gt;(myAssemblyName, &lt;/p&gt;  &lt;p&gt;AssemblyBuilderAccess.Run);myAssemblyBuilder.Save(“MyAssembly.dll”); &lt;/p&gt;  &lt;p&gt;B. AssemblyName myAssemblyName = &lt;/p&gt;  &lt;p&gt;new AssemblyName();myAssemblyName.Name = “MyAssembly”;AssemblyBuilder &lt;/p&gt;  &lt;p&gt;myAssemblyBuilder = &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomain.DefineDynamicAssembly &lt;/p&gt;  &lt;p&gt;(myAssemblyName, &lt;/p&gt;  &lt;p&gt;AssemblyBulderAccess.&lt;b&gt;Save&lt;/b&gt;);myAssemblyBuilder.Save(“MyAssembly.dll”); &lt;/p&gt;  &lt;p&gt;C. AssemblyName myAssemblyName = &lt;/p&gt;  &lt;p&gt;new AssemblyName();AssemblyBuilder myAssemblyBuilder = &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomain.DefineDynamicAssembly &lt;/p&gt;  &lt;p&gt;(myAssemblyName, &lt;/p&gt;  &lt;p&gt;AssemblyBuilderAccess.RunAndSave);myAssemblyBuilder.Save(“MyAssembly.dll”); &lt;/p&gt;  &lt;p&gt;D. AssemblyName myAssemblyName = &lt;/p&gt;  &lt;p&gt;new AssemblyName(“MyAssembly”);AssemblyBuilder myAssemblyBuilder = &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomain.DefineDynamicAssembly &lt;/p&gt;  &lt;p&gt;(myAssemblyName, &lt;/p&gt;  &lt;p&gt;AssemblyBuilderAccess.Save);myAs semblyBuilder.Save(“c:\\MyAssembly.dll”); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - myAssemblyBuilder.Save is needed&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 52 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to call an unmanaged function from your managed code by using &lt;b&gt;platform invoke &lt;/b&gt;services. What should you do? &lt;/p&gt;  &lt;p&gt;A. &lt;b&gt;Create&lt;/b&gt; a class to hold DLL functions and then create prototype methods by using managed code. &lt;/p&gt;  &lt;p&gt;B. Register your assembly by using COM and then reference your managed code from COM. &lt;/p&gt;  &lt;p&gt;C. Export a type library for your managed code. &lt;/p&gt;  &lt;p&gt;D. Import a type library as an assembly and then create instances of COM object. &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Create a class, in the question pinvoke is stated so DLL is in answer.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 53 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a class library that will open the network socket connections to computers on the network. You will deploy the class library to the &lt;b&gt;G&lt;/b&gt;lobal &lt;b&gt;Assembly&lt;/b&gt; &lt;b&gt;C&lt;/b&gt;ache and grant it &lt;b&gt;full trust.&lt;/b&gt; You write the following code to ensure usage of the socket connections. &lt;/p&gt;  &lt;p&gt;SocketPermission^ permission = &lt;/p&gt;  &lt;p&gt;gcnew SocketPermission(PermissionState::Unrestricted);permission-&amp;gt;Assert(); Some of the &lt;/p&gt;  &lt;p&gt;applications that use the class library might not have the necessary permissions to open the &lt;/p&gt;  &lt;p&gt;network socket connections. &lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;cancel the assertion&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. CodeAccessPermission::RevertAssert(); &lt;/p&gt;  &lt;p&gt;B. CodeAccessPermission::RevertDeny(); &lt;/p&gt;  &lt;p&gt;C. permission-&amp;gt;Deny(); &lt;/p&gt;  &lt;p&gt;D. permission-&amp;gt;PermitOnly(); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 - CodeAccessPermission &amp;amp; ReverAssert()&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 54 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to identify a type that meets the following criteria: &lt;/p&gt;  &lt;p&gt;Is always a number. &lt;/p&gt;  &lt;p&gt;Is &lt;b&gt;not greater than 65,535&lt;/b&gt;. Which type should you choose? &lt;/p&gt;  &lt;p&gt;A. System.UInt16 &lt;/p&gt;  &lt;p&gt;B. int &lt;/p&gt;  &lt;p&gt;C. System.String &lt;/p&gt;  &lt;p&gt;D. System.IntPtr &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 - UInt16 is the type that meets the required. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 55 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing code for user authentication and authorization. The username, password, and roles are stored in your application data store. You need to establish a user security context that will be used for authorization checks such as IsInRole. You write the following code segment to authorize the user. &lt;/p&gt;  &lt;p&gt;if (!TestPassword(userName, password)) &lt;/p&gt;  &lt;p&gt;throw new Exception(“could not authenticate user”);String[] userRolesArray = &lt;/p&gt;  &lt;p&gt;LookupUserRoles(userName); &lt;/p&gt;  &lt;p&gt;You need to complete this code so that it establishes the user security context. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. GenericIdentity ident = new GenericIdentity(userName);&lt;/p&gt;  &lt;p&gt;GenericPrincipal currentUser = new &lt;/p&gt;  &lt;p&gt;GenericPrincipal(ident, userRolesArray);Thread.CurrentPrincipal = currentUser; &lt;/p&gt;  &lt;p&gt;B. WindowsIdentity ident = new WindowsIdentity(userName);WindowsPrincipal currentUser = &lt;/p&gt;  &lt;p&gt;new WindowsPrincipal(ident);Thread.CurrentPrincipal = currentUser; &lt;/p&gt;  &lt;p&gt;C. NTAccount userNTName = new NTAccount(userName);GenericIdentity ident = new &lt;/p&gt;  &lt;p&gt;GenericIdentity(userNTName.Value);GenericPrincipal currentUser= new &lt;/p&gt;  &lt;p&gt;GenericPrincipal(ident, userRolesArray);Thread.CurrentPrincipal = currentUser; &lt;/p&gt;  &lt;p&gt;D. IntPtr token = IntPtr.Zero;token = LogonUserUsingInterop(username, &lt;/p&gt;  &lt;p&gt;encryptedPassword);WindowsImpersonationContext ctx = &lt;/p&gt;  &lt;p&gt;WindowsIdentity.Impersonate(token); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – GenericIdentity&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 56 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application for a client residing in Hong Kong. You need to &lt;b&gt;display negative currency values by using a minus sign&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. NumberFormatInfo culture = new CultureInfo(“zh-HK”).NumberFormat; &lt;/p&gt;  &lt;p&gt;culture.NumberNegativePattern = 1; return numberToPrint.ToString(“C”, culture); &lt;/p&gt;  &lt;p&gt;B. NumberFormatInfo culture = new CultureInfo(“zh-HK”).NumberFormat; &lt;/p&gt;  &lt;p&gt;culture.&lt;b&gt;CurrencyNegativePattern&lt;/b&gt; = 1; return numberToPrint.ToString(“C”, culture); &lt;/p&gt;  &lt;p&gt;C. CultureInfo culture = new CultureInfo(“zh-HK”);return numberToPrint.ToString(“-(0)”, culture); &lt;/p&gt;  &lt;p&gt;D. CultureInfo culture = new CultureInfo(“zh-HK”); return numberToPrint.ToString(“()”, culture); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Cultureinfo &amp;amp; CurrencyNegativePattern &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 57 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application that will perform mathematical calculations. You need to ensure that the application is able to perform &lt;b&gt;multiple calculations&lt;/b&gt; simultaneously. &lt;/p&gt;  &lt;p&gt;What should you do? &lt;/p&gt;  &lt;p&gt;A. Set the IdealProcessor property of the ProcessThread object. &lt;/p&gt;  &lt;p&gt;B. Set the ProcessorAffinity property of the ProcessThread object. &lt;/p&gt;  &lt;p&gt;C. For each calculation, call the QueueUserWorkItem method of the ThreadPool class. &lt;/p&gt;  &lt;p&gt;D. Set the Process.GetCurrentProcess().BasePriority property to High. &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – QueueUserWorkItem of Thead pool for multiple simultaneous Calculations. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 58 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You develop a service application named PollingService that periodically calls long-running procedures. These procedures are called from the DoWork method. You use the following service application code. &lt;/p&gt;  &lt;p&gt;ref class PollingService : public ServiceBase { &lt;/p&gt;  &lt;p&gt;public : &lt;/p&gt;  &lt;p&gt;static bool blnExit = false; &lt;/p&gt;  &lt;p&gt;protected : &lt;/p&gt;  &lt;p&gt;override void OnStart(String^ args) { &lt;/p&gt;  &lt;p&gt;do { &lt;/p&gt;  &lt;p&gt;DoWork(); &lt;/p&gt;  &lt;p&gt;} while (!blnExit); &lt;/p&gt;  &lt;p&gt;} &lt;/p&gt;  &lt;p&gt;override void OnStop() { &lt;/p&gt;  &lt;p&gt;blnExit = true; &lt;/p&gt;  &lt;p&gt;} &lt;/p&gt;  &lt;p&gt;private : &lt;/p&gt;  &lt;p&gt;void DoWork() {} }; &lt;/p&gt;  &lt;p&gt;When you attempt to start the service, you receive the following error message: Could not start the PollingService service on the local computer. Error 1053: The &lt;b&gt;service did not respond to the start or control request&lt;/b&gt; in a timely fashion. You need to modify the service application code so that the &lt;b&gt;service starts&lt;/b&gt; properly. What should you do? &lt;/p&gt;  &lt;p&gt;A. Move the loop code into the constructor of the service class from the OnStart method. &lt;/p&gt;  &lt;p&gt;B. Drag a timer component onto the design surface of the service. Move the calls to the long-running procedure from the OnStart method into the Tick event procedure of the timer, set the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method. &lt;/p&gt;  &lt;p&gt;C. Add a class-level &lt;b&gt;System.Timers.Timer&lt;/b&gt; variable to the service class code. Move the call to the DoWork method into the Elapsed event procedure of the timer, set the &lt;b&gt;Enabled property of the timer to True&lt;/b&gt;, and &lt;b&gt;call the Start method&lt;/b&gt; of the timer in the OnStart method. &lt;/p&gt;  &lt;p&gt;D. Move the loop code from the OnStart method into the DoWork method. &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – System.Timers.Timer var &amp;amp; set enabled property to true &amp;amp; call start method. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 59 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating an assembly named Company1. Company1 contains a public method. The global cache contains a second assembly named Company2. You must ensure that the public method is only called from Company2. Which &lt;b&gt;permission class&lt;/b&gt; should you use? &lt;/p&gt;  &lt;p&gt;A. GacIdentityPermission &lt;/p&gt;  &lt;p&gt;B. PublisherIdentityPermission &lt;/p&gt;  &lt;p&gt;C. DataProtectionPermission &lt;/p&gt;  &lt;p&gt;D. StrongNameIdentityPermission &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Good Old StrongNameIdentityPermission class&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-2058775157094276961?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-sample-questions-23.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-744698454111750739</guid><pubDate>Sun, 23 Aug 2009 02:14:00 +0000</pubDate><atom:updated>2009-08-22T22:14:38.328-04:00</atom:updated><title>70-536 MCTS .NET Sample Questions #22</title><description>&lt;p&gt;Hey Now,&lt;/p&gt;  &lt;p&gt;Please feel free to check out my &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;MCTS 70-536 reference page on Chris Catto.com. It’s a page with a summary of all of my posts&lt;/a&gt;.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. &lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.ChrisCatto.com" target="_blank"&gt;Catto&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Q#33 – Q#50 &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 33 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application that receives events &lt;b&gt;asynchronously&lt;/b&gt;. You create a &lt;b&gt;WqlEventQuery&lt;/b&gt; &lt;b&gt;instance&lt;/b&gt; to specify the events and event conditions to which the application must respond. You also create a &lt;b&gt;ManagementEventWatcher&lt;/b&gt; &lt;b&gt;instance&lt;/b&gt; to subscribe to events matching the query. You need to identify the other actions you must perform before the application can receive events &lt;b&gt;asynchronously&lt;/b&gt;. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) &lt;/p&gt;  &lt;p&gt;A. Start listening for events by calling the &lt;b&gt;Start method&lt;/b&gt; of the &lt;b&gt;ManagementEventWatcher&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;B. Set up a listener for events by using the &lt;b&gt;EventArrived&lt;/b&gt; &lt;b&gt;event&lt;/b&gt; of the &lt;b&gt;ManagementEventWatcher&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;C. Use the WaitForNextEvent method of the ManagementEventWatcher to wait for the events. &lt;/p&gt;  &lt;p&gt;D. Create an event handler class that has a method that receives an ObjectReadyEventArgs&lt;/p&gt;  &lt;p&gt;parameter. &lt;/p&gt;  &lt;p&gt;E. Set up a listener for events by using the Stopped event of the ManagementEventWatcher. &lt;/p&gt;  &lt;p&gt;Answer: A, B &lt;/p&gt;  &lt;p&gt;K8 – Start &amp;amp; EventArrived of ManagementEventWatcher&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 34 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a code segment that &lt;b&gt;transfers&lt;/b&gt; the contents of a &lt;b&gt;byte array&lt;/b&gt; named dataToSend by using a &lt;b&gt;NetworkStream&lt;/b&gt; &lt;b&gt;object&lt;/b&gt; named netStream. You need to use a cache of size &lt;b&gt;8,192&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;bytes. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. MemoryStream^ memStream = gcnew &lt;/p&gt;  &lt;p&gt;MemoryStream(8192);memStream-&amp;gt;Write(dataToSend, 0, (int) netStream-&amp;gt;Length); &lt;/p&gt;  &lt;p&gt;B. MemoryStream^ memStream = gcnew &lt;/p&gt;  &lt;p&gt;MemoryStream(8192);netStream-&amp;gt;Write(dataToSend, 0, (int) memStream-&amp;gt;Length); &lt;/p&gt;  &lt;p&gt;C. &lt;b&gt;BufferedStream&lt;/b&gt;^ bufStream = &lt;/p&gt;  &lt;p&gt;gcnew BufferedStream(netStream, 8192);bufStream-&amp;gt;Write(dataToSend, 0, dataToSend- &amp;gt;Length); &lt;/p&gt;  &lt;p&gt;D. BufferedStream^ bufStream = &lt;/p&gt;  &lt;p&gt;gcnew BufferedStream(netStream);bufStream-&amp;gt;Write(dataToSend, 0, 8192); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – BufferedStream not Memory Stream C is correct Syntax&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 35 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a method to &lt;b&gt;compress&lt;/b&gt; an array of bytes. The array is passed to the method in a parameter named document. You need to compress the incoming array of bytes and return &lt;b&gt;the result as an array&lt;/b&gt; of bytes. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. MemoryStream strm = new MemoryStream(document);&lt;/p&gt;  &lt;p&gt;B. DeflateStream deflate = new DeflateStream(strm, &lt;/p&gt;  &lt;p&gt;CompressionMode.Compress); byte[] result = new byte[document.Length];deflate.Write(result,&lt;/p&gt;  &lt;p&gt;0, result.Length); return result; &lt;/p&gt;  &lt;p&gt;B. MemoryStream strm = new MemoryStream(document);&lt;/p&gt;  &lt;p&gt;DeflateStream deflate = new &lt;/p&gt;  &lt;p&gt;DeflateStream(strm, &lt;/p&gt;  &lt;p&gt;CompressionMode.Comress);deflate.Write(docemtn, 0,&lt;/p&gt;  &lt;p&gt;document.Length);deflate.Close();return strm.ToArray(); &lt;/p&gt;  &lt;p&gt;C. MemoryStream strm = new MemoryStream();&lt;/p&gt;  &lt;p&gt;DeflateStream deflate = new &lt;/p&gt;  &lt;p&gt;DeflateStream(strm, CompressionMode.Compress);deflate.Write(decument, 0,&lt;/p&gt;  &lt;p&gt;decument.Length);deflate.Close();return strm.ToArray(); &lt;/p&gt;  &lt;p&gt;D. MemoryStream inStream = new MemoryStream(document);&lt;/p&gt;  &lt;p&gt;DeflateStream deflate =&lt;/p&gt;  &lt;p&gt;new DeflateStream(inStream, CompressionMode.Compress); MemoryStream outStream =&lt;/p&gt;  &lt;p&gt;new MemoryStream();int b;while ((b = deflate.ReadByte()) ! = -1) { &lt;/p&gt;  &lt;p&gt;outStream.WriteByte((byte)b);} return outStream.ToArray(); &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 - MemoryStream();&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 36 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to select a class that is optimized for &lt;b&gt;key-based item&lt;/b&gt; retrieval from &lt;b&gt;both small and large collections&lt;/b&gt;. Which class should you choose? &lt;/p&gt;  &lt;p&gt;A. OrderedDictionary class &lt;/p&gt;  &lt;p&gt;B. HybridDictionary class &lt;/p&gt;  &lt;p&gt;C. ListDictionary class &lt;/p&gt;  &lt;p&gt;D. Hashtable class &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Key Based Items Large &amp;amp; small collections HybridDictionary Class.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 37&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing an application that uses SOAP to exchange data with other applications. You use a Department class that inherits from ArrayList to send objects to another application. &lt;/p&gt;  &lt;p&gt;The Department object is named dept. You need to ensure that the application &lt;b&gt;serializes&lt;/b&gt; the Department object for transport by using SOAP. Which code should you use? &lt;/p&gt;  &lt;p&gt;A. SoapFormatter formatter = new SoapFormatter();byte[] buffer = new&lt;/p&gt;  &lt;p&gt;byte[dept.Capacity];MemoryStream stream = new MemoryStream(buffer);&lt;/p&gt;  &lt;p&gt;foreach &lt;/p&gt;  &lt;p&gt;(object o in dept) { &lt;/p&gt;  &lt;p&gt;formatter.Serialize(stream, o);} &lt;/p&gt;  &lt;p&gt;B. SoapFormatter formatter = new SoapFormatter();byte[] buffer = new&lt;/p&gt;  &lt;p&gt;byte[dept.Capacity];MemoryStream stream = new MemoryStream(buffer);&lt;/p&gt;  &lt;p&gt;formatter.Serialize(stream, dept); &lt;/p&gt;  &lt;p&gt;C. SoapFormatter formatter = new SoapFormatter();MemoryStream stream = new&lt;/p&gt;  &lt;p&gt;MemoryStream();&lt;/p&gt;  &lt;p&gt;foreach (object o in dept) { &lt;/p&gt;  &lt;p&gt;Formatter.Serialize(stream, o);} &lt;/p&gt;  &lt;p&gt;D. SoapFormatter formatter = new SoapFormatter();&lt;/p&gt;  &lt;p&gt;&lt;b&gt;MemoryStream&lt;/b&gt; stream = new&lt;/p&gt;  &lt;p&gt;MemoryStream(); formatter.Serialize(&lt;b&gt;stream&lt;/b&gt;, &lt;b&gt;dept&lt;/b&gt;); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 Need MemorySteam &amp;amp; dept / class name in the Serialize parameters. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 38 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a class library that contains the class hierarchy defined in the following code segment. (Line numbers are included for reference only.) &lt;/p&gt;  &lt;p&gt;01. public ref class Employee {&lt;/p&gt;  &lt;p&gt;02.03. public : 04. &lt;/p&gt;  &lt;p&gt;String^ Name;05. };06.07. public ref class Manager : public Employee {08.09. &lt;/p&gt;  &lt;p&gt;public :10. &lt;/p&gt;  &lt;p&gt;int Level;11. };12.13. public ref class Group {&lt;/p&gt;  &lt;p&gt;14.15. public : 16. array&amp;lt;Employee^&amp;gt;^ &lt;/p&gt;  &lt;p&gt;Employees;17. };&lt;/p&gt;  &lt;p&gt;You create an instance of the Group class. You populate the fields of the instance. When you attempt to serialize the instance by using the Serialize method of the XmlSerializer class, you receive InvalidOperationException. You also receive the following error message: &amp;quot;There was an error generating the XML document.&amp;quot; You need to modify the code segment so that you can successfully &lt;b&gt;serialize instances&lt;/b&gt; of the Group class by using the &lt;b&gt;XmlSerializer&lt;/b&gt; class. You also need to ensure that the XML output contains an element for &lt;b&gt;all public fields&lt;/b&gt; in the class hierarchy. What should you do? &lt;/p&gt;  &lt;p&gt;A. Insert the following code between lines 14 and 15 of the code segment: &lt;/p&gt;  &lt;p&gt;[XmlArrayItem(Type = __typeof(Employee))] &lt;/p&gt;  &lt;p&gt;[XmlArrayItem(Type = __typeof(Manager))] &lt;/p&gt;  &lt;p&gt;B. Insert the following code between lines 14 and 15 of the code segment: &lt;/p&gt;  &lt;p&gt;[XmlElement(Type = __typeof(Employees))] &lt;/p&gt;  &lt;p&gt;C. Insert the following code between lines 14 and 15 of the code segment: &lt;/p&gt;  &lt;p&gt;[XmlArray(ElementName=&amp;quot;Employees&amp;quot;)] &lt;/p&gt;  &lt;p&gt;D. Insert the following code between lines 3 and 4 of the code segment: &lt;/p&gt;  &lt;p&gt;[XmlElement(Type = __typeof(Employee))] &lt;/p&gt;  &lt;p&gt;andInsert the following code segment between lines 8 and 9 of the code segment: &lt;/p&gt;  &lt;p&gt;[XmlElement(Type = __typeof(Manager))] &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 XmlArrayItem &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 39 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to write a code segment that performs the following tasks: &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Retrieves&lt;/b&gt; the &lt;b&gt;name of each paused service&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Passes the name to the Add method&lt;/b&gt; of Collection1. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim searcher As ManagementObjectSearcher = _New ManagementObjectSearcher( _ &lt;/p&gt;  &lt;p&gt;&amp;quot;Select * from Win32_Service where State = 'Paused'&amp;quot;)For Each svc As &lt;/p&gt;  &lt;p&gt;ManagementObject In searcher.Get() &lt;/p&gt;  &lt;p&gt;Collection1.Add(svc(&amp;quot;DisplayName&amp;quot;))Next &lt;/p&gt;  &lt;p&gt;B. Dim searcher As ManagementObjectSearcher = _New ManagementObjectSearcher ( _ &lt;/p&gt;  &lt;p&gt;&amp;quot;Select * from Win32_Service&amp;quot;, &amp;quot;State = 'Paused'&amp;quot;)For Each svc As ManagementObject &lt;/p&gt;  &lt;p&gt;In searcher.Get() &lt;/p&gt;  &lt;p&gt;Collection1.Add(svc(&amp;quot;DisplayName&amp;quot;))Next &lt;/p&gt;  &lt;p&gt;C. Dim searcher As ManagementObjectSearcher = _ New ManagementObjectSearcher( _ &lt;/p&gt;  &lt;p&gt;&amp;quot;Select * from Win32_Service&amp;quot;)For Each svc As ManagementObject In searcher.Get() &lt;/p&gt;  &lt;p&gt;If svc(&amp;quot;State&amp;quot;).ToString() = &amp;quot;'Paused'&amp;quot; Then &lt;/p&gt;  &lt;p&gt;Collection1.Add(svc(&amp;quot;DisplayName&amp;quot;)) &lt;/p&gt;  &lt;p&gt;End IfNext &lt;/p&gt;  &lt;p&gt;D. Dim searcher As New ManagementObjectSearcher()searcher.Scope = New &lt;/p&gt;  &lt;p&gt;ManagementScope(&amp;quot;Win32_Service&amp;quot;)For Each svc As ManagementObject In &lt;/p&gt;  &lt;p&gt;searcher.Get() &lt;/p&gt;  &lt;p&gt;If svc(&amp;quot;State&amp;quot;).ToString() = &amp;quot;Paused&amp;quot; Then &lt;/p&gt;  &lt;p&gt;Collection1.Add(svc(&amp;quot;DisplayName&amp;quot;)) &lt;/p&gt;  &lt;p&gt;End IfNext &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 need the where clause to select all the ‘paused’ &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 40 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a &lt;b&gt;method that accepts a string&lt;/b&gt; parameter named message. Your method must break the message parameter into individual lines of text and pass each line to a second method named Process. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim reader As New &lt;/p&gt;  &lt;p&gt;StringReader(message)ProcessMessage(reader.ReadToEnd())reader.Close() &lt;/p&gt;  &lt;p&gt;B. Dim reader As New StringReader(message)&lt;/p&gt;  &lt;p&gt;While reader.Peek() &amp;lt;&amp;gt; -1 &lt;/p&gt;  &lt;p&gt;Dim line as String = reader.Read().ToString() &lt;/p&gt;  &lt;p&gt;ProcessMessage(line)End Whilereader.Close() &lt;/p&gt;  &lt;p&gt;C. Dim reader As New &lt;/p&gt;  &lt;p&gt;StringReader(message)ProcessMessage(reader.ToString())reader.Close() &lt;/p&gt;  &lt;p&gt;D. Dim reader As New StringReader(message)While reader.&lt;b&gt;Peek&lt;/b&gt;() &amp;lt;&amp;gt; -1 &lt;/p&gt;  &lt;p&gt;ProcessMessage(reader.ReadLine())End Whilereader.Close() &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – Need the reader.Peek to find the blank space to break &amp;amp; reader.ReadLine() Looks like A &amp;amp; C can be tossed out. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 41 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to create a class definition that is interoperable along with COM. You need to ensure that COM applications can create instances of the class and can &lt;b&gt;call the GetAddress&lt;/b&gt; method. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public class Customer { &lt;/p&gt;  &lt;p&gt;string addressString; &lt;/p&gt;  &lt;p&gt;public Customer(&lt;b&gt;string address&lt;/b&gt;) { addressString = address; } &lt;/p&gt;  &lt;p&gt;public string GetAddress() { return addressString; }} &lt;/p&gt;  &lt;p&gt;B. public class Customer { &lt;/p&gt;  &lt;p&gt;static string addressString; &lt;/p&gt;  &lt;p&gt;public Customer() { } &lt;/p&gt;  &lt;p&gt;public static string GetAddress() { return addressString; }} &lt;/p&gt;  &lt;p&gt;C. public class Customer { &lt;/p&gt;  &lt;p&gt;string addressString; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;public Customer()&lt;/b&gt; { } &lt;/p&gt;  &lt;p&gt;public string GetAddress() { return addressString; }} &lt;/p&gt;  &lt;p&gt;D. public class Customer { &lt;/p&gt;  &lt;p&gt;string addressString; &lt;/p&gt;  &lt;p&gt;public Customer() { } &lt;/p&gt;  &lt;p&gt;&lt;b&gt;internal&lt;/b&gt; string GetAddress() { return addressString; }} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – B can be tossed out with static String adressString; D can be out with the syntax internal string &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 42 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a class that performs complex financial calculations. The class contains a method named GetCurrentRate that &lt;b&gt;retrieves&lt;/b&gt; the &lt;b&gt;current interest&lt;/b&gt; rate and a variable named &lt;b&gt;currRate&lt;/b&gt; that stores the current interest rate. You write &lt;b&gt;serialized representations&lt;/b&gt; of the class. You need to write a code segment that &lt;b&gt;updates the currRate&lt;/b&gt; variable with the current interest rate &lt;b&gt;when an instance of the class is deserialized. &lt;/b&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. [OnSerializing]void UpdateValue (StreamingContext^ context) { &lt;/p&gt;  &lt;p&gt;currRate = GetCurrentRate();} &lt;/p&gt;  &lt;p&gt;B. [OnSerializing]void UpdateValue(SerializationInfo^ info) { &lt;/p&gt;  &lt;p&gt;info-&amp;gt;AddValue(“currentRate”, GetCurrentRate());} &lt;/p&gt;  &lt;p&gt;C. [OnDeserializing]void UpdateValue(SerializationInfo^ info) { &lt;/p&gt;  &lt;p&gt;info-&amp;gt;AddValue(“currentRate”, GetCurrentRate());} &lt;/p&gt;  &lt;p&gt;D. [&lt;b&gt;OnDeserialized&lt;/b&gt;]void UpdateValue(StreamingContext^ context) { currRate = GetCurrentRate();} &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 – in question states &lt;b&gt;when an instance of the class is deserialized. Therefore we use OnDeserialized. &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 43 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a class library. Portions of your code need to access system environment variables. You need to force a &lt;b&gt;runtime SecurityException&lt;/b&gt; only when callers that are higher in the call stack &lt;b&gt;do not hav&lt;/b&gt;e the necessary &lt;b&gt;permissions&lt;/b&gt;. Which call method should you use? &lt;/p&gt;  &lt;p&gt;A. set.Demand(); &lt;/p&gt;  &lt;p&gt;B. set.Assert(); &lt;/p&gt;  &lt;p&gt;C. set.PermitOnly(); &lt;/p&gt;  &lt;p&gt;D. set.Deny(); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 Demand first thought was deny&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 44 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a fiscal report for a customer. Your customer has a main office in the United States and a satellite office in Mexico. You need to ensure that when users in the satellite office generate the report, &lt;b&gt;the current date is displayed in Mexican Spanish format&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. CultureInfo^ culture = gcnew CultureInfo(“es-MX”, false);DateTimeFormatInfo^ dtfi = culture-&lt;/p&gt;  &lt;p&gt;&amp;gt;DateTimeFormat;DateTime^ dt = gcnew DateTime(DateTime::Today::Year, &lt;/p&gt;  &lt;p&gt;DateTime::Today::Month, DateTime::Today::Day);String^ dateString = dt-&amp;gt;ToString(dtfi- &lt;/p&gt;  &lt;p&gt;&amp;gt;LongDatePattern); &lt;/p&gt;  &lt;p&gt;B. Calendar^ cal = gcnew CultureInfo(“es-MX”, false)::Calendar; DateTime^dt = gcnew&lt;/p&gt;  &lt;p&gt;DateTime(DateTime::Today::Year, DateTime::Today::Month, DateTime::Today::Day);&lt;/p&gt;  &lt;p&gt;String^dateString = dt-&amp;gt; ToString(); &lt;/p&gt;  &lt;p&gt;C. String^ dateString =&lt;/p&gt;  &lt;p&gt;DateTimeFormatInfo::CurrentInfo::GetMonthName(DateTime::Today::Month); &lt;/p&gt;  &lt;p&gt;D. String^ dateString = DateTime::Today::Month::ToString(“es-MX”); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – need cultureinfo right&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 45 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create an application that stores information about your customers who reside in various regions. You are developing internal utilities for this application. You need to gather regional information about your customers in Canada. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. for each (CultureInfo^ culture in &lt;/p&gt;  &lt;p&gt;CultureInfo::GetCultures(CultureTypes::SpecificCultures)) { &lt;/p&gt;  &lt;p&gt;// Output the region information...} &lt;/p&gt;  &lt;p&gt;B. CultureInfo^ cultureInfo = gcnew CultureInfo(“CA”); &lt;/p&gt;  &lt;p&gt;// Output the region information... &lt;/p&gt;  &lt;p&gt;C. RegionInfo^ regionInfo = gcnew RegionInfo(“CA &lt;/p&gt;  &lt;p&gt;// Output the region information... &lt;/p&gt;  &lt;p&gt;D. RegionInfo^ regionInfo = gcnew RegionInfo(“”);if(regionInfo-&amp;gt;Name == “CA”){ &lt;/p&gt;  &lt;p&gt;// Output the region information...} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 Region is more specific &amp;amp; is needed for CA nada&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 46 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to generate a report that lists language codes and region codes. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. for each (CultureInfo^ culture in &lt;/p&gt;  &lt;p&gt;CultureInfo::GetCultures(CultureTypes::SpecificCultures)) { &lt;/p&gt;  &lt;p&gt;// Output the culture information...} &lt;/p&gt;  &lt;p&gt;B. CultureInfo^ culture = gcnew CultureInfo(“”); CultureTypes^ types = culture-&amp;gt;CultureTypes; &lt;/p&gt;  &lt;p&gt;// Output the culture information... &lt;/p&gt;  &lt;p&gt;C. for each (CultureInfo^ culture in &lt;/p&gt;  &lt;p&gt;CultureInfo::GetCultures(CultureTypes::NeutralCultures)) { &lt;/p&gt;  &lt;p&gt;// Output the culture information...} &lt;/p&gt;  &lt;p&gt;D. for each (CultureInfo^ culture in &lt;/p&gt;  &lt;p&gt;CultureInfo::GetCultures(CultureTypes::ReplacementCultures)) { &lt;/p&gt;  &lt;p&gt;// Output the culture information...} &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – just reading answers B can be tossed out since no loop; CultureTypes::SpecificCultures is needed &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 47 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to hash data with the Secure Hash Algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using &lt;b&gt;SHA1&lt;/b&gt;. You also need to place the &lt;b&gt;result into a byte array&lt;/b&gt; named hash. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. SHA1 sha = new SHA1CryptoServiceProvider();byte[] hash =&lt;/p&gt;  &lt;p&gt;null;sha.TransformBlock(message, 0, message.Length, hash, 0); &lt;/p&gt;  &lt;p&gt;B. SHA1 sha = new SHA1CryptoServiceProvider();byte[] hash =&lt;/p&gt;  &lt;p&gt;BitConverter.GetBytes(sha.GetHashCode()); &lt;/p&gt;  &lt;p&gt;C. SHA1 sha = new SHA1CryptoServiceProvider();byte[] hash = &lt;b&gt;sha.ComputeHash(message);&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;D. SHA1 sha = new SHA1CryptoServiceProvider();sha.GetHashCode();byte[] hash = sha.Hash; &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 - ComputeHash method&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 48 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a method to hash data for later verification by using the &lt;b&gt;MD5&lt;/b&gt; algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using MD5. You also need to place the result into a byte array. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. HashAlgorithm algo = HashAlgorithm.Create(“MD5”);byte[] hash =&lt;/p&gt;  &lt;p&gt;algo.&lt;b&gt;ComputeHash&lt;/b&gt;(message); &lt;/p&gt;  &lt;p&gt;B. HashAlgorithm algo = HashAlgorithm.Create(“MD5”);byte[] hash =&lt;/p&gt;  &lt;p&gt;BitConverter.GetBytes(algo.GetHashCode()); &lt;/p&gt;  &lt;p&gt;C. HashAlgorithm algo;algo = HashAlgorithm.Create(message.ToString());byte[] hash =&lt;/p&gt;  &lt;p&gt;algo.Hash; &lt;/p&gt;  &lt;p&gt;D. HashAlgorithm algo = HashAlgorithm.Create(“MD5”);byte[] hash =&lt;/p&gt;  &lt;p&gt;null;algo.TransformBlock(message, 0, message.Length, hash, 0); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – SHA1 or MD5 the ComputeHash is need for the requirements asked in the question.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 49 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create a method that runs by using the &lt;b&gt;credentials&lt;/b&gt; of the end user. You need to use Microsoft &lt;b&gt;Windows&lt;/b&gt; groups to authorize the user. You must add a code segment that identifies whether a user is in the local group named Clerk. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objUser As WindowsIdentity = WindowsIdentity.GetCurrentFor Each objGroup &lt;/p&gt;  &lt;p&gt;As IdentityReference In objUser.Groups &lt;/p&gt;  &lt;p&gt;Dim objNT As NTAccount = _ &lt;/p&gt;  &lt;p&gt;DirectCast(objGroup.Translate( _ &lt;/p&gt;  &lt;p&gt;Type.GetType(&amp;quot;NTAccount&amp;quot;)), NTAccount) &lt;/p&gt;  &lt;p&gt;Dim blnAuth As Boolean = objNT.Value.Equals( _ &lt;/p&gt;  &lt;p&gt;Environment.MachineName &amp;amp; &amp;quot;\Clerk&amp;quot;) &lt;/p&gt;  &lt;p&gt;If blnAuth Then Exit ForNext &lt;/p&gt;  &lt;p&gt;B. Dim objUser As &lt;b&gt;WindowsPrincipal&lt;/b&gt; = _ &lt;/p&gt;  &lt;p&gt;DirectCast(Thread.CurrentPrincipal, WindowsPrincipal)Dim blnAuth As Boolean = &lt;/p&gt;  &lt;p&gt;objUser.&lt;b&gt;IsInRole&lt;/b&gt;(&amp;quot;Clerk&amp;quot;) &lt;/p&gt;  &lt;p&gt;C. Dim objUser As GenericPrincipal = _ &lt;/p&gt;  &lt;p&gt;DirectCast(Thread.CurrentPrincipal, GenericPrincipal)Dim blnAuth As Boolean = &lt;/p&gt;  &lt;p&gt;objUser.IsInRole(&amp;quot;Clerk&amp;quot;) &lt;/p&gt;  &lt;p&gt;D. Dim objUser As WindowsPrincipal = _ &lt;/p&gt;  &lt;p&gt;DirectCast(Thread.CurrentPrincipal, WindowsPrincipal)Dim blnAuth As Boolean = _ &lt;/p&gt;  &lt;p&gt;objUser.IsInRole(Environment.MachineName) &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – IsInRole is needed &amp;amp; WindowsPrincipal&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 50 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code to call a function from the Win32 Application Programming Interface (API) by using &lt;b&gt;platform&lt;/b&gt; &lt;b&gt;invoke&lt;/b&gt;. int rc = MessageBox(hWnd, text, caption, type); You need to &lt;b&gt;define a method prototype&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. [DllImport(&amp;quot;user32&amp;quot;)]extern int MessageBox(int hWnd, String^ text, String^ caption, uint type); &lt;/p&gt;  &lt;p&gt;B. [DllImport(&amp;quot;user32&amp;quot;)]extern int MessageBox&lt;b&gt;A&lt;/b&gt;(int hWnd, String^ text, String^ caption, uint type); &lt;/p&gt;  &lt;p&gt;C. [DllImport(&amp;quot;user32&amp;quot;)]extern int Win32API_User32_MessageBox( &lt;/p&gt;  &lt;p&gt;Int hWnd, String^ text, String^ caption, uint type); &lt;/p&gt;  &lt;p&gt;D. [DllImport(&amp;quot;C:\\WINDOWS\\system32\\user32.dll&amp;quot;)]extern int MessageBox(int &lt;/p&gt;  &lt;p&gt;hWnd, String^ text, &lt;/p&gt;  &lt;p&gt;String^ caption, uint type); &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 - int rc = MessageBox(hWnd, text, caption, type); in questions in key info.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-744698454111750739?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-sample-questions-22.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-7542801504923743233</guid><pubDate>Sun, 23 Aug 2009 00:44:00 +0000</pubDate><atom:updated>2009-08-22T20:44:53.057-04:00</atom:updated><title>70-536 MCTS .NET Question Samples #21</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hey Now,&lt;/p&gt;  &lt;p&gt;Please feel free to check out my &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;MCTS 70-536 reference page on Chris Catto.com. It’s a page with a summary of all of my posts&lt;/a&gt;.    &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments. The questions are numbered from&amp;#160; #13 - #32. &lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;Catto&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 13 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application for a client residing in Hong Kong. You need to &lt;b&gt;display negative currency&lt;/b&gt; values by using a &lt;b&gt;minus sign&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objCulture As NumberFormatInfo = _ &lt;/p&gt;  &lt;p&gt;New CultureInfo(&amp;quot;zh-HK&amp;quot;).NumberFormatobjCulture.NumberNegativePattern = 1 &lt;/p&gt;  &lt;p&gt;Return NumberToPrint.ToString(&amp;quot;C&amp;quot;, objCulture) &lt;/p&gt;  &lt;p&gt;B. Dim objCulture As NumberFormatInfo = _ &lt;/p&gt;  &lt;p&gt;New CultureInfo(&amp;quot;zh-HK&amp;quot;).NumberFormatobjCulture.CurrencyNegativePattern = &lt;/p&gt;  &lt;p&gt;1Return NumberToPrint.ToString(&amp;quot;C&amp;quot;, objCulture) &lt;/p&gt;  &lt;p&gt;Exam Code: 70-536 &lt;/p&gt;  &lt;p&gt;C. Dim objCulture As NumberFormatInfo = _ &lt;/p&gt;  &lt;p&gt;New CultureInfo(&amp;quot;zh-HK&amp;quot;).NumberFormatReturn NumberToPrint.ToString(&amp;quot;-{0}&amp;quot;, &lt;/p&gt;  &lt;p&gt;objCulture) &lt;/p&gt;  &lt;p&gt;D. Dim objCulture As NumberFormatInfo = _ &lt;/p&gt;  &lt;p&gt;New CultureInfo(&amp;quot;zh-HK&amp;quot;).NumberFormatReturn NumberToPrint.ToString(&amp;quot;()&amp;quot;, &lt;/p&gt;  &lt;p&gt;objCulture) &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;IF answer is B &lt;/p&gt;  &lt;p&gt;NumberFormatobjCulture &amp;amp; CurrencyNegativePattern &lt;/p&gt;  &lt;p&gt;for the code is important. Along with 1Return NumberToPrint.ToString(&amp;quot;C&amp;quot;, objCulture)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 18 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application for a client residing in Hong Kong. You need to display negative currency values by using a minus sign. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. NumberFormatInfo^ culture = &lt;/p&gt;  &lt;p&gt;gcnew CultureInfo(“zh-HK”)::NumberFormat; culture-&amp;gt;NumberNegativePattern = 1; &lt;/p&gt;  &lt;p&gt;return numberToPrint-&amp;gt;ToString(“C”, culture); &lt;/p&gt;  &lt;p&gt;Exam Code: 70-536 &lt;/p&gt;  &lt;p&gt;B. NumberFormatInfo^ culture = &lt;/p&gt;  &lt;p&gt;gcnew CultureInfo(“zh-HK”)::NumberFormat; culture-&amp;gt;CurrencyNegativePattern = 1; &lt;/p&gt;  &lt;p&gt;return numberToPrint-&amp;gt;ToString(“C”, culture); &lt;/p&gt;  &lt;p&gt;C. CultureInfo^ culture = &lt;/p&gt;  &lt;p&gt;gcnew CultureInfo(“zh-HK”); return numberToPrint-&amp;gt;ToString(“-(0)”, culture); &lt;/p&gt;  &lt;p&gt;D. CultureInfo^ culture = &lt;/p&gt;  &lt;p&gt;gcnew CultureInfo(“zh-HK”); return numberToPrint-&amp;gt;ToString(“()”, culture); &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 – Same question as above but differes a little. &lt;/p&gt;  &lt;p&gt;Question: 14 &lt;/p&gt;  &lt;p&gt;Your application uses two &lt;b&gt;threads&lt;/b&gt;, named thread One and thread Two. You need to modify the code to &lt;b&gt;prevent the execution of thread One until thread Two completes&lt;/b&gt; execution. &lt;/p&gt;  &lt;p&gt;What should you do? &lt;/p&gt;  &lt;p&gt;A. Configure threadOne to run at a lower priority. &lt;/p&gt;  &lt;p&gt;B. Configure threadTwo to run at a higher priority. &lt;/p&gt;  &lt;p&gt;C. Use a &lt;b&gt;WaitCallback&lt;/b&gt; delegate to synchronize the threads. &lt;/p&gt;  &lt;p&gt;D. Call the Sleep method of threadOne. &lt;/p&gt;  &lt;p&gt;E. Call the SpinLock method of threadOne. &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8- Course – When I’m thinking theading &lt;b&gt;WaitCallback will prevent execution for another thead to complete.&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Question: 15 &lt;/p&gt;  &lt;p&gt;You are developing a method to hash data with the Secure Hash Algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using &lt;b&gt;SHA1&lt;/b&gt;. You also need to place the result into a byte array named hash. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim objSHA As New SHA1CryptoServiceProviderDim hash() As Byte = &lt;/p&gt;  &lt;p&gt;NothingobjSHA.TransformBlock(message, 0, message.Length, hash, 0) &lt;/p&gt;  &lt;p&gt;B. Dim objSHA As New SHA1CryptoServiceProviderDim hash() As Byte = &lt;/p&gt;  &lt;p&gt;BitConverter.GetBytes(objSHA.GetHashCode) &lt;/p&gt;  &lt;p&gt;C. Dim objSHA As New SHA1CryptoServiceProviderDim hash() As Byte = &lt;/p&gt;  &lt;p&gt;objSHA.ComputeHash(message) &lt;/p&gt;  &lt;p&gt;D. Dim objSHA As New SHA1CryptoServiceProviderobjSHA.GetHashCode()Dim &lt;/p&gt;  &lt;p&gt;hash() As Byte = objSHA.Hash &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – SHA1 – use SHA1CryptoServiceProvider Dim also important for this question objSHA.ComputeHash(message) &lt;/p&gt;  &lt;p&gt;Question: 19 &lt;/p&gt;  &lt;p&gt;You are developing a method to hash data with the Secure Hash Algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using SHA1. You also need to place the result into a byte array named hash. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. SHA1 ^sha = gcnew SHA1CryptoServiceProvider();array&amp;lt;Byte&amp;gt;^hash = nullptr;sha- &lt;/p&gt;  &lt;p&gt;&amp;gt;TransformBlock(message, 0, message-&amp;gt;Length, hash, 0); &lt;/p&gt;  &lt;p&gt;B. SHA1 ^sha = gcnew SHA1CryptoServiceProvider();array&amp;lt;Byte&amp;gt;^hash =&lt;/p&gt;  &lt;p&gt;BitConverter::GetBytes(sha-&amp;gt;GetHashCode()); &lt;/p&gt;  &lt;p&gt;C. SHA1 ^sha = gcnew SHA1CryptoServiceProvider();array&amp;lt;Byte&amp;gt;^hash = sha- &lt;/p&gt;  &lt;p&gt;&amp;gt;ComputeHash(message); &lt;/p&gt;  &lt;p&gt;D. SHA1 ^sha = gcnew &lt;/p&gt;  &lt;p&gt;SHA1CryptoServiceProvider();sha-&amp;gt;GetHashCode();array&amp;lt;Byte&amp;gt;^hash = sha-&amp;gt;Hash; &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Important SHA1CryptoServiceProvider&lt;/p&gt;  &lt;p&gt;Question: 16 &lt;/p&gt;  &lt;p&gt;You are writing a custom dictionary. The custom-dictionary class is named MyDictionary. You need to ensure that the &lt;b&gt;dictionary is type safe.&lt;/b&gt; Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. class MyDictionary : Dictionary&amp;lt;string, string&amp;gt; &lt;/p&gt;  &lt;p&gt;B. class MyDictionary : HashTable &lt;/p&gt;  &lt;p&gt;C. class MyDictionary : IDictionary &lt;/p&gt;  &lt;p&gt;D. class MyDictionary { ... } &lt;/p&gt;  &lt;p&gt;Dictionary&amp;lt;string, string&amp;gt; t = new Dictionary&amp;lt;string, string&amp;gt;();MyDictionary dictionary =&lt;/p&gt;  &lt;p&gt;(MyDictionary)t; &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Dictionary Type safe so Generics are good maybe? When reading this I didn’t think B could be the answer. &lt;/p&gt;  &lt;p&gt;Question: 17 &lt;/p&gt;  &lt;p&gt;Exam Code: 70-536 &lt;/p&gt;  &lt;p&gt;You work as a developer at Company.com. You are creating an application that provides information about the local computer. The application contains a form that lists each logical drive &lt;/p&gt;  &lt;p&gt;with the drive properties, such as type, volume label, and capacity. You are required to &lt;b&gt;write a procedure that retrieves properties of each logical drive on the local computer&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;What should you do? &lt;/p&gt;  &lt;p&gt;Arrange the appropriate actions in the correct order. &lt;/p&gt;  &lt;p&gt;Answer: &lt;/p&gt;  &lt;p&gt;K8 – Hmm this didn’t display too well maybe revisit this question later. &lt;/p&gt;  &lt;p&gt;Question: 20 &lt;/p&gt;  &lt;p&gt;You are writing an application that uses SOAP to exchange data with other applications. You use a Department class that inherits from ArrayList to send objects to another application. &lt;/p&gt;  &lt;p&gt;The Department object is named dept. You need to ensure that the &lt;b&gt;application serializes the Department object&lt;/b&gt; for transport by using SOAP. Which code should you use? &lt;/p&gt;  &lt;p&gt;A. SoapFormatter^ formatter = gcnew SoapFormatter();array&amp;lt;Byte&amp;gt;^ buffer = gcnew&lt;/p&gt;  &lt;p&gt;array&amp;lt;Byte&amp;gt;(dept-&amp;gt;Capacity);MemoryStream^ stream = gcnew MemoryStream(buffer); &lt;/p&gt;  &lt;p&gt;for each (Object^ o in dept) { &lt;/p&gt;  &lt;p&gt;formatter-&amp;gt;Serialize(stream, o);} &lt;/p&gt;  &lt;p&gt;B. SoapFormatter^ formatter = gcnew SoapFormatter();array&amp;lt;Byte&amp;gt;^ buffer = gcnew&lt;/p&gt;  &lt;p&gt;array&amp;lt;Byte&amp;gt;(dept-&amp;gt;Capacity);MemoryStream^ stream = gcnew MemoryStream(buffer);&lt;/p&gt;  &lt;p&gt;formatter-&amp;gt;Serialize(stream, dept); &lt;/p&gt;  &lt;p&gt;C. SoapFormatter^ formatter = gcnew SoapFormatter();MemoryStream^ stream = gcnew&lt;/p&gt;  &lt;p&gt;MemoryStream();for each (Object^ o in dept) { &lt;/p&gt;  &lt;p&gt;formatter-&amp;gt;Serialize(stream, o);} &lt;/p&gt;  &lt;p&gt;D. SoapFormatter^ formatter = gcnew SoapFormatter();MemoryStream^ stream = gcnew&lt;/p&gt;  &lt;p&gt;MemoryStream();formatter-&amp;gt;Serialize(stream, dept); &lt;/p&gt;  &lt;p&gt;Answer: D&lt;/p&gt;  &lt;p&gt;K8 - SoapFormatter();MemoryStream^ stream &amp;amp; formatter-&amp;gt;Serialize(stream, dept);&lt;/p&gt;  &lt;p&gt;Question: 21 &lt;/p&gt;  &lt;p&gt;You need to write a code segment that will create a common language runtime (&lt;b&gt;CLR) unit of isolation within an application&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim mySetup As AppDomainSetup = _ &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomain.SetupInformationmySetup.ShadowCopyFiles = &amp;quot;true&amp;quot; &lt;/p&gt;  &lt;p&gt;Exam Code: 70-536 &lt;/p&gt;  &lt;p&gt;B. Dim myProcess As System.Diagnostics.Process myProcess = New &lt;/p&gt;  &lt;p&gt;System.Diagnostics.Process() &lt;/p&gt;  &lt;p&gt;C. Dim domain As AppDomain domain = &lt;/p&gt;  &lt;p&gt;AppDomain.CreateDomain(&amp;quot;CompanyDomain&amp;quot;) &lt;/p&gt;  &lt;p&gt;D. Dim myComponent As System.ComponentModel.ComponentmyComponent = New &lt;/p&gt;  &lt;p&gt;System.ComponentModel.Component() &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Isolation in question &amp;amp; AppDomain in answer&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 22 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are testing a newly developed method named PersistToDB. This &lt;b&gt;method accepts a parameter of type EventLogEntry&lt;/b&gt;. This method does not return a value. You need to create a code segment that helps you to test the method. The code segment must read entries from the application &lt;b&gt;log&lt;/b&gt; of local computers and then pass the entries on to the PersistToDB method. The &lt;/p&gt;  &lt;p&gt;code block must pass only events of &lt;b&gt;type Error or Warning&lt;/b&gt; from the source MySource to the PersistToDB method. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. EventLog^ myLog = gcnew EventLog(“Application”, “.”); &lt;/p&gt;  &lt;p&gt;for each (EventLogEntry^ entry in myLog-&amp;gt;Entries) { &lt;/p&gt;  &lt;p&gt;if (entry-&amp;gt;Source == &amp;quot;MySource&amp;quot;) { &lt;/p&gt;  &lt;p&gt;PersistToDB(entry); &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;B. EventLog^ myLog = gcnew EventLog(“Application”, “.”); &lt;/p&gt;  &lt;p&gt;myLog-&amp;gt;Source = “MySource”; &lt;/p&gt;  &lt;p&gt;for each (EventLogEntry^ entry in myLog-&amp;gt;Entries) { &lt;/p&gt;  &lt;p&gt;if (entry-&amp;gt;EntryType == (EventLogEntryType::Error &amp;amp; &lt;/p&gt;  &lt;p&gt;EventLogEntryType::Warning)) { &lt;/p&gt;  &lt;p&gt;PersistToDB(entry);}} &lt;/p&gt;  &lt;p&gt;C. EventLog^ myLog = gcnew EventLog(“Application”, “.”);&lt;/p&gt;  &lt;p&gt;for each (EventLogEntry^ entry in myLog-&amp;gt;Entries) { &lt;/p&gt;  &lt;p&gt;if (entry-&amp;gt;Source == &amp;quot;MySource&amp;quot;) { &lt;/p&gt;  &lt;p&gt;if (entry-&amp;gt;EntryType == EventLogEntryType::Error || &lt;/p&gt;  &lt;p&gt;entry-&amp;gt;EntryType == EventLogEntryType::Warning) { &lt;/p&gt;  &lt;p&gt;PersistToDB(entry); &lt;/p&gt;  &lt;p&gt;} &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;D. EventLog^ myLog = gcnew EventLog(“Application”, “.”); &lt;/p&gt;  &lt;p&gt;myLog-&amp;gt;Source = “MySource”; &lt;/p&gt;  &lt;p&gt;for each (EventLogEntry^ entry in myLog-&amp;gt;Entries) { &lt;/p&gt;  &lt;p&gt;if (entry-&amp;gt;EntryType == EventLogEntryType::Error || &lt;/p&gt;  &lt;p&gt;entry-&amp;gt;EntryType == EventLogEntryType::Warning) { &lt;/p&gt;  &lt;p&gt;PersistToDB(entry); &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 – Check if the it’s from the “source ” then warning or || Error. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 23 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application that will &lt;b&gt;use custom authentication and role-based security&lt;/b&gt;. You need to write a code segment to make the runtime assign an &lt;b&gt;unauthenticated&lt;/b&gt;&lt;b&gt; principal object to each running thread&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. AppDomain^ domain = &lt;/p&gt;  &lt;p&gt;AppDomain::CurrentDomain;domain-&amp;gt;&lt;/p&gt;  &lt;p&gt;SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal); &lt;/p&gt;  &lt;p&gt;B. AppDomain^ domain = &lt;/p&gt;  &lt;p&gt;AppDomain::CurrentDomain;domain-&amp;gt;SetThreadPrincipal(gcnew WindowsPrincipal(nullptr)); &lt;/p&gt;  &lt;p&gt;C. AppDomain^ domain = &lt;/p&gt;  &lt;p&gt;AppDomain::CurrentDomain;domain-&lt;/p&gt;  &lt;p&gt;&amp;gt;SetAppDomainPolicy(PolicyLevel::CreateAppDomainLevel()); &lt;/p&gt;  &lt;p&gt;D. AppDomain^ domain = &lt;/p&gt;  &lt;p&gt;AppDomain::CurrentDomain;domain-&lt;/p&gt;  &lt;p&gt;&amp;gt;SetPrincipalPolicy(PrincipalPolicy::UnauthenticatedPrincipal); &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 SetPrincipalPolicy along with Unauth&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 24 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code. &lt;b&gt;public delegate &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;void FaxDocs(Object^ sender, FaxArgs^ args); You need to create an event that will invoke FaxDocs. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. public : static event FaxDocs^ Fax; &lt;/p&gt;  &lt;p&gt;B. public : static event Fax^ FaxDocs; &lt;/p&gt;  &lt;p&gt;C. public ref class FaxArgs : public EventArgs { &lt;/p&gt;  &lt;p&gt;public : &lt;/p&gt;  &lt;p&gt;String^ CoverPageInfo; &lt;/p&gt;  &lt;p&gt;FaxArgs (String^ coverInfo) { &lt;/p&gt;  &lt;p&gt;this-&amp;gt;CoverPageInfo = coverInfo; &lt;/p&gt;  &lt;p&gt;}}; &lt;/p&gt;  &lt;p&gt;D. public ref class FaxArgs : public EventArgs { &lt;/p&gt;  &lt;p&gt;public : &lt;/p&gt;  &lt;p&gt;String^ CoverPageInfo;}; &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Public : static event FaxDocs Fax;&lt;/p&gt;  &lt;p&gt;Another answer would be I think Public : static event FaxDocs myFaxDocVariable;&lt;/p&gt;  &lt;p&gt;Question: 28 &lt;/p&gt;  &lt;p&gt;You write the following code. public delegate void FaxDocs(object sender, FaxArgs args); You need to create an event that will invoke FaxDocs. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. pulic static event FaxDocs Fax; &lt;/p&gt;  &lt;p&gt;B. public static event Fax FaxDocs; &lt;/p&gt;  &lt;p&gt;C. public class FaxArgs : EventArgs { &lt;/p&gt;  &lt;p&gt;private string coverPageInfo; &lt;/p&gt;  &lt;p&gt;public FaxArgs(string coverInfo) { &lt;/p&gt;  &lt;p&gt;this.coverPageInfo = coverPageInfo; &lt;/p&gt;  &lt;p&gt;} &lt;/p&gt;  &lt;p&gt;public string CoverPageInformation { &lt;/p&gt;  &lt;p&gt;get {return this.coverPageInfo;} &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;D. public class FaxArgs : EventArgs { &lt;/p&gt;  &lt;p&gt;private string coverPageInfo; &lt;/p&gt;  &lt;p&gt;public string CoverPageInformation { &lt;/p&gt;  &lt;p&gt;get {return this.coverPageInfo;} &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – Repeat?&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 25 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You create an application to send a message by e-mail. An SMTP server is available on the local subnet. The SMTP server is named smtp.Company.com. To test the application, you use a source address, me@Company.com, and a target address, &lt;/p&gt;  &lt;p&gt;you@Company.com. You &lt;b&gt;need to transmit the e-mail message&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. MailAddress addrFrom = &lt;/p&gt;  &lt;p&gt;new MailAddress(“me@Company.com”, “Me”);MailAddress addrTo = &lt;/p&gt;  &lt;p&gt;new MailAddress(“you@Company.com”, “You”);MailMessage message = new&lt;/p&gt;  &lt;p&gt;MailMessage(addrFrom, addrTo);message.Subject = “Greetings!”;message.Body =&lt;/p&gt;  &lt;p&gt;“Test”;message.Dispose(); &lt;/p&gt;  &lt;p&gt;B. string strSmtpClient = “mstp.Company.com”;string strFrom = “me@Company.com”;string strTo&lt;/p&gt;  &lt;p&gt;= “you@Company.com”;string strSubject = “Greetings!”;string strBody = “Test”;MailMessage&lt;/p&gt;  &lt;p&gt;msg = new MailMessage(strFrom, strTo, strSubject, strSmtpClient); &lt;/p&gt;  &lt;p&gt;C. MailAddress addrFrom = new MailAddress(“me@Company.com”);MailAddress addrTo = new&lt;/p&gt;  &lt;p&gt;MailAddress(“you@Company.com”);MailMessage message = new MailMessage(addrFrom,&lt;/p&gt;  &lt;p&gt;addrTo);message.Subject = “Greetings!”;message.Body = “Test”;SmtpClient client = new&lt;/p&gt;  &lt;p&gt;SmtpClient(“smtp.Company.com”);client.Send(message); &lt;/p&gt;  &lt;p&gt;D. MailAddress addrFrom = &lt;/p&gt;  &lt;p&gt;new MailAddress(“me@Company.com”, “Me”);MailAddress addrTo = new&lt;/p&gt;  &lt;p&gt;MailAddress(“you@Company.com”, “You”);MailMessage message = new&lt;/p&gt;  &lt;p&gt;MailMessage(addrFrom, addrTo);message.Subject = “Greetings!”;message.Body =&lt;/p&gt;  &lt;p&gt;“Test”;SocketInformation info = new SocketInformation();Socket client = new&lt;/p&gt;  &lt;p&gt;Socket(info);System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();byte[]&lt;/p&gt;  &lt;p&gt;msgBytes = enc.GetBytes(message.ToString());client.Send(msgBytes); &lt;/p&gt;  &lt;p&gt;Exam Code: 70-536 &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 - SmtpClient( after the MailAddress addForm&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 26 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a custom-collection class. You need to create a method in your class. You need to ensure that the &lt;b&gt;method you create in your class returns a type that is compatible with the Foreach&lt;/b&gt; statement. Which criterion should the method meet? &lt;/p&gt;  &lt;p&gt;A. The method must return a type of either IEnumerator or IEnumerable. &lt;/p&gt;  &lt;p&gt;B. The method must return a type of IComparable. &lt;/p&gt;  &lt;p&gt;C. The method must explicitly contain a collection. &lt;/p&gt;  &lt;p&gt;D. The method must be the only iterator in the class. &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 – IEnum since For loops need to count &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 27 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application to perform mathematical calculations. You develop a class named CalculationValues. You write a procedure named PerformCalculation that operates on an instance of the class. You need to ensure that the user &lt;b&gt;interface of the application continues to respond&lt;/b&gt; while calculations are being performed. You need to write a code segment that &lt;b&gt;calls the PerformCalculation procedure&lt;/b&gt; to achieve this goal. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. private void PerformCalculation() {...} private void DoWork(){ &lt;/p&gt;  &lt;p&gt;Calculation Values myValues = new Calculation Values(); &lt;/p&gt;  &lt;p&gt;Thread newThread = new Thread( &lt;/p&gt;  &lt;p&gt;new ThreadStart(PerformCalculation)); &lt;/p&gt;  &lt;p&gt;new Thread.Start(myValues);} &lt;/p&gt;  &lt;p&gt;B. private void PerformCalculation() {...} private void DoWork(){ &lt;/p&gt;  &lt;p&gt;Calculation Values myValues = new Calculation Values(); &lt;/p&gt;  &lt;p&gt;ThreadStart delStart = new &lt;/p&gt;  &lt;p&gt;ThreadStart(PerformCalculation); &lt;/p&gt;  &lt;p&gt;Thread newThread = new Thread(delStart);if (newThread.IsAlive) &lt;/p&gt;  &lt;p&gt;{newThread.Start(myValues);}} &lt;/p&gt;  &lt;p&gt;C. private void PerformCalculation (&lt;b&gt;CalculationValues values&lt;/b&gt;) {...} private void &lt;/p&gt;  &lt;p&gt;DoWork(){ &lt;/p&gt;  &lt;p&gt;Calculation Values myValues = new Calculation Values(); &lt;/p&gt;  &lt;p&gt;Application.DoEvents(); &lt;/p&gt;  &lt;p&gt;PerformCalculation(myValues); &lt;/p&gt;  &lt;p&gt;Application.DoEvents();} &lt;/p&gt;  &lt;p&gt;D. private void PerformCalculation(object values) {...} private void DoWork(){ &lt;/p&gt;  &lt;p&gt;Calculation Values myValues = new Calculation Values(); &lt;/p&gt;  &lt;p&gt;Thread newThread = new Thread( &lt;/p&gt;  &lt;p&gt;new &lt;b&gt;ParameterizedThreadStart&lt;/b&gt;(PerformCalculation)); &lt;/p&gt;  &lt;p&gt;newThread.Start(myValues);} &lt;/p&gt;  &lt;p&gt;Answer: D &lt;/p&gt;  &lt;p&gt;K8 - Call the procedure &amp;amp; use &lt;b&gt;ParameterizedThreadStart &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 29 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a custom event handler to automatically print all open documents. The event handler helps specify the number of copies to be printed. You need to &lt;b&gt;develop a custom event arguments class to pass as a parameter to the event handler&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Public Class PrintingArgs&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Private _copies As Integer &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Public Sub New(ByVal numberOfCopies As Integer) &lt;/p&gt;  &lt;p&gt;Me._copies = numberOfCopies &lt;/p&gt;  &lt;p&gt;End Sub &lt;/p&gt;  &lt;p&gt;Public ReadOnly Property Copies() As Integer &lt;/p&gt;  &lt;p&gt;Get &lt;/p&gt;  &lt;p&gt;Return Me._copies &lt;/p&gt;  &lt;p&gt;End Get &lt;/p&gt;  &lt;p&gt;End PropertyEnd Class &lt;/p&gt;  &lt;p&gt;B. Public Class PrintingArgs&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Inherits EventArgs &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Private _copies As Integer &lt;/p&gt;  &lt;p&gt;Public Sub New(ByVal numberOfCopies As Integer) &lt;/p&gt;  &lt;p&gt;Me._copies = numberOfCopies &lt;/p&gt;  &lt;p&gt;End Sub &lt;/p&gt;  &lt;p&gt;Public ReadOnly Property Copies() As Integer &lt;/p&gt;  &lt;p&gt;Get &lt;/p&gt;  &lt;p&gt;Return Me._copies &lt;/p&gt;  &lt;p&gt;End Get &lt;/p&gt;  &lt;p&gt;End PropertyEnd Class &lt;/p&gt;  &lt;p&gt;C. Public Class PrintingArgs &lt;/p&gt;  &lt;p&gt;Private eventArgs As EventArgs &lt;/p&gt;  &lt;p&gt;Public Sub New(ByVal args As EventArgs) &lt;/p&gt;  &lt;p&gt;Me.eventArgs = args &lt;/p&gt;  &lt;p&gt;End Sub &lt;/p&gt;  &lt;p&gt;Public ReadOnly Property Args() As EventArgs &lt;/p&gt;  &lt;p&gt;Get &lt;/p&gt;  &lt;p&gt;Return eventArgs &lt;/p&gt;  &lt;p&gt;End Get &lt;/p&gt;  &lt;p&gt;End PropertyEnd Class &lt;/p&gt;  &lt;p&gt;D. Public Class PrintingArgs &lt;/p&gt;  &lt;p&gt;Inherits EventArgs &lt;/p&gt;  &lt;p&gt;Private copies As IntegerEnd Class &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;&lt;b&gt;K8 -&lt;/b&gt; &lt;b&gt;Inherits EventArgs &lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 30 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write the following code segment to call a function from the Win32 Application Programming Interface (API) by using platform invoke. string personName = “N?el”;string msg = “Welcome” + personName + “to club”!”;bool rc = &lt;/p&gt;  &lt;p&gt;User32API.MessageBox(0, msg, personName, 0); You need to &lt;b&gt;define a method prototype that can best marshal the string data&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. [DllImport(&amp;quot;user32&amp;quot;, CharSet = CharSet.Ansi)]public static extern bool &lt;/p&gt;  &lt;p&gt;MessageBox(int hWnd, &lt;/p&gt;  &lt;p&gt;String text, &lt;/p&gt;  &lt;p&gt;String caption, &lt;/p&gt;  &lt;p&gt;uint type);} &lt;/p&gt;  &lt;p&gt;B. [DllImport(&amp;quot;user32&amp;quot;, EntryPoint = &amp;quot;MessageBoxA&amp;quot;, CharSet = CharSet.Ansi)]public &lt;/p&gt;  &lt;p&gt;static extern bool MessageBox(int hWnd, &lt;/p&gt;  &lt;p&gt;[MarshalAs(UnmanagedType.LPWStr)]String text, &lt;/p&gt;  &lt;p&gt;[MarshalAs(UnmanagedType.LPWStr)]String caption, &lt;/p&gt;  &lt;p&gt;uint type);} &lt;/p&gt;  &lt;p&gt;C. [DllImport(&amp;quot;user32&amp;quot;, CharSet = CharSet.&lt;b&gt;Unicode&lt;/b&gt;)]public static extern bool &lt;/p&gt;  &lt;p&gt;MessageBox(int hWnd, &lt;/p&gt;  &lt;p&gt;String text, &lt;/p&gt;  &lt;p&gt;String caption, &lt;/p&gt;  &lt;p&gt;uint type);} &lt;/p&gt;  &lt;p&gt;D. [DllImport(&amp;quot;user32&amp;quot;, EntryPoint = &amp;quot;MessageBoxA&amp;quot;, CharSet = &lt;/p&gt;  &lt;p&gt;CharSet.Unicode)]public static extern bool MessageBox(int hWnd, &lt;/p&gt;  &lt;p&gt;[MarshalAs(UnmanagedType.LPWStr)]String text, &lt;/p&gt;  &lt;p&gt;[MarshalAs(UnmanagedType.LPWStr)]String caption, &lt;/p&gt;  &lt;p&gt;uint type);} &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;K8 - CharSet.&lt;b&gt;Unicode&lt;/b&gt; not asci &amp;amp; not using MarshaAs&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 31 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing an application that dynamically loads assemblies from an application directory. You need to write a code segment that &lt;b&gt;loads an assembly named Company1.dll into the current application domain&lt;/b&gt;. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim domain As AppDomain = AppDomain.CurrentDomainDim myPath As String = &lt;/p&gt;  &lt;p&gt;_ Path.Combine(domain.BaseDirectory, &amp;quot;Company1.dll&amp;quot;)Dim asm As [Assembly] = &lt;/p&gt;  &lt;p&gt;&lt;b&gt;[Assembly].LoadFrom(myPath) &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;B. Dim domain As AppDomain = AppDomain.CurrentDomainDim myPath As String = _ &lt;/p&gt;  &lt;p&gt;Path.Combine(domain.BaseDirectory, &amp;quot;Company1.dll&amp;quot;)Dim asm As [Assembly] = &lt;/p&gt;  &lt;p&gt;[Assembly].Load(myPath) &lt;/p&gt;  &lt;p&gt;C. Dim domain As AppDomain = AppDomain.CurrentDomainDim myPath As String = _ &lt;/p&gt;  &lt;p&gt;Path.Combine(domain.DynamicDirectory, &amp;quot;Company1.dll&amp;quot;)Dim asm As [Assembly] = _ &lt;/p&gt;  &lt;p&gt;AppDomain.CurrentDomain.Load(myPath) &lt;/p&gt;  &lt;p&gt;D. Dim domain As AppDomain = AppDomain.CurrentDomainDim asm As [Assembly] &lt;/p&gt;  &lt;p&gt;= domain.GetData(&amp;quot;Company1.dll&amp;quot;) &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;K8 - &lt;b&gt;[Assembly].LoadFrom(myPath) &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 32 &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You need to &lt;b&gt;read the entire contents of a file named Message.txt into a single string&lt;/b&gt; variable. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim result As String = NothingDim reader As New &lt;/p&gt;  &lt;p&gt;StreamReader(&amp;quot;Message.txt&amp;quot;)result = reader.Read().ToString() &lt;/p&gt;  &lt;p&gt;B. Dim result As String = NothingDim reader as New &lt;/p&gt;  &lt;p&gt;StreamReader(&amp;quot;Message.txt&amp;quot;)result = reader.ReadToEnd() &lt;/p&gt;  &lt;p&gt;C. Dim result As String = string.&lt;b&gt;EmptyDim&lt;/b&gt; reader As New &lt;/p&gt;  &lt;p&gt;StreamReader(&amp;quot;Message.txt&amp;quot;)While Not reader.EndOfStream &lt;/p&gt;  &lt;p&gt;result &amp;amp;= reader.ToString()End While &lt;/p&gt;  &lt;p&gt;D. Dim result as String = NothingDim reader As New &lt;/p&gt;  &lt;p&gt;StreamReader(&amp;quot;Message.txt&amp;quot;)result = reader.ReadLine() &lt;/p&gt;  &lt;p&gt;Answer: B &lt;/p&gt;  &lt;p&gt;K8 - ReadToEnd will read the entire file.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-7542801504923743233?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-question-samples-21.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-120163233544245163</guid><pubDate>Sat, 22 Aug 2009 01:55:00 +0000</pubDate><atom:updated>2009-08-21T21:55:12.907-04:00</atom:updated><title>70-536 MCTS .NET Practice Questions #20</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hey Now,&lt;/p&gt;  &lt;p&gt;Please feel free to check out my &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;MCTS 70-536 reference page on Chris Catto.com. It’s a page with a summary of all of my posts&lt;/a&gt;.     &lt;br /&gt;As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet. &lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;Catto&lt;/p&gt;  &lt;p&gt;Question: 6 &lt;/p&gt;  &lt;p&gt;You are working on a &lt;strong&gt;debug&lt;/strong&gt; build of an application. &lt;/p&gt;  &lt;p&gt;You need to find the line of code that &lt;strong&gt;caused an exception&lt;/strong&gt; to be thrown. Which property of the &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Exception class&lt;/strong&gt; should you use to achieve this goal? &lt;/p&gt;  &lt;p&gt;A. Data &lt;/p&gt;  &lt;p&gt;B. Message &lt;/p&gt;  &lt;p&gt;C. StackTrace &lt;/p&gt;  &lt;p&gt;D. Source &lt;/p&gt;  &lt;p&gt;Answer: C &lt;/p&gt;  &lt;p&gt;(of course the stackTrace)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Question: 7 &lt;/p&gt;  &lt;p&gt;You need to write a code segment that performs the following tasks: &lt;/p&gt;  &lt;p&gt;* Retrieves the name of each paused service. &lt;/p&gt;  &lt;p&gt;* Passes the name to the Add method of Collection1. &lt;/p&gt;  &lt;p&gt;Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. ManagementObjectSearcher^ searcher = &lt;/p&gt;  &lt;p&gt;gcnew ManagementObjectSearcher( &lt;/p&gt;  &lt;p&gt;“Select * from Win32_Service where State = ‘Paused’”);for each (ManagementObject^ &lt;/p&gt;  &lt;p&gt;svc in searcher-&amp;gt;Get()) { &lt;/p&gt;  &lt;p&gt;Collection1-&amp;gt;Add(svc[“DisplayName”]);} &lt;/p&gt;  &lt;p&gt;B. ManagementObjectSearcher^ searcher = &lt;/p&gt;  &lt;p&gt;gcnew ManagementObjectSearcher( &lt;/p&gt;  &lt;p&gt;“Select * from Win32_Service”, “State = ‘Paused’”);for each (ManagementObject^ svc in &lt;/p&gt;  &lt;p&gt;searcher-&amp;gt;Get()) { &lt;/p&gt;  &lt;p&gt;Collection1-&amp;gt;Add(svc[“DisplayName”]);} &lt;/p&gt;  &lt;p&gt;C. ManagementObjectSearcher^ searcher = &lt;/p&gt;  &lt;p&gt;gcnew ManagementObjectSearcher( &lt;/p&gt;  &lt;p&gt;“Select * from Win32_Service”);for each (ManagementObject^ svc in searcher-&amp;gt;Get()) { &lt;/p&gt;  &lt;p&gt;if ((String^) svc[&amp;quot;State&amp;quot;] == &amp;quot;'Paused'&amp;quot;) { &lt;/p&gt;  &lt;p&gt;Collection1-&amp;gt;Add(svc[“DisplayName”]); &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;D. ManagementObjectSearcher^ searcher = &lt;/p&gt;  &lt;p&gt;gcnew ManagementObjectSearcher();searcher-&amp;gt;Scope = gcnew &lt;/p&gt;  &lt;p&gt;ManagementScope(“Win32_Service”);for each (ManagementObject^ svc in &lt;/p&gt;  &lt;p&gt;searcher-&amp;gt;Get()) { &lt;/p&gt;  &lt;p&gt;if ((String^)svc[&amp;quot;State&amp;quot;] == &amp;quot;Paused&amp;quot;) { &lt;/p&gt;  &lt;p&gt;Collection1-&amp;gt;Add(svc[“DisplayName”]); &lt;/p&gt;  &lt;p&gt;}} &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Question: 8&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;You need to &lt;strong&gt;serialize&lt;/strong&gt; an object of type List(Of Integer) in a binary format. The object is named data. Which code segment should you use? &lt;/p&gt;  &lt;p&gt;A. Dim formatter As New BinaryFormatter()Dim ms As New &lt;/p&gt;  &lt;p&gt;MemoryStream()formatter.Serialize(ms, data) &lt;/p&gt;  &lt;p&gt;B. Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream() For i As &lt;/p&gt;  &lt;p&gt;Integer = 1 To 20 &lt;/p&gt;  &lt;p&gt;formatter.Serialize(ms, data(i - 1))Next &lt;/p&gt;  &lt;p&gt;C. Dim formatter As New BinaryFormatter()Dim buffer As New Byte(data.Count) {}Dim ms As&lt;/p&gt;  &lt;p&gt;New MemoryStream(buffer, True)formatter.Serialize(ms, data) &lt;/p&gt;  &lt;p&gt;D. Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream()While &lt;/p&gt;  &lt;p&gt;ms.CanRead formatter.Serialize(ms, data)End While\ &lt;/p&gt;  &lt;p&gt;Answer: A &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-120163233544245163?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-practice-questions-20.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7893310777906730197.post-1874892018119403632</guid><pubDate>Sat, 22 Aug 2009 01:41:00 +0000</pubDate><atom:updated>2009-08-21T21:41:03.278-04:00</atom:updated><title>70-536 MCTS .NET Practice Questions #19</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Please feel free to check out my &lt;a href="http://www.chriscatto.com/public/70-536.aspx"&gt;MCTS 70-536 reference page on Chris Catto.com. It’s a page with a summary of all of my posts&lt;/a&gt;.    &lt;br /&gt; As I study for this test I thought this would be good to post on to learn the content &amp;amp; others would be able to view &amp;amp; comment on it.&lt;/p&gt;  &lt;p&gt;This content below is from some practice questions from the internet. &lt;/p&gt;  &lt;p&gt;Thx,&lt;/p&gt;  &lt;p&gt;Catto&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 1&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are writing a custom dictionary. The custom-dictionary class is named MyDictionary. You need to ensure that the dictionary is type safe.&lt;/p&gt;  &lt;p&gt;Which code segment should you use?&lt;/p&gt;  &lt;p&gt;A. Class MyDictionaryImplements Dictionary(Of String, String) B. Class MyDictionary Inherits HashTable&lt;/p&gt;  &lt;p&gt;C. Class MyDictionary Implements IDictionary&lt;/p&gt;  &lt;p&gt;D. Class MyDictionary&lt;/p&gt;  &lt;p&gt;End Class&lt;/p&gt;  &lt;p&gt;Dim t As New Dictionary(Of String, String)&lt;/p&gt;  &lt;p&gt;Dim dict As MyDictionary = CType(t, MyDictionary)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer: A &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 2&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You write a class named Employee that includes the following code segment.&lt;/p&gt;  &lt;p&gt;Private m_EmployeeId As String Private m_EmployeeName As String Private m_JobTitleName As String Public Function GetName() As String Return m_EmployeeName&lt;/p&gt;  &lt;p&gt;End Function&lt;/p&gt;  &lt;p&gt;Public Function GetTitle() As String&lt;/p&gt;  &lt;p&gt;Return m_JobTitleName&lt;/p&gt;  &lt;p&gt;End Function&lt;/p&gt;  &lt;p&gt;End Class&lt;/p&gt;  &lt;p&gt;You need to expose this class to COM in a type library. The COM interface must also facilitate forward-compatibility across new versions of the Employee class. You need to choose a method&lt;/p&gt;  &lt;p&gt;for generating the COM interface. What should you do?&lt;/p&gt;  &lt;p&gt;A. Add the following attribute to the class definition.&amp;lt;ClassInterface(ClassInterfaceType.None)&amp;gt;&lt;/p&gt;  &lt;p&gt;_Public Class Employee&lt;/p&gt;  &lt;p&gt;B. Add the following attribute to the class definition.&amp;lt;ClassInterface(ClassInterfaceType.AutoDual)&amp;gt; _Public Class Employee&lt;/p&gt;  &lt;p&gt;C. Add the following attribute to the class definition.&amp;lt;ComVisible(True)&amp;gt; _Public Class Employee&lt;/p&gt;  &lt;p&gt;D. Define an interface for the class and add the following attribute to the class definition.&amp;lt;ClassInterface(ClassInterfaceType.None)&amp;gt; _Public Class EmployeeImplements IEmployee&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer: D &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 3&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are developing a custom event handler to automatically print all open documents.&lt;/p&gt;  &lt;p&gt;The event handler helps specify the number of copies to be printed. You need to develop a custom event arguments class to pass as a parameter to the event handler.&lt;/p&gt;  &lt;p&gt;Which code segment should you use?&lt;/p&gt;  &lt;p&gt;A. public class PrintingArgs {&lt;/p&gt;  &lt;p&gt;private int copies;&lt;/p&gt;  &lt;p&gt;public PrintingArgs(int numberOfCopies) {&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_aeOfe_H0_iQ/So9MrQWqreI/AAAAAAAAALc/YQLUh7noP7g/s1600-h/clip_image001%5B3%5D.gif"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://lh5.ggpht.com/_aeOfe_H0_iQ/So9MrocTRtI/AAAAAAAAALg/m6JBgnJ2sQE/clip_image001_thumb.gif?imgmax=800" width="240" height="1" /&gt;&lt;/a&gt;this.copies = numberOfCopies;&lt;/p&gt;  &lt;p&gt;public int Copies {&lt;/p&gt;  &lt;p&gt;get { return this.copies; }&lt;/p&gt;  &lt;p&gt;}}&lt;/p&gt;  &lt;p&gt;B. public class PrintingArgs : EventArgs {&lt;/p&gt;  &lt;p&gt;private int copies;&lt;/p&gt;  &lt;p&gt;public PrintingArgs(int numberOfCopies) {&lt;/p&gt;  &lt;p&gt;this.copies = numberOfCopies;&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;public int Copies {&lt;/p&gt;  &lt;p&gt;get { return this.copies; }&lt;/p&gt;  &lt;p&gt;}}&lt;/p&gt;  &lt;p&gt;C. public class PrintingArgs {&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160; private EventArgs eventArgs;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;#160;&amp;#160; public PrintingArgs(EventArgs ea) {&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;this.eventArgs = ea;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;}public EventArgs Args {get { return eventArgs; }}} &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;D. public class PrintingArgs : EventArgs {&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;private int copies;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;b&gt;Answer: B &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 4&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You use Reflection to obtain information about a method named MyMethod.&lt;/p&gt;  &lt;p&gt;You need to ascertain whether MyMethod is accessible to a derived class. What should you do?&lt;/p&gt;  &lt;p&gt;A. Call the IsAssembly property of the MethodInfo class.&lt;/p&gt;  &lt;p&gt; B. Call the IsVirtual property of the MethodInfo class.&lt;/p&gt;  &lt;p&gt;C. Call the IsStatic property of the MethodInfo class. &lt;/p&gt;  &lt;p&gt;D. Call the IsFamily property of the MethodInfo class.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer: D &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Question: 5&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You are creating a class that uses unmanaged resources. This class maintains references to&lt;/p&gt;  &lt;p&gt;managed resources on other objects. You need to ensure that users of this class can explicitly release resources when the class instance ceases to be needed. Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)&lt;/p&gt;  &lt;p&gt;A. Define the class such that it inherits from the WeakReference class. &lt;/p&gt;  &lt;p&gt;B. Define the class such that it implements the IDisposable interface.&lt;/p&gt;  &lt;p&gt;C. Create a class destructor that calls methods on other objects to release the managed resources.&lt;/p&gt;  &lt;p&gt;D. Create a &lt;strong&gt;class destructor&lt;/strong&gt; that releases the unmanaged resources.&lt;/p&gt;  &lt;p&gt;E. Create a &lt;strong&gt;Dispose method&lt;/strong&gt; that calls System.GC.Collect to force garbage collection.&lt;/p&gt;  &lt;p&gt;F. Create a Dispose method that releases unmanaged resources and calls methods on other objects to release the managed resources.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Answer: B, D, F &lt;/b&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7893310777906730197-1874892018119403632?l=chriscatto.blogspot.com'/&gt;&lt;/div&gt;</description><link>http://chriscatto.blogspot.com/2009/08/70-536-mcts-net-practice-questions-19.html</link><author>noreply@blogger.com (Catto)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item></channel></rss>
