73
PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0 http://www.gratisexam.com/ PrepKing 70-552

PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0 PrepKing 70-552

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

PrepKing

Number: 70-552Passing Score: 700Time Limit: 120 minFile Version: 9.0

http://www.gratisexam.com/

PrepKing 70-552

Page 2: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Exam A

QUESTION 1You are developing an auditing application to display the trusted ClickOnce applications that are installed on acomputer. You need the auditing application to display the origin of each trusted application. Which code segment should you use?

A. ApplicationTrustCollection trusts;trusts = ApplicationSecurityManager.UserApplication Trusts;foreach (ApplicationTrust trust in trusts) { Console.WriteLine(trust.ToString());}

B. ApplicationTrustCollection trusts;trusts = ApplicationSecurityManager.UserApplication Trusts;foreach (ApplicationTrust trust in trusts) { Console.WriteLine(trust.ExtraInfo.ToString());}

C. ApplicationTrustCollection trusts;trusts = ApplicationSecurityManager.UserApplication Trusts;foreach (ApplicationTrust trust in trusts) { Console.WriteLine(trust.ApplicationIdentity.FullNa me);}

D. ApplicationTrustCollection trusts;trusts = ApplicationSecurityManager.UserApplication Trusts; foreach (object trust in trusts) { Console.WriteLine(trust.ToString());}

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 2You are writing code for user authentication and authorization. The username, password, and roles are storedin your application data store. You need to establish a user security context that will be used for authorizationchecks such as IsInRole. You write the following code segment to authorize the user.

if (!TestPassword(userName, password))throw new Exception("could not authenticate user");String[] userRolesArray = LookupUserRoles(userName) ;

You need to complete this code so that it establishes the user security context. Which code segment should you use?

A. GenericIdentity ident = new GenericIdentity(userNam e);GenericPrincipal currentUser = new GenericPrincipal (ident, userRolesArray);Thread.CurrentPrincipal = currentUser;

B. WindowsIdentity ident = new WindowsIdentity(userNam e);WindowsPrincipal currentUser = new WindowsPrincipal (ident);Thread.CurrentPrincipal = currentUser;

C. NTAccount userNTName = new NTAccount(userName);GenericIdentity ident = new GenericIdentity(userNTN ame.Value);GenericPrincipal currentUser = new GenericPrincipal (ident, userRolesArray);Thread.CurrentPrincipal = currentUser;

D. IntPtr token = IntPtr.Zero;token = LogonUserUsingInterop(userName, encryptedPa ssword);

Page 3: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

WindowsImpersonationContext ctx = WindowsIdentity.I mpersonate(token);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 3You are creating an assembly named Assembly1. Assembly1 contains a public method. The global cachecontains a second assembly named Assembly2. You must ensure that the public method is only called fromAssembly2. Which permission class should you use?

A. GacIdentityPermissionB. PublisherIdentityPermissionC. DataProtectionPermissionD. StrongNameIdentityPermission

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 4You are developing a method to call a COM component. You need to use declarative security to explicitlyrequest the runtime to perform a full stack walk. You must ensure that all callers have the required level of trustfor COM interop before the callers execute your method.Which attribute should you place on the method?

A. [SecurityPermission( SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]B. [SecurityPermission( SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]C. [SecurityPermission( SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)]D. [SecurityPermission( SecurityAction.Deny, Flags = SecurityPermissionFlag.UnmanagedCode)]

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 5You are developing an application that will deploy by using ClickOnce. You need to test if the applicationexecutes properly. You need to write a method that returns the object, which prompts the user to install aClickOnce application. Which code segment should you use?

A. return ApplicationSecurityManager.ApplicationTrustM anager;

B. return AppDomain.CurrentDomain.ApplicationTrust;

C. return new HostSecurityManager();

D. return SecurityManager.PolicyHierarchy();

Page 4: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 6You create a DirectorySecurity object for the working directory. You need to identify the user accounts andgroups that have read and write permissions. Which method should you use on the DirectorySecurity object?

A. the GetAuditRules methodB. the GetAccessRules methodC. the AccessRuleFactory methodD. the AuditRuleFactory method

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 7You are developing a method to hash data with the Secure Hash Algorithm. The data is passed to your methodas 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?

A. SHA1 sha = new SHA1CryptoServiceProvider();byte[] hash = null;sha.TransformBlock( message, 0, message.Length, has h, 0);

B. SHA1 sha = new SHA1CryptoServiceProvider();byte[] hash = BitConverter.GetBytes(sha.GetHashCode ());

C. SHA1 sha = new SHA1CryptoServiceProvider();byte[] hash = sha.ComputeHash(message);

D. SHA1 sha = new SHA1CryptoServiceProvider();sha.GetHashCode();byte[] hash = sha.Hash;

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 8You are changing the security settings of a file named MyData.xml. You need to preserve the existing inheritedaccess rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use?

Page 5: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

http://www.gratisexam.com/

A. FileSecurity security = new FileSecurity("mydata.xml",AccessControlSections.All);security.SetAccessRuleProtection(true, true);File.SetAccessControl("mydata.xml", security);

B. FileSecurity security = new FileSecurity();security.SetAccessRuleProtection(true, true);File.SetAccessControl("mydata.xml", security);

C. FileSecurity security = File.GetAccessControl("myda ta.xml");security.SetAccessRuleProtection(true, true);

D. FileSecurity security = File.GetAccessControl("myda ta.xml");security.SetAuditRuleProtection(true, true);File.SetAccessControl("mydata.xml", security);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 9You are developing an application that runs by using the credentials of the end user. Only users who aremembers of the Administrator group get permission to run the application. You write the following security codeto protect sensitive data within the application.

bool isAdmin = false;WindowsBuiltInRole role = WindowsBuiltInRole.Administrator; ...if (!isAdmin)throw new Exception("User not permitted");

You need to add a code segment to this security code to ensure that the application throws an exception if auser is not a member of the Administrator group. Which code segment should you use?

A. WindowsPrincipal currentUser = (WindowsPrincipal)Th read.CurrentPrincipal;isAdmin = currentUser.IsInRole(role);

B. WindowsIdentity currentUser = WindowsIdentity.GetCu rrent();foreach (IdentityReference grp in currentUser.Group s) { NTAccount grpAccount = ((NTAccount)grp.Translate(t ypeof(NTAccount))); isAdmin = grp.Value.Equals(role); if (isAdmin) break;}

C. GenericPrincipal currentUser = (GenericPrincipal) T hread.CurrentPrincipal;isAdmin = currentUser.IsInRole(role.ToString());

D. WindowsIdentity currentUser = (WindowsIdentity)Thread.CurrentPrincipal.Identity;isAdmin = currentUser.Name.EndsWith("Administrator" );

Correct Answer: A

Page 6: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Section: (none)Explanation

Explanation/Reference:

QUESTION 10You are developing an application that will use custom authentication and role-based security. You need towrite a code segment to make the runtime assign an unauthenticated principal object to each running thread. Which code segment should you use?

A. AppDomain domain = AppDomain.CurrentDomain;domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPr incipal);

B. AppDomain domain = AppDomain.CurrentDomain;domain.SetThreadPrincipal(new WindowsPrincipal(null ));

C. AppDomain domain = AppDomain.CurrentDomain;domain.SetAppDomainPolicy( PolicyLevel.CreateAppDom ainLevel());

D. AppDomain domain = AppDomain.CurrentDomain;domain.SetPrincipalPolicy( PrincipalPolicy.Unauthen ticatedPrincipal);

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 11You are developing a method to hash data for later verification by using the MD5 algorithm. The data is passedto your method as a byte array named message. You need to compute the hash of the incoming parameter byusing MD5. You also need to place the result into a byte array.Which code segment should you use?

A. HashAlgorithm algo = HashAlgorithm.Create("MD5");byte[] hash = algo.ComputeHash(message);

B. HashAlgorithm algo = HashAlgorithm.Create("MD5");byte[] hash = BitConverter.GetBytes(algo.GetHashCod e());

C. HashAlgorithm algo;algo = HashAlgorithm.Create(message.ToString());byte[] hash = algo.Hash;

D. HashAlgorithm algo = HashAlgorithm.Create("MD5");byte[] hash = null;algo.TransformBlock(message, 0, message.Length, has h, 0);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 12You are developing a server application that will transmit sensitive information on a network. You create anX509Certificate object named certificate and a TcpClient object named client. You need to create an SslStreamto communicate by using the Transport Layer Security 1.0 protocol.

Page 7: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Which code segment should you use?

A. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer( certificate, false, SslPr otocols.None, true);

B. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer( certificate, false, SslPr otocols.Ssl3, true);

C. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer( certificate, false, SslPr otocols.Ssl2, true);

D. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer( certificate, false, SslPr otocols.Tls, true);

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 13You are writing a method to compress an array of bytes. The array is passed to the method in a parameternamed document. You need to compress the incoming array of bytes and return the result as an array ofbytes. Which code segment should you use?

A. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress); byte[] result = new byte[document.Length];deflate.Write(result, 0, result.Length); return result;

B. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress);deflate.Write(document, 0, document.Length);deflate.Close();return strm.ToArray();

C. MemoryStream strm = new MemoryStream();DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress);deflate.Write(document, 0, document.Length);deflate.Close();return strm.ToArray();

D. MemoryStream inStream = new MemoryStream(document);DeflateStream deflate = new DeflateStream(inStream, CompressionMode.Compress); MemoryStream outStream = new MemoryStream();int b;while ((b = deflate.ReadByte()) != -1) { outStream.WriteByte((byte)b);} return outStream.ToArray();

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 14You create a class library that contains the class hierarchy defined in the following code segment. (Linenumbers are included for reference only.)

Page 8: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

01 public class Group {02 public Employee[] Employees;03 }04 public class Employee {05 public string Name;06 }07 public class Manager : Employee {08 public int Level;09 }

You create an instance of the Group class. You populate the fields of the instance. When you attempt toserialize the instance by using the Serialize method of the XmlSerializer class, you receiveInvalidOperationException. You also receive the following error message: "There was an error generating theXML document." You need to modify the code segment so that you can successfully serialize instances of theGroup class by using the XmlSerializer class. You also need to ensure that the XML output contains an elementfor all public fields in the class hierarchy. What should you do?

A. Insert the following code between lines 1 and 2 of the code segment: [XmlArrayItem(Type = typeof(Employee))] [XmlArrayItem(Type = typeof(Manager))]

B. Insert the following code between lines 1 and 2 of the code segment: [XmlElement(Type = typeof(Employees))]

C. Insert the following code between lines 1 and 2 of the code segment: [XmlArray(ElementName="Employees")]

D. Insert the following code between lines 3 and 4 of the code segment: [XmlElement(Type = typeof(Employee))] andInsert the following code between lines 6 and 7 of the code segment: [XmlElement(Type = typeof(Manager))]

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 15You create an application for your business partners to submit purchase orders. The application deserializesXML documents sent by your partners into instances of an object named PurchaseOrder. You need to modifythe application so that it collects details if the deserialization process encounters any XML content that fails tomap to public members of the PurchaseOrder object.What should you do?

A. Define and implement an event handler for the XmlSerializer.UnknownNode event.B. Define a class that inherits from XmlSerializer and overrides the XmlSerialize.FromMappings method.C. Apply an XmlInclude attribute to the PurchaseOrder class definition.D. Apply an XmlIgnore attribute to the PurchaseOrder class definition.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 16You are creating an application that provides information about the local computer. The application contains a

Page 9: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

form that lists each logical drive along with the drive properties,such as type,volume label,and capacity.

You need to write a procedure that retrieves properties of each logical drive on the local computer.

What should you do?

To answer, move the three appropriate actions from the list of actions to the answer area and arrange them inthe correct order.

Select and Place:

Correct Answer:

Section: (none)Explanation

Explanation/Reference:

Page 10: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

QUESTION 17You are writing a method to compress an array of bytes. The bytes to be compressed are passed to the methodin a parameter named document. You need to compress the contents of the incoming parameter. Which code segment should you use?

A. MemoryStream inStream = new MemoryStream(document);GZipStream zipStream = new GZipStream(inStream, Com pressionMode.Compress); byte[] result = new byte[document.Length];zipStream.Write(result, 0, result.Length); return result;

B. MemoryStream stream = new MemoryStream(document);GZipStream zipStream = new GZipStream(stream, Compr essionMode.Compress);zipStream.Write(document, 0, document.Length);zipStream.Close();return stream.ToArray();

C. MemoryStream outStream = new MemoryStream();GZipStream zipStream = new GZipStream(outStream, Co mpressionMode.Compress);zipStream.Write(document, 0, document.Length);zipStream.Close();return outStream.ToArray();

D. MemoryStream inStream = new MemoryStream(document);GZipStream zipStream = new GZipStream(inStream, Com pressionMode.Compress);MemoryStream outStream = new MemoryStream();int b;while ((b = zipStream.ReadByte()) != -1) { outStream.WriteByte((byte)b);} return outStream.ToArray();

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 18You are creating a class that performs complex financial calculations. The class contains a method namedGetCurrentRate that retrieves the current interest rate and a variable named currRate that stores the currentinterest rate. You write serialized representations of the class. You need to write a code segment that updatesthe currRate variable with the current interest rate when an instance of the class is deserialized. Which code segment should you use?

A. [OnSerializing]internal void UpdateValue (Streaming Context context) { currRate = GetCurrentRate();}

B. [OnSerializing]internal void UpdateValue(Serializat ionInfo info) { info.AddValue("currentRate", GetCurrentRate());}

C. [OnDeserializing]internal void UpdateValue(Serializ ationInfo info) { info.AddValue("currentRate", GetCurrentRate());}

D. [OnDeserialized]internal void UpdateValue(Streaming Context context) { currRate = GetCurrentRate();}

Page 11: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 19You 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: "Test Failed: "The value of fName if the value of fName does not equal "John"

You also need to ensure that the code segment simultaneously facilitates uninterrupted execution of theapplication. Which code segment should you use?

A. Debug.Assert(fName == "John", "Test Failed: ", fNam e);

B. Debug.WriteLineIf(fName != "John", fName, "Test Fai led");

C. if (fName != "John") { Debug.Print("Test Failed: "); Debug.Print(fName); }

D. if (fName != "John") { Debug.WriteLine("Test Failed: "); Debug.WriteLine(fName); }

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 20You need to write a code segment that will add a string named strConn to the connection string section of theapplication configuration file. Which code segment should you use?

A. Configuration myConfig = ConfigurationManager.OpenE xeConfiguration( ConfigurationUserLevel.None);myConfig.ConnectionStrings.ConnectionStrings.Add( n ew ConnectionStringSettings("ConnStr1", strConn));myConfig.Save();

B. Configuration myConfig = ConfigurationManager.OpenE xeConfiguration( ConfigurationUserLevel.None);myConfig.ConnectionStrings.ConnectionStrings.Add( n ew ConnectionStringSettings("ConnStr1", strConn));ConfigurationManager.RefreshSection( "ConnectionStr ings");

C. ConfigurationManager.ConnectionStrings.Add( new Con nectionStringSettings("ConnStr1",strConn));ConfigurationManager.RefreshSection( "ConnectionStr ings");

D. ConfigurationManager.ConnectionStrings.Add( new Con nectionStringSettings("ConnStr1", strConn));

Page 12: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Configuration myConfig = ConfigurationManager.OpenE xeConfiguration( ConfigurationUserLevel.None);myConfig.Save();

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 21You are developing an application that stores data about your company's sales and technical support teams.You need to ensure that the name and contact information for each person is available as a single collectionwhen a user queries details about a specific team. You also need to ensure that the data collection guaranteestype safety. Which code segment should you use?

A. Hashtable team = new Hashtable();team.Add(1, "Hance");team.Add(2, "Jim");team.Add(3, "Hanif");team.Add(4, "Kerim");team.Add(5, "Alex");team.Add(6, "Mark");team.Add(7, "Roger");team.Add(8, "Tommy");

B. ArrayList team = new ArrayList();team.Add("1, Hance");team.Add("2, Jim");team.Add("3, Hanif");team.Add("4, Kerim");team.Add("5, Alex");team.Add("6, Mark");team.Add("7, Roger");team.Add("8, Tommy");

C. Dictionary<int, string> team = new Dictionary<int, string>();team.Add(1, "Hance");team.Add(2, "Jim");team.Add(3, "Hanif");team.Add(4, "Kerim");team.Add(5, "Alex");team.Add(6, "Mark");team.Add(7, "Roger");team.Add(8, "Tommy");

D. string[] team = new string[] {"1, Hance", "2, Jim", "3, Hanif", "4, Kerim", "5,Alex", "6, Mark", "7, Roger", "8, Tommy"};

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 22You are creating a class that uses unmanaged resources. This class maintains references to managedresources on other objects. You need to ensure that users of this class can explicitly release resources whenthe class instance ceases to be needed. Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)

A. Define the class such that it inherits from the WeakReference class.B. Define the class such that it implements the IDisposable interface.C. Create a class destructor that calls methods on other objects to release the managed resources.D. Create a class destructor that releases the unmanaged resources.E. Create a Dispose method that calls System.GC.Collect to force garbage collection.F. Create a Dispose method that releases unmanaged resources and calls methods on other objects to

release the managed resources.

Correct Answer: BDF

Page 13: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Section: (none)Explanation

Explanation/Reference:

QUESTION 23You are creating an undo buffer that stores data modifications. You need to ensure that the undo functionalityundoes the most recent data modifications first. You also need to ensure that the undo buffer permits thestorage of strings only. Which code segment should you use?

A. Stack<string> undoBuffer = new Stack<string>();

B. Stack undoBuffer = new Stack();

C. Queue<string> undoBuffer = new Queue<string>();

D. Queue undoBuffer = new Queue();

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 24You need to create a method to clear a Queue named q. Which code segment should you use?

A. foreach (object e in q) { q.Dequeue();}

B. foreach (object e in q) { Enqueue(null);}

C. q.Clear();

D. q.Dequeue();

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 25You are developing a custom-collection class. You need to create a method in your class. You need to ensurethat the method you create in your class returns a type that is compatible with the Foreach statement. Which criterion should the method meet?

A. The method must return a type of either IEnumerator or IEnumerable.B. The method must return a type of IComparable.C. The method must explicitly contain a collection.D. The method must be the only iterator in the class.

Page 14: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 26You are writing a custom dictionary. The custom-dictionary class is named MyDictionary. You need to ensurethat the dictionary is type safe. Which code segment should you use?

A. class MyDictionary : Dictionary<string, string>

B. class MyDictionary : HashTable

C. class MyDictionary : IDictionary

D. class MyDictionary { ... } Dictionary<string, string> t = new Dictionary<st ring, string>();MyDictionary dictionary = (MyDictionary)t;

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 27You are developing a utility screen for a new client application. The utility screen displays a thermometer thatconveys the current status of processes being carried out by the application. You need to draw a rectangle onthe screen to serve as the background of the thermometer as shown in the exhibit. The rectangle must be filledwith gradient shading. (Click the Exhibit button.)

Which code segment should you choose?

A. Rectangle rectangle = new Rectangle(10, 10, 450, 25 ); LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawRectangle(rectanglePen, rectangle);

B. Rectangle rectangle = new Rectangle(10, 10, 450, 25 ); LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.FillRectangle(rectangleBrush, rectangle);

C. RectangleF rectangle = new RectangleF(10f, 10f, 450 f, 25f); Point[] points = new Point[] {new Point(0, 0), new Point(110, 145)}; LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal);

Page 15: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawPolygon(rectanglePen, points);

D. RectangleF rectangle = new RectangleF(10f, 10f, 450 f, 25f); SolidBrush rectangleBrush = new SolidBrush(Color.Al iceBlue); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawRectangle(rectangleBrush, rectangle);

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 28You create an application to send a message by e-mail. An SMTP server is available on the local subnet. TheSMTP server is named smtp.contoso.com. To test the application, you use a source address,[email protected], and a target address, [email protected]. You need to transmit the e-mail message. Which code segment should you use?

A. MailAddress addrFrom = new MailAddress("me@contoso. com", "Me");MailAddress addrTo = new MailAddress("[email protected] om", "You");MailMessage message = new MailMessage(addrFrom, add rTo);message.Subject = "Greetings!";message.Body = "Test ";message.Dispose();

B. string strSmtpClient = "smtp.contoso.com";string strFrom = "[email protected]";string strTo = "[email protected]";string strSubject = "Greetings!";string strBody = "Test";MailMessage msg = new MailMessage(strFrom, strTo, s trSubject, strSmtpClient);

C. MailAddress addrFrom = new MailAddress("me@contoso. com");MailAddress addrTo = new MailAddress("[email protected] om");MailMessage message = new MailMessage(addrFrom, add rTo);message.Subject = "Greetings!";message.Body = "Test ";SmtpClient client = new SmtpClient("smtp.contoso.co m");client.Send(message);

D. MailAddress addrFrom = new MailAddress("me@contoso. com", "Me");MailAddress addrTo = new MailAddress("[email protected] om", "You");MailMessage message = new MailMessage(addrFrom, add rTo);message.Subject = "Greetings!";message.Body = "Test ";SocketInformation info = new SocketInformation();Socket client = new Socket(info);System.Text.ASCIIEncoding enc = new System.Text.ASC IIEncoding();byte[] msgBytes = enc.GetBytes(message.ToString());client.Send(msgBytes);

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 29You create Microsoft Windows-based applications. You create an application that requires users to beauthenticated by a domain controller. The application contains a series of processor-intensive method calls thatrequire different database connections. A bug is reported during testing. The bug description states that the

Page 16: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

application hangs during one of the processor-intensive calls more than 50 percent of the times when themethod is executed. Your unit test for the same method was successful. You need to reproduce the bug. Which two factors should you ascertain from the tester? (Each correct answer presents part of the solution.Choose two.)

A. security credentials of the logged on userB. code access security settingsC. hardware settingsD. network settingsE. database settings

Correct Answer: CDSection: (none)Explanation

Explanation/Reference:

QUESTION 30You are creating an assembly named Assembly1. Assembly1 contains a public method. The global cachecontains a second assembly named Assembly2. You must ensure that the public method is only called fromAssembly2. Which permission class should you use?

A. GacIdentityPermissionB. PublisherIdentityPermissionC. DataProtectionPermissionD. StrongNameIdentityPermission

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

http://www.gratisexam.com/

QUESTION 31You are writing a method to compress an array of bytes. The array is passed to the method in a parameternamed document. You need to compress the incoming array of bytes and return the result as an array ofbytes. Which code segment should you use?

A. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress); byte[] result = new byte[document.Length];deflate.Write(result, 0, result.Length); return result;

B. MemoryStream strm = new MemoryStream(document);

Page 17: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress);deflate.Write(document, 0, document.Length);deflate.Close();return strm.ToArray();

C. MemoryStream strm = new MemoryStream();DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress);deflate.Write(document, 0, document.Length);deflate.Close();return strm.ToArray();

D. MemoryStream inStream = new MemoryStream(document);DeflateStream deflate = new DeflateStream(inStream, CompressionMode.Compress); MemoryStream outStream = new MemoryStream();int b;while ((b = deflate.ReadByte()) != -1) { outStream.WriteByte((byte)b);} return outStream.ToArray();

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 32You are creating a class that uses unmanaged resources. This class maintains references to managedresources on other objects. You need to ensure that users of this class can explicitly release resources whenthe class instance ceases to be needed. Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)

A. Define the class such that it inherits from the WeakReference class.B. Define the class such that it implements the IDisposable interface.C. Create a class destructor that calls methods on other objects to release the managed resources.D. Create a class destructor that releases the unmanaged resources.E. Create a Dispose method that calls System.GC.Collect to force garbage collection.F. Create a Dispose method that releases unmanaged resources and calls methods on other objects to

release the managed resources.

Correct Answer: BDFSection: (none)Explanation

Explanation/Reference:

QUESTION 33You are developing a utility screen for a new client application. The utility screen displays a thermometer thatconveys the current status of processes being carried out by the application. You need to draw a rectangle onthe screen to serve as the background of the thermometer as shown in the exhibit. The rectangle must be filledwith gradient shading. (Click the Exhibit button.)

Page 18: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Which code segment should you choose?

A. Rectangle rectangle = new Rectangle(10, 10, 450, 25 ); LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawRectangle(rectanglePen, rectangle);

B. Rectangle rectangle = new Rectangle(10, 10, 450, 25 ); LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.FillRectangle(rectangleBrush, rectangle);

C. RectangleF rectangle = new RectangleF(10f, 10f, 450 f, 25f); Point[] points = new Point[] {new Point(0, 0), new Point(110, 145)}; LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawPolygon(rectanglePen, points);

D. RectangleF rectangle = new RectangleF(10f, 10f, 450 f, 25f); SolidBrush rectangleBrush = new SolidBrush(Color.Al iceBlue); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawRectangle(rectangleBrush, rectangle);

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 34A Windows Forms application reads the following XML file.

<?xml version="1.0"?><x:catalog xmlns:x="urn:books"><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title></book><book id="bk102"><author>Ralls, Kim</author><title>Midnight Rain</title></book></x:catalog>

The form initialization loads this file into an XmlDocument object named docBooks. You need to populate aListBox control named lstBooks with the concatenated book ID and title of each book. Which code segment should you use?

A. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { string s = node.GetAttribute("id") + " - "; s += node.SelectSingleNode("title").InnerText; lstBooks.Items.Add(s);}

B. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");

Page 19: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

foreach (XmlElement node in elements) { string s = node.SelectSingleNode("id") + " - "; s += node.GetAttribute("title"); lstBooks.Items.Add(s);}

C. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { string s = node.GetAttribute("id") + " - "; s += node.SelectSingleNode("title").Value; lstBooks.Items.Add(s);}

D. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { lstBooks.Items.Add(node.InnerXml);}

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 35A Windows Forms application contains the following code segment.

string SQL = @"SELECT OrderID, ProductID, UnitPrice , Quantity FROM [OrderDetails]";SqlDataAdapter da = new SqlDataAdapter(SQL, connStr );DataTable dt = new DataTable();da.Fill(dt);

You need to add a new column to the data table named ItemSubtotal. The ItemSubtotal column must containthe value of the UnitPrice column multiplied by the value of the Quantity column. Which code segment should you use?

A. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);col.Expression = "UnitPrice * Quantity";dt.Columns.Add(col);

B. dt.Compute("UnitPrice * Quantity", "ItemSubtotal");

C. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);dt.Columns.Add(col);dt.Compute("UnitPrice * Quantity", "ItemSubtotal");

D. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);col.DefaultValue = "UnitPrice * Quantity";dt.Columns.Add(col);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 36You are creating a Windows Forms application that includes the database

Page 20: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

helper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQLServer 2005 database, executes a Transact-SQL statement, and then disconnects from the database. Youmust ensure that changes to the database that result from the UpdateAccount method are committed only if theUpdateOrder method succeeds. You need to execute the UpdateAccount method and the UpdateOrdermethod. Which code segment should you use?

A. using (TransactionScope ts = new TransactionScope() ) { UpdateOrder(); UpdateAccount(); ts.Complete();}

B. using (TransactionScope ts1 = new TransactionScope( )) { UpdateOrder(); using (TransactionScope ts2 = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateAccount(); ts2.Complete(); } ts1.Complete();}

C. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder(); ts.Complete();}using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)){ UpdateAccount(); ts.Complete();}

D. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder();}using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)){ UpdateAccount(); ts.Complete();}

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 37You are creating an assembly named Assembly1. Assembly1 contains a public method. The global cachecontains a second assembly named Assembly2. You must ensure that the public method is only called fromAssembly2. Which permission class should you use?

A. GacIdentityPermissionB. PublisherIdentityPermissionC. DataProtectionPermissionD. StrongNameIdentityPermission

Page 21: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 38You create a DirectorySecurity object for the working directory. You need to identify the user accounts andgroups that have read and write permissions. Which method should you use on the DirectorySecurity object?

A. the GetAuditRules methodB. the GetAccessRules methodC. the AccessRuleFactory methodD. the AuditRuleFactory method

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 39You are developing an application that will use custom authentication and role-based security. You need towrite a code segment to make the runtime assign an unauthenticated principal object to each running thread. Which code segment should you use?

A. AppDomain domain = AppDomain.CurrentDomain;domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPr incipal);

B. AppDomain domain = AppDomain.CurrentDomain;domain.SetThreadPrincipal(new WindowsPrincipal(null ));

C. AppDomain domain = AppDomain.CurrentDomain;domain.SetAppDomainPolicy( PolicyLevel.CreateAppDom ainLevel());

D. AppDomain domain = AppDomain.CurrentDomain;domain.SetPrincipalPolicy( PrincipalPolicy.Unauthen ticatedPrincipal);

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 40You are writing a method to compress an array of bytes. The array is passed to the method in a parameternamed document. You need to compress the incoming array of bytes and return the result as an array ofbytes. Which code segment should you use?

A. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress); byte[] result = new byte[document.Length];deflate.Write(result, 0, result.Length); return result;

Page 22: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

B. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress);deflate.Write(document, 0, document.Length);deflate.Close();return strm.ToArray();

C. MemoryStream strm = new MemoryStream();DeflateStream deflate = new DeflateStream(strm, Com pressionMode.Compress);deflate.Write(document, 0, document.Length);deflate.Close();return strm.ToArray();

D. MemoryStream inStream = new MemoryStream(document);DeflateStream deflate = new DeflateStream(inStream, CompressionMode.Compress); MemoryStream outStream = new MemoryStream();int b;while ((b = deflate.ReadByte()) != -1) { outStream.WriteByte((byte)b);} return outStream.ToArray();

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 41You are creating an application that provides information about the local computer. The application contains aform that lists each logical drive along with the drive properties,such as type,volume label,and capacity.

You need to write a procedure that retrieves properties of each logical drive on the local computer.

What should you do?

To answer, move the three appropriate actions from the list of actions to the answer area and arrange them inthe correct order.

Select and Place:

Page 23: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer:

Section: (none)Explanation

Explanation/Reference:

QUESTION 42You need to write a code segment that will add a string named strConn to the connection string section of theapplication configuration file. Which code segment should you use?

A. Configuration myConfig = ConfigurationManager.OpenE xeConfiguration( ConfigurationUserLevel.None);myConfig.ConnectionStrings.ConnectionStrings.Add( n ew ConnectionStringSettings("ConnStr1", strConn));myConfig.Save();

B. Configuration myConfig = ConfigurationManager.OpenE xeConfiguration( ConfigurationUserLevel.None);myConfig.ConnectionStrings.ConnectionStrings.Add( n ew ConnectionStringSettings("ConnStr1", strConn));ConfigurationManager.RefreshSection( "ConnectionStr ings");

C. ConfigurationManager.ConnectionStrings.Add( new Con nectionStringSettings("ConnStr1",strConn));ConfigurationManager.RefreshSection( "ConnectionStr ings");

D. ConfigurationManager.ConnectionStrings.Add( new Con nectionStringSettings("ConnStr1", strConn));Configuration myConfig = ConfigurationManager.OpenE xeConfiguration( ConfigurationUserLevel.None);myConfig.Save();

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

Page 24: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

QUESTION 43You are creating an undo buffer that stores data modifications. You need to ensure that the undo functionalityundoes the most recent data modifications first. You also need to ensure that the undo buffer permits thestorage of strings only. Which code segment should you use?

A. Stack<string> undoBuffer = new Stack<string>();

B. Stack undoBuffer = new Stack();

C. Queue<string> undoBuffer = new Queue<string>();

D. Queue undoBuffer = new Queue();

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 44You are developing a utility screen for a new client application. The utility screen displays a thermometer thatconveys the current status of processes being carried out by the application. You need to draw a rectangle onthe screen to serve as the background of the thermometer as shown in the exhibit. The rectangle must be filledwith gradient shading. (Click the Exhibit button.)

Which code segment should you choose?

A. Rectangle rectangle = new Rectangle(10, 10, 450, 25 ); LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawRectangle(rectanglePen, rectangle);

B. Rectangle rectangle = new Rectangle(10, 10, 450, 25 ); LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.FillRectangle(rectangleBrush, rectangle);

C. RectangleF rectangle = new RectangleF(10f, 10f, 450 f, 25f); Point[] points = new Point[] {new Point(0, 0), new Point(110, 145)}; LinearGradientBrush rectangleBrush = new LinearGrad ientBrush(rectangle,Color.AliceBlue, Color.CornflowerBlue, LinearGradie ntMode.ForwardDiagonal); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawPolygon(rectanglePen, points);

D. RectangleF rectangle = new RectangleF(10f, 10f, 450 f, 25f); SolidBrush rectangleBrush = new SolidBrush(Color.Al iceBlue); Pen rectanglePen = new Pen(rectangleBrush); Graphics g = this.CreateGraphics(); g.DrawRectangle(rectangleBrush, rectangle);

Page 25: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 45You are creating a class that uses unmanaged resources. This class maintains references to managedresources on other objects. You need to ensure that users of this class can explicitly release resources whenthe class instance ceases to be needed. Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)

A. Define the class such that it inherits from the WeakReference class.B. Define the class such that it implements the IDisposable interface.C. Create a class destructor that calls methods on other objects to release the managed resources.D. Create a class destructor that releases the unmanaged resources.E. Create a Dispose method that calls System.GC.Collect to force garbage collection.F. Create a Dispose method that releases unmanaged resources and calls methods on other objects to

release the managed resources.

Correct Answer: BDFSection: (none)Explanation

Explanation/Reference:

QUESTION 46A Windows Forms application reads the following XML file.

<?xml version="1.0"?><x:catalog xmlns:x="urn:books"><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title></book><book id="bk102"><author>Ralls, Kim</author><title>Midnight Rain</title></book></x:catalog>

The form initialization loads this file into an XmlDocument object named docBooks. You need to populate aListBox control named lstBooks with the concatenated book ID and title of each book. Which code segment should you use?

A. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { string s = node.GetAttribute("id") + " - "; s += node.SelectSingleNode("title").InnerText; lstBooks.Items.Add(s);}

B. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { string s = node.SelectSingleNode("id") + " - "; s += node.GetAttribute("title");

Page 26: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

lstBooks.Items.Add(s);}

C. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { string s = node.GetAttribute("id") + " - "; s += node.SelectSingleNode("title").Value; lstBooks.Items.Add(s);}

D. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { lstBooks.Items.Add(node.InnerXml);}

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 47A Windows Forms application contains the following code segment.

string SQL = @"SELECT OrderID, ProductID, UnitPrice , Quantity FROM [OrderDetails]";SqlDataAdapter da = new SqlDataAdapter(SQL, connStr );DataTable dt = new DataTable();da.Fill(dt);

You need to add a new column to the data table named ItemSubtotal. The ItemSubtotal column must containthe value of the UnitPrice column multiplied by the value of the Quantity column. Which code segment should you use?

A. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);col.Expression = "UnitPrice * Quantity";dt.Columns.Add(col);

B. dt.Compute("UnitPrice * Quantity", "ItemSubtotal");

C. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);dt.Columns.Add(col);dt.Compute("UnitPrice * Quantity", "ItemSubtotal");

D. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);col.DefaultValue = "UnitPrice * Quantity";dt.Columns.Add(col);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 48A method in your Windows Forms application executes a stored procedure in a Microsoft SQL Server 2005database, and then executes a second stored procedure in a second SQL Server 2005 database. You need toensure that the call to the first stored procedure writes changes only if the call to the second stored proceduresucceeds. Installation requirements prohibit you from introducing new components that use the COM+ hosting

Page 27: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

model. What should you do?

A. Implement a transactional serviced component.Add methods to this component to encapsulate the connectoperation and execution of each stored procedure.Register and use this serviced component.

B. Add a TransactionScope block.Connect to each database and execute each stored procedure within theTransactionScope block.Call the TransactionScope.Complete method if the call to both stored proceduresucceeds.

C. Connect to both databases.Call the SqlConnection.BeginTransaction method for each connection.Call theSqlTransaction.Commit method on both returned transactions only if both stored procedures succeed.

D. Add a try-catch-finally block.Connect to each database and execute each stored procedure in the try block.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 49You are creating a Windows Forms application that includes the databasehelper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQLServer 2005 database, executes a Transact-SQL statement, and then disconnects from the database. Youmust ensure that changes to the database that result from the UpdateAccount method are committed only if theUpdateOrder method succeeds. You need to execute the UpdateAccount method and the UpdateOrdermethod. Which code segment should you use?

A. using (TransactionScope ts = new TransactionScope() ) { UpdateOrder(); UpdateAccount(); ts.Complete();}

B. using (TransactionScope ts1 = new TransactionScope( )) { UpdateOrder(); using (TransactionScope ts2 = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateAccount(); ts2.Complete(); } ts1.Complete();}

C. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder(); ts.Complete();}using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)){ UpdateAccount(); ts.Complete();}

D. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder();}using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)){ UpdateAccount();

Page 28: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

ts.Complete();}

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 50You are developing a method to call a COM component. You need to use declarative security to explicitlyrequest the runtime to perform a full stack walk. You must ensure that all callers have the required level of trustfor COM interop before the callers execute your method.Which attribute should you place on the method?

A. [SecurityPermission( SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]B. [SecurityPermission( SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]C. [SecurityPermission( SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)]D. [SecurityPermission( SecurityAction.Deny, Flags = SecurityPermissionFlag.UnmanagedCode)]

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

Page 29: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Exam B

QUESTION 1You create Microsoft Windows-based applications.

You receive the following code segment to review. (Line numbers are included for reference only.)

01 public partial class frmReceivables : Form02 {03 private DataSet ds;04 public frmReceivables()05 {06 InitializeComponent();07 }08 private void frmReceivables(object sender, Event Args e) 09 {10 SqlConnection cn = new SqlConnection(strConnecti onString); 11 SqlDataAdapter daInvoices = new SqlDataAdapter(" SELECT * FROM Invoices", cn); 12 SqlDataAdapter daCustomers = new SqlDataAdapter( "SELECT * FROM Customers",cn); 13 ds = new DataSet("Receivables");14 daInvoices.Fill(ds);15 daCustomers.Fill(ds);16 }17 }

The strConnectionString variable is pre-populated from the application configuration file. Query statements willremain unchanged throughout the life cycle of the application. Connection pooling is not being used. This codesegment accesses a Microsoft SQL Server 2000 database. The ds dataset is bound to a data grid view so thatusers can view and update data in the database. The code currently compiles correctly and works as intended.You need to enhance performance and reliability for this code. Which two actions should you recommend? (Each correct answer presents part of the solution. Choose two.)

A. Use an ODBC DSN instead of a connection string.B. Use OleDbDataAdapter objects instead of SqlDataAdapter objects to populate the dataset.C. Add a line of code before line 14 to open the database connection.D. Add a Try...Catch block and close the connection in the catch block.E. Add a Try...Catch...Finally block and close the connection in the Finally block.

Correct Answer: CESection: (none)Explanation

Explanation/Reference:

QUESTION 2You create Microsoft Windows-based applications. You are designing integration tests for an application thatyour team is developing. Your team uses an application framework that is developed in-house.

The application consumes the following elements:

Third-party Web servicesA third-party API for sending text messages to mobile phones Components from the application framework toaccess SQL Server databases and e-mail messages Managed code to access flat files in the file system

You need to create a report that lists the components that must be considered for integration testing. Which two components should you include? (Each correct answer presents part of the solution. Choose two.)

Page 30: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

A. Web servicesB. messaging APIC. database access components from the application frameworkD. messaging components from the application frameworkE. managed code to access the file system

Correct Answer: ABSection: (none)Explanation

Explanation/Reference:

QUESTION 3You create Microsoft Windows-based applications. You review code for an application that is developed for abank. You need to test a method named Deposit in one of the application components. The following codesegment represents the Deposit method. (Line numbers are included for reference only.)

01 public void Deposit(decimal amount) {03 if (!(amount > 0)) {04 throw new Exception("Invalid deposit amount!");05 } else {06 this.balance += amount;07 }08 }

You use the Microsoft Visual Studio 2005 test feature to automatically generate the following unit test.(Line numbers are included for reference only.)

01 [TestMethod()]02 public void DepositTest() {03 BankAccount target = new BankAccount(); //balanc e will be ZERO 04 decimal amount = 100;05 target.Deposit(amount);06 Assert.Inconclusive("A method that does not retu rn a value cannot beverified.");07 }

You need to change the test method to return a conclusive result. Which line of code should you use to replace the code on line 06?

A. Assert.AreEqual(100M,target.Balance);

B. Assert.IsTrue(target.Balance!=100M);

C. Debug.Assert(target.Balance==100M,passed);

D. Debug.Assert(target.Balance==100M,failed);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 4You create Microsoft Windows-based applications. The sales department uses an application that accessesdata from a local Microsoft Office Access database. To enable sales representatives to access the applicationwhen they are not in the office, you plan to install the application on a terminal server. The application will beaccessed by 200 users simultaneously through a terminal services connection. You need to design an

Page 31: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

appropriate test strategy for the change. Which two tests should you choose? (Each correct answer presents part of the solution. Choose two.)

A. unit testB. load testC. integration testD. coverage testE. Web test

Correct Answer: BCSection: (none)Explanation

Explanation/Reference:

QUESTION 5You create Microsoft Windows-based applications. You are creating a stock trading application. The applicationkeeps track of stock prices and raises events when the stock prices increase or decrease. The events areraised based on specific thresholds. When the events are raised, users specify whether to buy, sell, or hold thestocks. The stock trading application currently uses the Trace class to log the events raised by the applicationand the user responses. The raised events and the user responses are then logged to a Windows applicationlog. You change the application logging mechanism to meet the following requirements:

Log entries are saved in a central database.Log entries are also saved to the local application log.Other applications are able to use the same logging mechanism.The application code is changed as little as possible.

You create a central database to store log entries for multiple databases. You need to choose a system-widelogging mechanism that is reused by the application and is a part of the application design structure. What should you do?

A. Create a custom TraceListener class to save data to a central database. Compile the class to a dynamic-link library (DLL). Use the DLL in the application. Change the code to add an instance of the customTraceListener class to the Listeners collection of the Trace class.

B. Create a custom TraceListener class to save data to a central database. Compile the class to a dynamic-link library (DLL). Use the DLL in the application. Change the code to add an instance of the customTraceListener class to the Listeners collection of the Trace class. Change the application code where logentries are created to create the entry twice, one for the local log and one for the database.

C. Change the application to use a DataSet object to store logging information and save the dataset to thecentral database.

D. Change the application to use a SqlCommand object to insert log entries to the central database.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 6You create Microsoft Windows-based applications. You are creating a method. Your applications will call themethod multiple times. You write the following lines of code for the method.

public string BuildSQL(string strFields, string str Table, string strFilterId) { string sqlInstruction = "SELECT ";

Page 32: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

sqlInstruction += strFields; sqlInstruction += " FROM "; sqlInstruction += strTable; sqlInstruction += " WHERE id ="; sqlInstruction += strFilterid; return sqlInstruction;}

The method generates performance issues. You need to minimize the performance issues that the multiplestring concatenations generate. What should you do?

A. Use a single complex string concatenation.B. Use an array of strings.C. Use an ArrayList object.D. Use a StringBuilder object.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 7You create Microsoft Windows-based applications. Two of your Windows-based applications require the use ofgraphical progress indicators. These indicators are based on bitmap files. Such a component is not available inthe .NET Framework.

To facilitate the search for a component, you identify the following requirements:

Component exposes a property to set a bitmap file that is used for the progress bar. Component permits theuse of at least two types of progress bars. These progress bars are named percent progress and numericprogress.Component exposes a method to increment the progress bar.

You find a component that fulfills all the requirements. You create a new component that extends the originalcomponent and overrides the Increment method. The Windows-based applications might use either the originalcomponent or the extended component. You write a test project to test the component. You need to ensure thatall the requirements are met. You want to achieve this goal by using the minimum amount of programmingeffort. Which component members should you test?

A. Bitmap and Progress Bar Type properties, the Increment method for the original componentB. Bitmap and Progress Bar Type properties, the Increment method for the original component, and the

Increment method for the extended componentC. All properties and methods for the original componentD. All properties and methods for the original component and the extended component

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 8

Page 33: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

You create Microsoft Windows-based applications. You are creating an application that will monitor sales data.

The application must meet the following requirements:

Users must be able to customize display settings and the amount of data to monitor. Users must be able to logon to any computer on the network to use the application. User settings must be retrieved based on the logged-on user from any computer on the network.

You need to decide where to store the user settings. What should you do?

A. Use a XML file stored in the application folder.B. Use the HKEY_LOCAL_MACHINE hive to store user settings.C. Use a table in a central database to store settings for each user.D. Use a serialized settings class and store an object for each user in memory.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 9You create Microsoft Windows-based applications. You create an application that accesses data on a MicrosoftSQL Server 2005 database. You write the following code segment. (Line numbers are included for referenceonly.)

01 private void LoadData()02 {04 cn.Open();05 daProducts.Fill(ds);06 daCategories.Fill(ds);07 cn.Close();09 }

The cn variable points to a SqlConnection object. The SqlConnection object will be opened almost every timethis code segment executes. You need to complete this code segment to ensure that the application continuesto run even if the SqlConnection object is open. You also need to ensure that the performance remainsunaffected. What should you do?

A. Add a Try block on line 03 along with a matching Catch block beginning on line 08 to handle the possibleexception.

B. Add a Try block on line 03 along with a matching Finally block beginning on line 08 to handle the possibleexception.

C. Add the following code to line 03.if (cn.ConnectionState!=ConnectionState.Open)D. Add the following code to line 03.if (cn.ConnectionState==ConnectionState.Closed)

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 10You create Microsoft Windows-based applications. You are responsible for evaluating the deployment of a

Page 34: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

product-pricing application. This application will be deployed on portable computers that are used by a team ofsales personnel.

The application must meet the following requirements:

The application must run successfully on a dial-up connection.Users need to run the application locally.New features are added to the application on a monthly basis.

You need to provide a deployment solution that will ensure your users always have the latest version of theapplication when they connect to the corporate network. What should you recommend?

A. Create a Microsoft Windows Installer MSI installation.B. Create a ClickOnce deployment.C. Create a setup executable that installs your application.D. Create a Web Deployment installation.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 11You create Microsoft Windows-based applications. You are creating a sales management application. Theapplication will consume Web services to retrieve and save data to a database server. These Web services willbe exposed to a partner extranet so that partners can write applications that will access the same data. Thedeployment diagram for the entire solution is as shown in the following exhibit. (Click the Exhibit button.) Afterdeploying the solution, local users and partners report that they are not able to retrieve any data. You find thatthe client computers are able to access Web applications and Web services hosted by the Web server. Youalso find that the local applications are able to access other databases on the database server. You need totroubleshoot the issue. Whatshould you conclude?

Page 35: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

A. Firewall settings are blocking access from the Web server to the database server.B. Firewall settings are blocking access from the client computers to the Web server.C. The Web server is offline.D. The database server is offline.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 12You create Microsoft Windows-based applications. You create a sales management application. Theapplication stores sales data on a Microsoft SQL Server 2005 database that is maintained on a local server.The application retrieves data for analysis and permits users to make changes to the sales data. After theapplication is deployed, users report that the application takes too long to start. You run the application on yourlocal computer to verify the performance and network usage. The performance chart is shown in thePerformance exhibit and the network usage chart is shown in the Networking exhibit. (Click the Exhibit button.)You need to analyze the application code and evaluate the problem. What should you conclude?

Page 36: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

A. The application is consuming too much network resources. It is necessary to debug the application to findout if the issue is related to the application, the network, or the database server.

B. The application is consuming too much network resources. A faster network interface card is required tomake the application perform better.

C. The application is consuming too much processor time. It is necessary to debug the application to find theroot cause.

D. The application is consuming too much processor time. A faster processor is required to make theapplication perform better.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 13You create Microsoft Windows-based applications. You are creating a mathematics educational application.The application will be used to teach students about numeric series. One of the methods in the application isused to calculate a given member of the Fibonacci series. The method uses recursive calls to perform itscalculation. The application calls the method synchronously, and only one instance of the application can berunning at a given time. The application requirements state that the method must take less than 5 seconds toprocess when calculating any of the first 30 members of the Fibonacci series. You profile the application byusing instrumentation. During profiling, you perform a call on the method that is used for calculating the 30thmember of the Fibonacci series. The profiling report, which shows elapsed time in milliseconds, is shown in theexhibit. (Click the Exhibit button.) You need to evaluate the performance of the application based on theestablished requirements.What should you conclude?

Page 37: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

A. The report is inconclusive. A sample profiling is required to verify the requirements.B. The report is inconclusive. A load test is required to verify the requirements.C. The report is conclusive. The requirements are not met.D. The report is conclusive. The requirements are met.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 14You create Microsoft Windows-based applications. You are creating a sales management application for yourcompany. The application will be used by 250 users on the companys network. In the future, the company willbe expanding the user base to include at least 1,000 more users. The application will be stored locally on everycomputer. The application uses a set of assemblies that are installed in the global assembly cache for businessrules. The application retrieves data from a Microsoft SQL Server 2005 database by using a set of methodsfrom a Web service. The SQL Server 2005 database is hosted on a local server. The Web service ismaintained at a local IIS 6.0 Server. You need to evaluate which aspects of the physical design can be modifiedto accommodate more users. Which two aspects should you consider modifying? (Each answer presents part of the solution. Choose two.)

A. Windows-based applicationB. assemblies in the global assembly cacheC. database on the SQL Server 2005 serverD. Web service on the IIS 6.0 ServerE. number of assemblies installed by the application

Correct Answer: CDSection: (none)Explanation

Explanation/Reference:

QUESTION 15You create Microsoft Windows-based applications. You create a banking application that will be used by theaccount managers of the bank.

You identify a method to simulate the deposit functionality of a savings account. The method will calculate thefinal balance when monthly deposit, number of months, and quarterly rate are given. The applicationrequirements state that the following criteria must be used to calculate the balance amount:

Page 38: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Apply the quarterly interest rate to the balance amount of the account every three months. Apply the quarterlyinterest rate before the monthly deposit is calculated for the third month.

You translate the outlined specification into pseudo code. You write the following lines of code. (Line numbersare included for reference only.)

Method

public static decimal SimulateSavings

Input parametersint monthsdecimal monthlyPaymentdecimal quarterlyRate

Pseudo code

01 Declare balance variable, initialize it to zero03 Return balance

You need to insert the appropriate code in line 02. Which code segment should you insert?

A. 01 Declare integer variable, x02 For x=1 to months/32.1 balance = balance + 3 * monthlyPayment2.2 balance = (1 + quarterlyRate) * balance

B. 01 Declare integer variable, x02 For x=1 to months/32.1 balance = balance + 2 * monthlyPayment2.2 balance = (1 + quarterlyRate) * balance2.3 balance = balance + monthlyPayment

C. 01 Declare integer variable, x02 For x=1 to months2.1 balance = balance + monthlyPayment2.2 if x mod 3 is 0 then balance = (1 + quarterlyRa te) * balance

D. 01 Declare integer variable, x02 For x=1 to months2.1 if x mod 3 is 0 then balance = (1 + quarterlyRa te) * balance2.2 balance = balance + monthlyPayment

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 16You create Microsoft Windows-based applications. You are creating a sales management application. Thisapplication will permit sales personnel to search for customer information in a Microsoft SQL Server 2005database. All communication with the database server is done by using an SSL channel.

When a user needs to search for customer information based on a name, the following sequence of actionsoccurs:

1.The user types a name into a text box.2.The user clicks a button to initiate the search.3.The component validates that the value the user types is less than 200 characters. 4.The value that is typed is passed as a string to a component.

Page 39: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

5.The component concatenates the typed value to a Select statement in the Where clause of the component.6.The statement is executed to generate a DataTable object. 7.The DataTable object is used to display the results to the user.

You need to identify the risk factor in this application design. What should you conclude?

A. SQL injection can be used to execute malicious SQL statements.B. Code injection can be used to elevate privileges of malicious code.C. A buffer overflow can be caused by typing a very large string in the text box.D. Canonicalization can be used to add invalid characters to the search string.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 17You create Microsoft Windows-based applications. You are creating an application to manage projects. Yourcurrent customers use Microsoft Windows 2000, Windows XP Professional, and Windows Server 2003, inworkgroup and domain settings.The application must meet the following requirements:

Identify the user for workflow functionality.Store data in a central location on your companys network.Permit data to be stored locally for offline access.

Your application relies on Windows domainCbased authentication to identify the user without logging on to theapplication itself. You decide to use Microsoft SQL Server 2005 as the database engine and save the datalocally in XML format for offline access. You need to identify the risks that are related to your design. Which risk should you identify?

A. The use of XML might limit the number of customers who will use the application.B. The use of SQL Server 2005 might limit the number of customers who will use the application.C. The use of the .NET Framework might limit the number of workstations that can use the application.D. The use of a Windows domain might limit the number of customers who will use the application.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 18You create Microsoft Windows-based applications. You need to evaluate the design concept of an application.

The application must meet the following requirements:

The application relies on the operating system for authentication. The application minimizes the amount of datasent over the network when connecting to the database. The application exposes data access code so that thefuture Web-based and mobile applications can reuse them.The application permits users to view and edit data contained in tables from a Microsoft SQL Server 2005database.

Page 40: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

The application controls access to the SQL Server 2005 database at the table level.

The design contains the following elements:

The SQL Server 2005 database uses the Windows Authentication mode. A database schema that grants rightsto the users at the table level. A stored procedure in Transact-SQL that accesses the necessary data requiredby the application. A Web service that uses a pre-defined credential to access the database and run the storedprocedures. A Microsoft Windows-based application that impersonates the logged-on user and calls the Webservice to retrieve and update the data.You need to evaluate the design and recommend appropriately. What should you recommend?

A. The design meets all the requirements.B. Change the Windows-based application to use Windows Authentication.C. Change the Web service to impersonate the caller.D. Change the database schema to use stored procedures in C#.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 19You create Microsoft Windows-based applications. You create a component that calls an existing function. Thedesign for the function specifies that it might throw an application-specific exception namedInvalidChecksumException, which inherits from System.ApplicationException. The InvalidChecksumExceptionexception is an error that can be handled. But the component cannot handle any other type of error. Thecomponent does not have any additional information that can be added to other types of errors. You need todesign the component to correctly handle exceptions. You also need to ensure that the exception-handlingstrategy does not affect performance. What should you do?

A. Use a catch statement that has a filter for ApplicationExceptions and find the exception type. If it isInvalidChecksumException, handle it automatically or rethrow the exception.

B. Use only a catch statement that has a filter for InvalidChecksumExceptions and handle them automatically.C. Use a catch statement that has an empty filter. Verify the Message property to see if the exception is an

InvalidChecksumException and perform the automatic recovery or rethrow the exception.D. Use a catch statement that has a filter for InvalidChecksumException, followed by another catch statement

that has a filter for Exception. In the first catch block, automatically handle the exception. In the secondcatch block, log the error and rethrow the exception.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 20You create Microsoft Windows-based applications. You are creating a component. The component performsstatistical computations by using sets of data from a large, complex database. According to the designspecification, the component performs a full set of calculations in not more than 5 seconds. Currently, thecomponent takes more than 20 seconds to perform the required calculations. The project is almost completeand you must resolve the performance issues quickly. You need to identify the major processing performanceissues in the component. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

Page 41: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

A. Add custom instrumentation to the component for operations that you expect will exceed performancerequirements.

B. Use SQL Profiler when you run the component to identify long-running database queries.C. Use Microsoft Network Monitor to identify long-running or large network data transfers.D. Use the common language runtime (CLR) profiler to identify the most used and long-running functions in the

component and the specific external functions they call.E. Create a custom test harness that calls individual functions and measures how long they take to run.

Correct Answer: BDSection: (none)Explanation

Explanation/Reference:

QUESTION 21You create Microsoft Windows-based applications. You create a component that is used by 10 Windows-basedapplications. The component contains classes that represent persons. The three main classes are namedCustomer, Contractor, and Employee. These three classes serve as base classes for other classes. All classeshave similar properties. The properties are implemented in a base abstract class called Person. The Customer,Contractor, and Employee classes can be instantiated. The following table describes what each method does inthese classes. Methods are included and implemented as high up in the hierarchy as possible. You need todefine the appropriate method to be implemented in the appropriate base class. What should you do? To answer, drag the appropriate methods to the correct class or classes in the answerarea.

Select and Place:

Correct Answer:

Page 42: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Section: (none)Explanation

Explanation/Reference:

QUESTION 22You create Microsoft Windows-based applications. You create a component to process daily reports. Thesedaily reports are data-driven.

Eight database tables dictate the following properties:

the data that is printedthe format of the datathe order of output

The component loads the configuration data into a specific internal structure. Subsequently, the componentretrieves and outputs the report data based on the configuration settings that are stored in the internal structure.The database is not updated. You need to develop the data handling capabilities of the component to managethe configuration data and the report data. You also need to ensure that the reports are generated as quickly aspossible. Which two data handling mechanisms should you choose? (Each correct answer presents part of the solution.Choose two.)

A. Use a DataReader object to load the report data based on the configuration data. Perform the requiredcalculations.

B. Use a DataReader object to load the configuration data from the database.C. Use a DataAdapter object and a DataSet object to load the configuration data from the database.D. Use a DataAdapter object and a DataSet object to load the report data based on the configuration data.

Perform the required calculations.

Correct Answer: ABSection: (none)

Page 43: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Explanation

Explanation/Reference:

QUESTION 23You create Microsoft Windows-based applications. You are upgrading an application that contains customdata-centric user controls. Each of these controls implements its own custom data-binding logic. Much of thedata-binding code is similar from control to control. You create a new component that combines the commondata-binding logic. You change the existing controls so they use this new component. You need to decide whichtier of the application architecture this component will belong to. Where should you place the component?

A. Presentation tierB. Business tierC. Data access tierD. Data tier

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 24You create Microsoft Windows-based applications. You are creating a component that will encapsulate a datasource. Dozens of applications will use the component.

The component must meet the following design requirements:

1.The component must be able to be modified within a Rapid Application Development environment.2.The component must be without a user interface.

You propose to derive the component from the System.Windows.Forms.Control class and to implement theIComponent interface. You need to decide whether the component will meet the requirements. What should you conclude?

A. The solution meets both the design requirements.B. The solution does not meet any of the design requirements.C. The solution meets the second requirement but not the first requirement.D. The solution meets the first requirement but not the second requirement.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 25You create Microsoft Windows-based applications. You design a composite user control that is used to enter e-mail addresses. The control is as shown in the following exhibit. (Click the Exhibit button.) The control validatesthe user input by using a regular expression. The control validates e-mail addresses and prevents the user fromsubmitting blocked e-mail addresses. The control must permit the user to correct the entry if the user enters ablocked e-mail address. You need to provide feedback if the user enters a blocked e-mail address in thetxtEmailAddress text box.

Page 44: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

What should you do?

A. Write a code segment to throw an application exception.B. Set a custom property of the composite user control to indicate a data validation error.C. Write a code segment to display a message box if the user enters a blocked e-mail address.D. Write a code segment to clear the txtEmailAddress text box if the user enters a blocked e-mail address.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 26You create Microsoft Windows-based applications. You are designing an application that will be deployed toemployees in your company. The company requires that all internal applications are branded with the corporatelogo and a copyright notice. You need to ensure that all forms in the application contain the appropriatebranding and copyright notice. Your solution must be extensible, maintainable, and require minimum effort tolay out. Which solution should you use?

A. Create a reference form with the correct branding and copyright information and copy and paste thecontrols on this form to all other forms.

B. Create a user control with the correct branding and copyright information and add the user control to eachform.

C. Create a base form with the correct branding and copyright information and require all forms in theapplication to inherit from the base form.

D. Create an image with the correct branding and copyright information and add a picture box control to eachform to display the image.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 27You create Microsoft Windows-based applications. You participate in the planning phase of an incident trackingtool for technical support analysts.

The incident tracking tool must meet the following requirements:

Technical support analysts must open multiple incidents simultaneously.The application can run only one instance at a time.Users must be able to adjust the order and layout of the incident screens.

You need to design an application user interface that meets these requirements with the minimum amount ofcode.

Page 45: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Which action should you perform?

A. Create a Multiple Document Interface (MDI) application with a menu strip. Utilize the MdiWindowListItemproperty of the menu strip to automatically merge MDI child forms to the Window list.

B. Create a Single Document Interface application that launches multiple forms. Write code to enable the userto toggle between the active forms.

C. Create a Multiple Document Interface application with a menu strip. Write code to add child Windows to themenu strip to add MDI child forms to the Window list.

D. Create a Single Document Interface application. Create a custom-dockable control that can display eachsupport incident.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 28You create Microsoft Windows-based applications. You are developing an application that will be used by stocktraders. The project scope contains the following requirements:

The application must permit users to set thresholds for minimum and maximum values for different stocks.The application must alert the user when stock prices reach the pre-defined thresholds. The application must permit the user to either buy or sell stock and specify the quantity of stock to trade.The application must permit multiple alerts to be displayed simultaneously.

You need to decide how to implement the alert mechanism. What should you do?

A. Use a modal dialog box to show each alert and to permit the user to trade stocks.B. Use a message box to show each alert and the main application form to permit the user to trade stocks.C. Use a BalloonTip control to display multiple alerts and the main application form to permit the user to trade

stocks.D. Use a custom BalloonTip control to display multiple alerts and to permit the user to trade stocks.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 29You create Microsoft Windows-based applications. You create an application that loads bulk weather data intoa data warehouse for analysis. The application is used by data-entry technicians. One data-entry technician isvisually impaired. The data-entry technicians provide a large flat file as the source of the data, and they typicallyminimize the application so that they can use other programs while the data is being loaded. The data entrytechnicians must load as many data files as possible during the course of their work day. The user interfacecontains a progress bar control that has a text label. The text label indicates the current percentage ofprogress. You need to provide appropriate status feedback to the user by indicating that the process iscomplete. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Write code to change the title bar text of the application when the process is complete.B. Write code to reset the progress bar to its minimum value.

Page 46: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

C. Write code to play a sound that indicates the process is complete.D. Write code to update the status bar text to indicate the number of records processed.E. Write code to display an animated balloon tip when the process completes.

Correct Answer: CESection: (none)Explanation

Explanation/Reference:

QUESTION 30You are creating an assembly named Assembly1. Assembly1 contains a public method. The global cachecontains a second assembly named Assembly2. You must ensure that the public method is only called fromAssembly2. Which permission class should you use?

A. GacIdentityPermissionB. PublisherIdentityPermissionC. DataProtectionPermissionD. StrongNameIdentityPermission

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 31You create a class library that contains the class hierarchy defined in the following code segment. (Linenumbers are included for reference only.)

01 public class Group {02 public Employee[] Employees;03 }04 public class Employee {05 public string Name;06 }07 public class Manager : Employee {08 public int Level;09 }

You create an instance of the Group class. You populate the fields of the instance. When you attempt toserialize the instance by using the Serialize method of the XmlSerializer class, you receiveInvalidOperationException. You also receive the following error message: "There was an error generating theXML document." You need to modify the code segment so that you can successfully serialize instances of theGroup class by using the XmlSerializer class. You also need to ensure that the XML output contains an elementfor all public fields in the class hierarchy. What should you do?

A. Insert the following code between lines 1 and 2 of the code segment: [XmlArrayItem(Type = typeof(Employee))] [XmlArrayItem(Type = typeof(Manager))]

B. Insert the following code between lines 1 and 2 of the code segment: [XmlElement(Type = typeof(Employees))]

C. Insert the following code between lines 1 and 2 of the code segment: [XmlArray

Page 47: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

(ElementName="Employees")]D. Insert the following code between lines 3 and 4 of the code segment: [XmlElement(Type = typeof

(Employee))] andInsert the following code between lines 6 and 7 of the code segment: [XmlElement(Type = typeof(Manager))]

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 32You need to create a method to clear a Queue named q. Which code segment should you use?

A. foreach (object e in q) { q.Dequeue();}

B. foreach (object e in q) { Enqueue(null);}

C. q.Clear();

D. q.Dequeue();

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 33You are creating a class that uses unmanaged resources. This class maintains references to managedresources on other objects. You need to ensure that users of this class can explicitly release resources whenthe class instance ceases to be needed. Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)

A. Define the class such that it inherits from the WeakReference class.B. Define the class such that it implements the IDisposable interface.C. Create a class destructor that calls methods on other objects to release the managed resources.D. Create a class destructor that releases the unmanaged resources.E. Create a Dispose method that calls System.GC.Collect to force garbage collection.F. Create a Dispose method that releases unmanaged resources and calls methods on other objects to

release the managed resources.

Correct Answer: BDFSection: (none)Explanation

Explanation/Reference:

Page 48: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

QUESTION 34You create Microsoft Windows-based applications. You need to evaluate the design concept of an application.

The application must meet the following requirements:

The application relies on the operating system for authentication. The application minimizes the amount of datasent over the network when connecting to the database. The application exposes data access code so that thefuture Web-based and mobile applications can reuse them.The application permits users to view and edit data contained in tables from a Microsoft SQL Server 2005database.The application controls access to the SQL Server 2005 database at the table level.

The design contains the following elements:

The SQL Server 2005 database uses the Windows Authentication mode. A database schema that grants rightsto the users at the table level. A stored procedure in Transact-SQL that accesses the necessary data requiredby the application. A Web service that uses a pre-defined credential to access the database and run the storedprocedures. A Microsoft Windows-based application that impersonates the logged-on user and calls the Webservice to retrieve and update the data.You need to evaluate the design and recommend appropriately. What should you recommend?

A. The design meets all the requirements.B. Change the Windows-based application to use Windows Authentication.C. Change the Web service to impersonate the caller.D. Change the database schema to use stored procedures in C#.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 35You create Microsoft Windows-based applications. You are creating a component that will encapsulate a datasource. Dozens of applications will use the component.

The component must meet the following design requirements:

1.The component must be able to be modified within a Rapid Application Development environment.2.The component must be without a user interface.

You propose to derive the component from the System.Windows.Forms.Control class and to implement theIComponent interface. You need to decide whether the component will meet the requirements. What should you conclude?

A. The solution meets both the design requirements.B. The solution does not meet any of the design requirements.C. The solution meets the second requirement but not the first requirement.D. The solution meets the first requirement but not the second requirement.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

Page 49: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

QUESTION 36A Windows Forms application contains the following code segment.

string SQL = @"SELECT OrderID, ProductID, UnitPrice , Quantity FROM [OrderDetails]";SqlDataAdapter da = new SqlDataAdapter(SQL, connStr );DataTable dt = new DataTable();da.Fill(dt);

You need to add a new column to the data table named ItemSubtotal. The ItemSubtotal column must containthe value of the UnitPrice column multiplied by the value of the Quantity column. Which code segment should you use?

A. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);col.Expression = "UnitPrice * Quantity";dt.Columns.Add(col);

B. dt.Compute("UnitPrice * Quantity", "ItemSubtotal");

C. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);dt.Columns.Add(col);dt.Compute("UnitPrice * Quantity", "ItemSubtotal");

D. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);col.DefaultValue = "UnitPrice * Quantity";dt.Columns.Add(col);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 37You create a DirectorySecurity object for the working directory. You need to identify the user accounts andgroups that have read and write permissions. Which method should you use on the DirectorySecurity object?

A. the GetAuditRules methodB. the GetAccessRules methodC. the AccessRuleFactory methodD. the AuditRuleFactory method

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 38You create Microsoft Windows-based applications. You are creating an application that will monitor sales data.

The application must meet the following requirements:

Users must be able to customize display settings and the amount of data to monitor. Users must be able to log

Page 50: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

on to any computer on the network to use the application. User settings must be retrieved based on the logged-on user from any computer on the network.

You need to decide where to store the user settings. What should you do?

A. Use a XML file stored in the application folder.B. Use the HKEY_LOCAL_MACHINE hive to store user settings.C. Use a table in a central database to store settings for each user.D. Use a serialized settings class and store an object for each user in memory.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

Page 51: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Exam C

QUESTION 1You are customizing a Windows Form to asynchronously update a database in a method named WorkHandler.You need to ensure that the form displays a message box to the user that indicates the success or failure of theupdate. Which code segment should you use?

A. private void StartBackgroundProcess() { bgwExecute.DoWork += new DoWorkEventHandler(WorkHa ndler); bgwExecute.RunWorkerCompleted += new RunWorkerComp letedEventHandler(CompletedHandler); bgwExecute.RunWorkerAsync();}void CompletedHandler(object sender, RunWorkerCompl etedEventArgs e) { bool result = (bool)e.Result; MessageBox.Show("Update " + (result ? "was success ful" : "failed"));}void WorkHandler(object sender, DoWorkEventArgs e) { //... e.Result = true; }

B. private void StartBackgroundProcess() { bgwExecute.ProgressChanged += new ProgressChangedE ventHandler(CompletedHandler); ThreadStart tsBackground = new ThreadStart(WorkHan dler); bgwExecute.RunWorkerAsync(tsBackground); }void ProgressHandler(object sender, ProgressChanged EventArgs e) { bool result = (bool)e.UserState; MessageBox.Show("Update " + (result ? "was success ful" : "failed"));}void WorkHandler() { //... bgwExecute.ReportProgress(100, true); }

C. private void StartBackgroundProcess() { bgwExecute.RunWorkerCompleted += new RunWorkerComp letedEventHandler(CompletedHandler); ThreadStart tsBackground = new ThreadStart(WorkHan dler); bgwExecute.RunWorkerAsync(tsBackground); }void CompletedHandler(object sender, RunWorkerCompl etedEventArgs e) { bool result = (bool)e.Result; MessageBox.Show("Update " + (result ? "was success ful" : "failed"));}void WorkHandler() { //... e.Result = true; }

D. private void StartBackgroundProcess() { bgwExecute.DoWork += new DoWorkEventHandler(WorkHa ndler); bgwExecute.RunWorkerCompleted += new RunWorkerComp letedEventHandler(CompletedHandler); bgwExecute.RunWorkerAsync();}void CompletedHandler(object sender, RunWorkerCompl etedEventArgs e) { bool result = (bool)e.Result; MessageBox.Show("Update " + (result ? "was success ful" : "failed"));}void WorkHandler(object sender, DoWorkEventArgs e) { //... bgwExecute.ReportProgress(100, true);

Page 52: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

}

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 2You are customizing a Windows Form to asynchronously update a database. You need to ensure that the formdisplays a message box to the user that indicates the success or failure of the update. Which three code segments should you use? (Each correct answer presents part of the solution. Choosethree.)

A. private void StartBackgroundProcess() { bgwExecute.DoWork += new DoWorkEventHandler(WorkHa ndler); bgwExecute.RunWorkerCompleted += new RunWorkerComp letedEventHandler(CompletedHandler); bgwExecute.RunWorkerAsync();}

B. private void StartBackgroundProcess() { bgwExecute.ProgressChanged += new ProgressChangedE ventHandler(CompletedHandler); ThreadStart tsBackground = new ThreadStart(WorkHan dler); bgwExecute.RunWorkerAsync(tsBackground); }

C. private void StartBackgroundProcess() { bgwExecute.RunWorkerCompleted += new RunWorkerComp letedEventHandler(CompletedHandler); ThreadStart tsBackground = new ThreadStart(WorkHan dler); bgwExecute.RunWorkerAsync(tsBackground); }

D. void WorkHandler(object sender, DoWorkEventArgs e) { //... e.Result = true; }

E. void WorkHandler(object sender, DoWorkEventArgs e) { //... bgwExecute.ReportProgress(100, true); }

F. void CompletedHandler(object sender, RunWorkerCompl etedEventArgs e) { bool result = (bool)e.Result; MessageBox.Show("Update " + (result ? "was success ful" : "failed"));}

G. void ProgressHandler(object sender, ProgressChanged EventArgs e) { bool result = (bool)e.UserState; MessageBox.Show("Update " + (result ? "was success ful" : "failed"));}

Correct Answer: ADFSection: (none)Explanation

Explanation/Reference:

QUESTION 3You are customizing a Windows Form to update a database asynchronously by using an instance of a

Page 53: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

BackgroundWorker component named bgwExecute. You start the component by using the following code.

private void StartBackgroundProcess() { bgwExecute.DoWork += new DoWorkEventHandler(WorkHa ndler); bgwExecute.RunWorkerCompleted += new RunWorkerComp letedEventHandler(CompletedHandler); bgwExecute.ProgressChanged += new ProgressChangedEventHandler(ProgressChanged); bgwExecute.RunWorkerAsync();}

If the UpdateDB method that is called by the BackgroundWorker component returns the value False, you needto display a message box to the user that indicates that the update failed. Which code segment should you use?

A. void WorkHandler(object sender, DoWorkEventArgs e) { if (!UpdateDB()) MessageBox.Show("Update failed");}

B. void CompletedHandler(object sender, RunWorkerCompl etedEventArgs e) { if (! UpdateDB()) MessageBox.Show("Update failed") ;}

C. void WorkHandler(object sender, DoWorkEventArgs e) { e.Result = UpdateDB();} void CompletedHandler(object sender, RunWorkerCompl etedEventArgs e) { if (!(bool) e.Result) MessageBox.Show("Update fail ed");}

D. void WorkHandler(object sender, DoWorkEventArgs e) { e.Result = UpdateDB();} void CompletedHandler(object sender, RunWorkerCompl etedEventArgs e) { if (!(bool) e.Result) bgwExecute.ReportProgress(0) ;} void ProgressChanged(object sender, ProgressChanged EventArgs e) { if (e.ProgressPercentage==0) MessageBox.Show("Upda te failed");}

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 4You want to execute an event handler asynchronously from a Windows Form. You need to execute a methodnamed WorkHandler by using an instance of the BackgroundWorker component named bgwExecute. Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)

A. EventHandler work = new EventHandler(WorkHandler);B. ThreadStart work = new ThreadStart(WorkHandler);C. bgwExecute.DoWork += new DoWorkEventHandler(WorkHandler);D. bgwExecute.RunWorkerAsync();E. bgwExecute.RunWorkerAsync(work);

Correct Answer: CDSection: (none)Explanation

Page 54: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Explanation/Reference:

QUESTION 5You are customizing a Windows Form to use a BackgroundWorker component named bgwExecute.bgwExecute performs a database operation in an event handler named WorkHandler. You need to ensure thatusers can see the progress of the database operation by viewing a progress bar named pbProgress. You wantthe progress bar to appear when the database operation is 50 percent complete. Which code segment should you use?

A. public void StartBackground() { bgwExecute.WorkerReportsProgress = true; bgwExecute.ProgressChanged += new ProgressChangedE ventHandler(ProgressHandler); bgwExecute.RunWorkerAsync();}void WorkHandler(object sender, DoWorkEventArgs e) { bgwExecute.ReportProgress(50);}void ProgressHandler(object sender, ProgressChanged EventArgs e) { pbProgress.Value = e.ProgressPercentage;}

B. public void StartBackground() { bgwExecute.WorkerReportsProgress = true; bgwExecute.ProgressChanged += new ProgressChangedE ventHandler(ProgressHandler); ThreadStart t = new ThreadStart(WorkHandler); bgwExecute.RunWorkerAsync(t);}void WorkHandler() { bgwExecute.ReportProgress(50);}void ProgressHandler(object sender, ProgressChanged EventArgs e) { pbProgress.Value = e.ProgressPercentage;}

C. public void StartBackground() { bgwExecute.WorkerReportsProgress = true; bgwExecute.ProgressChanged += new ProgressChangedE ventHandler(ProgressHandler); Thread t = new Thread(new ThreadStart(WorkHandler) ); bgwExecute.RunWorkerAsync(t);}void WorkHandler() { bgwExecute.ReportProgress(50);}void ProgressHandler(object sender, ProgressChanged EventArgs e) { pbProgress.Value = e.ProgressPercentage;}

D. public void StartBackground() { bgwExecute.WorkerReportsProgress = true; bgwExecute.DoWork += new DoWorkEventHandler(WorkHa ndler); bgwExecute.ProgressChanged += new ProgressChangedE ventHandler(ProgressHandler); bgwExecute.RunWorkerAsync();}void WorkHandler(object sender, DoWorkEventArgs e) { bgwExecute.ReportProgress(50);}void ProgressHandler(object sender, ProgressChanged EventArgs e) { pbProgress.Value = e.ProgressPercentage;}

Page 55: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 6You want to execute an event handler asynchronously from a Windows Form. You need to write code that usesthe BackgroundWorker component named bgwExecute to execute the WorkHandler method. Which code segment should you use?

A. EventHandler work = new EventHandler(WorkHandler);bgwExecute.RunWorkerAsync(work);

B. ThreadStart tsBackground = new ThreadStart(WorkHand ler);bgwExecute.ReportProgress(100,tsBackground);

C. ThreadStart tsBackground = new ThreadStart(WorkHand ler);bgwExecute.RunWorkerAsync(tsBackground);

D. bgwExecute.DoWork += new DoWorkEventHandler(WorkHan dler);bgwExecute.RunWorkerAsync();

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 7You are creating a Windows Forms application. You set the FlatAppearance.MouseOverBackColor property ofa button to Blue. When testing the application, you notice that the background color does not change when youmove the pointer over the button. You need to set the properties of the button so that the background color forthe button changes to blue when the pointer moves over the button. What should you do?

A. Set the FlatStyle property to FlatStyle.Flat.B. Set the FlatStyle property to FlatStyle.System.C. Move the set statement for the FlatAppearance.MouseOverBackColor property to the Paint event.D. Set the UseVisualStyleBackColor property to False.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 8You are creating a Windows Form that contains several ToolStrip controls. You need to add functionality thatallows a user to drag any ToolStrip control from one edge of the form to another. What should you do?

A. Configure a ToolStripContainer control to fill the form. Add the ToolStrip controls to the ToolStripContainercontrol.

B. Configure a Panel control to fill the form. Set the Anchor properties of the ToolStrip controls to Top, Bottom,

Page 56: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Left, Right.C. Add the ToolStrip controls to another ToolStrip control that is hosted by a ToolStripControlHost control.D. Add the ToolStrip controls to the form. Set the Anchor properties of the ToolStrip controls to Top, Bottom,

Left, Right.Set the FormBorderStyle property of the form to SizableToolWindow.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

http://www.gratisexam.com/

QUESTION 9You are creating a Windows Forms application. You add an ErrorProvider component named erpErrors and aDateTimePicker control named dtpStartDate to the application. The application also contains other controls.You need to configure the application to display an error notification icon next to dtpStartDate when the userenters a date that is greater than today's date. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. For the Validating event of dtpStartDate, create an event handler named VerifyStartDate.B. For the Validated event of dtpStartDate, create an event handler named VerifyStartDate.C. In the Properties Window for dtpStartDate, set the value of Error on erpErrors to Date out of range.D. In VerifyStartDate, call erpErrors.SetError(dtpStartDate, "Date out of range") if the value of

dtpStartDate.Value is greater than today's date.E. In VerifyStartDate, call erpErrors.SetError(dtpStartDate, null) if the dtpStartDate.Value is greater than

today's date.

Correct Answer: AESection: (none)Explanation

Explanation/Reference:

QUESTION 10You are creating a Windows Form. You add a TableLayoutPanel control named pnlLayout to the form. You setthe properties of pnlLayout so that it will resize with the form. You need to create a three-column layout that hasfixed left and right columns. The fixed columns must each remain 50 pixels wide when the form is resized. Themiddle column must fill the remainder of the form width when the form is resized. You add the three columns inthe designer. Which code segment should you use to format the columns at run time?

A. pnlLayout.ColumnStyles.Clear();pnlLayout.ColumnStyles.Add(new ColumnStyle(SizeType .Absolute, 50F));pnlLayout.ColumnStyles.Add(new ColumnStyle(SizeType .AutoSize, 100F));pnlLayout.ColumnStyles.Add(new ColumnStyle(SizeType .Absolute, 50F));

B. pnlLayout.ColumnStyles[0].Width = 50F;pnlLayout.ColumnStyles[0].SizeType = SizeType.Absol ute;pnlLayout.ColumnStyles[2].Width = 50F;pnlLayout.ColumnStyles[2].SizeType = SizeType.Absol ute;

Page 57: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

C. pnlLayout.ColumnStyles[0].Width = 50F;pnlLayout.ColumnStyles[0].SizeType = SizeType.Absol ute;pnlLayout.ColumnStyles[1].Width = 100F;pnlLayout.ColumnStyles[1].SizeType = SizeType.AutoS ize;pnlLayout.ColumnStyles[2].Width = 50F;pnlLayout.ColumnStyles[2].SizeType = SizeType.Absol ute;

D. pnlLayout.ColumnStyles.Clear();pnlLayout.ColumnStyles.Add(new ColumnStyle(SizeType .Absolute, 50F));pnlLayout.ColumnStyles.Add(new ColumnStyle(SizeType .Percent, 100F));pnlLayout.ColumnStyles.Add(new ColumnStyle(SizeType .Absolute, 50F));

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 11You are creating a Windows Form that includes a TextBox control named txtDate. When a user right-clickswithin the text box, you want the application to display a MonthCalendar control. You need to implement acontext menu that provides this functionality. What should you do?

A. Add the following code to the form initialization.

MonthCalendar cal = new MonthCalendar();ContextMenuStrip mnuContext = new ContextMenuStrip( );ToolStripControlHost host = new ToolStripControlHos t(mnuContext);txtDate.ContextMenuStrip = mnuContext;

B. Add the following code to the form initialization.

ContextMenuStrip mnuContext = new ContextMenuStrip( );MonthCalendar cal = new MonthCalendar();ToolStripControlHost host = new ToolStripControlHos t(cal);mnuContext.Items.Add(host);txtDate.ContextMenuStrip = mnuContext;

C. Add the following code to the form initialization.

ToolStripContainer ctr = new ToolStripContainer();MonthCalendar cal = new MonthCalendar();ctr.ContentPanel.Controls.Add(cal);txtDate.Controls.Add(ctr);

Add a MouseClick event handler for the TextBox control that contains the following code.

if (e.Button == MouseButtons.Right) { txtDate.Controls[0].Show();}

D. Add a MouseClick event handler for the TextBox control that contains the following code.

if (e.Button == MouseButtons.Right) { ContextMenuStrip mnuContext = new ContextMenuStrip (); MonthCalendar cal = new MonthCalendar(); ToolStripControlHost host = new ToolStripControlHo st(cal); mnuContext.Items.Add(host); txtDate.ContextMenuStrip = mnuContext;}

Page 58: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 12You are customizing a Windows Form. You need to add an input control that provides AutoCompletesuggestions to the user as the user types. Which two controls can you use to achieve this goal? (Each correct answer presents a complete solution.Choose two.)

A. TextBox control set to SingleLine modeB. TextBox control set to MultiLine modeC. ComboBox controlD. RichTextBox controlE. MaskedTextBox control

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:

QUESTION 13You are configuring a ClickOnce deployment that allows users to install your application from the Internet zoneunder partial trust permissions. You want the application to access data that resides on the same remote serverfrom which the application is installed. You need to add one or more types of data access that are allowedunder partial trust permissions to your application. Which type or types of data access are allowed? (Choose all that apply.)

A. data access through HTTP with System.Net.WebClientB. data access through XML Web servicesC. data access through System.Data.SqlClientD. data access through HTTP with System.Net.HttpWebRequest

Correct Answer: ABDSection: (none)Explanation

Explanation/Reference:

QUESTION 14You create a Windows-based application that requires the use of a COM component. You need to create aClickOnce deployment package to distribute the application from an Internet Web site. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Set the Isolated property of the COM component references in the application project to False.B. Set the Isolated property of the COM component references in the application project to True.C. Verify that the user is using Microsoft Windows XP.

Page 59: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

D. Verify that the user is using Microsoft Windows 2000.E. Assign RegistryPermission to the application.

Correct Answer: BCSection: (none)Explanation

Explanation/Reference:

QUESTION 15You are creating a ClickOnce application that requires elevated permissions by default. You need to identify thedefault security zones for each deployment location. Which default security zone is appropriate to use in eachdeployment location? To answer, drag the appropriate security zones to the correct deployment locations in theanswer area. Each security zone can be used more than once.

Select and Place:

Correct Answer:

Section: (none)Explanation

Explanation/Reference:

QUESTION 16You are creating an application named App1. You use ClickOnce deployment to distribute App1.exe andmultiple assemblies. Some users require only some of the functionality in App1. You need to limit the size of theinitial download of the application. You also need to ensure that users can download the assemblies ondemand.

Page 60: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)

A. Mark each dependency in App1.exe.manifest as optional.B. Mark each dependency in App1.application as optional.C. Create an event handler for the AppDomain.ResourceResolve event named ResolveAssembly.D. Create an event handler for the AppDomain.AssemblyLoad event named ResolveAssembly.E. In the ResolveAssembly event handler, set the ApplicationDeployment.CurrentDeployment.ActivationUri

property to the location of your required assembly.F. In the ResolveAssembly event handler, call ApplicationDeployment.DownloadFiles and pass in the name of

the assembly you want.

Correct Answer: ACFSection: (none)Explanation

Explanation/Reference:

QUESTION 17You are modifying a Windows Forms application. The application consists of a main window with many differentcontrols. All of the controls provide tool tips that use the default ToolTip control settings. One group of controlsprovides tool tips that show regulatory guidance for the user. Users want the wait time when reading the tooltips and navigating among them to be minimal. You need to ensure that this group of controls provides shortdelays before the tool tips appear. What should you do?

A. Set the AutoPopDelay property of the ToolTip control to 0 and the InitialDelay property to 100.B. Set the AutomaticDelay property of the ToolTip control to 0.C. Set the InitialDelay and ReshowDelay properties of the ToolTip control to 100.D. Set the AutoPopDelay property of the ToolTip control to 100.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 18A Windows Forms application reads the following XML file.

<?xml version="1.0"?><x:catalog xmlns:x="urn:books"><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title></book><book id="bk102"><author>Ralls, Kim</author><title>Midnight Rain</title></book></x:catalog>

The form initialization loads this file into an XmlDocument object named docBooks. You need to populate aListBox control named lstBooks with the concatenated book ID and title of each book. Which code segment should you use?

Page 61: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

A. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { string s = node.GetAttribute("id") + " - "; s += node.SelectSingleNode("title").InnerText; lstBooks.Items.Add(s);}

B. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { string s = node.SelectSingleNode("id") + " - "; s += node.GetAttribute("title"); lstBooks.Items.Add(s);}

C. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { string s = node.GetAttribute("id") + " - "; s += node.SelectSingleNode("title").Value; lstBooks.Items.Add(s);}

D. XmlNodeList elements = docBooks.GetElementsByTagNam e("book");foreach (XmlElement node in elements) { lstBooks.Items.Add(node.InnerXml);}

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 19You are creating a Windows Forms application. The application executes a stored procedure that takes severalseconds to complete. The stored procedure is invoked to populate a SqlDataReader object. You need toensure that the application remains responsive to the user while the stored procedure is executing. What should you do?

A. Use the SqlCommand.BeginExecuteReader method to call the stored procedure.Retrieve results by usingthe EndExecuteReader method.

B. Use the SqlCommand.ExecuteReader method.Set the behavior parameter of this method toCommandBehavior.SequentialAccess.

C. Create and bind a SqlDependency object to a SqlCommand object. Call the SqlCommand.ExecuteReadermethod.Associate an OnChanged event handler with the SqlDependency object. Gather results in theOnChanged event handler method.

D. Set the Notification property of a SqlCommand object to a SqlNotificationRequest object. Call theSqlCommand.ExecuteReader method.Gather results on a background thread.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 20A Windows Forms application contains the following code segment.

Page 62: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

string SQL = @"SELECT EmployeeID, LastName, FirstNa me FROM Employees";SqlDataAdapter da = new SqlDataAdapter(SQL, connStr );DataTable dt = new DataTable();da.MissingSchemaAction = MissingSchemaAction.AddWit hKey;SqlCommandBuilder bld = new SqlCommandBuilder(da);da.Fill(dt);

The application allows the user to add rows to the data table. The application will propagate these additions tothe database. If the addition of any row fails, the other rows must still be added. The code must log how manynew rows failed to be added. You need to propagate the additions to the database and log a failed count. Which code segment should you use?

A. da.ContinueUpdateOnError = true;da.Update(dt);DataTable dtErrors = dt.GetChanges(DataRowState.Unc hanged);Trace.WriteLine(dtErrors.Rows.Count.ToString() + " rows not added.");

B. da.ContinueUpdateOnError = false;da.Update(dt);DataTable dtErrors = dt.GetChanges(DataRowState.Unc hanged);Trace.WriteLine(dtErrors.Rows.Count.ToString() + " rows not added.");

C. da.ContinueUpdateOnError = true;da.Update(dt);DataRow[] rows = dt.GetErrors();Trace.WriteLine(rows.Length.ToString() + " rows not added.");

D. da.ContinueUpdateOnError = false;da.Update(dt);DataRow[] rows = dt.GetErrors();Trace.WriteLine(rows.Length.ToString() + " rows not added.");

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 21A Windows Forms application contains the following code segment.

string SQL = @"SELECT OrderID, ProductID, UnitPrice , Quantity FROM [OrderDetails]";SqlDataAdapter da = new SqlDataAdapter(SQL, connStr );DataTable dt = new DataTable();da.Fill(dt);

You need to add a new column to the data table named ItemSubtotal. The ItemSubtotal column must containthe value of the UnitPrice column multiplied by the value of the Quantity column. Which code segment should you use?

A. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);col.Expression = "UnitPrice * Quantity";dt.Columns.Add(col);

B. dt.Compute("UnitPrice * Quantity", "ItemSubtotal");

C. DataColumn col = new DataColumn("ItemSubtotal");col.DataType = typeof(decimal);dt.Columns.Add(col);dt.Compute("UnitPrice * Quantity", "ItemSubtotal");

D. DataColumn col = new DataColumn("ItemSubtotal");

Page 63: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

col.DataType = typeof(decimal);col.DefaultValue = "UnitPrice * Quantity";dt.Columns.Add(col);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 22You are creating a Windows Forms application. Initialization code loads a DataSet object named ds thatincludes a table named Users. The Users table includes a column named IsManager. You need to bind theIsManager column to the Checked property of a check box named chkIsManager. Which code segment should you use?

A. chkIsManager.DataBindings.Add("Checked", ds, "Users .IsManager");

B. chkIsManager.DataBindings.Add("Checked", ds, "IsMan ager");

C. chkIsManager.Text = "{Users.IsManager}";chkIsManage r.AutoCheck = true;

D. this.DataBindings.Add("chkIsManager.Checked", ds, " Users.IsManager");

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 23You are creating a Windows Forms application. The application loads a data table named dt from a databaseand modifies each value in the data table. You add the following code.(Line numbers are included for reference only.)

01 foreach (DataRow row in dt.Rows) {02 foreach (DataColumn col in dt.Columns) {04 Trace.WriteLine(str);05 }06 }

You need to format the string named str to show the value of the column at the time the data is loaded and thecurrent value in the column. Which code segment should you add at line 03?

A. string str = String.Format("Column was {0} is now { 1}", row[col], row[col,DataRowVersion.Current]);

B. string str = String.Format("Column was {0} is now { 1}", row[col,DataRowVersion.Default], row[col]);

C. string str = String.Format("Column was {0} is now { 1}", row[col], row[col,DataRowVersion.Proposed]);

D. string str = String.Format("Column was {0} is now { 1}", row[col,DataRowVersion.Original], row[col]);

Correct Answer: DSection: (none)Explanation

Page 64: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Explanation/Reference:

QUESTION 24You are creating a Windows Forms application that implements a master/detail form by using twoDataGridView controls. You populate a dataset with a master table and a details table. You set the DataSourceproperty of the master DataGridView control to the dataset. You set the DataMember property to the name ofthe master table. You also set the DataSource property of the details DataGridView control to the dataset. Youneed to ensure that the details DataGridView control displays only the child rows of the selected master row. What should you do?

A. Add a foreign key constraint to the dataset.Set the DataMember property of the child DataGridView controlto the name of the foreign key constraint.

B. Define a data relation between the master table and details table in the dataset.Set the DataMemberproperty of the child DataGridView to the name of the data relation.

C. Add a foreign key constraint to the dataset.Set the DataMember property of the child DataGridView controlto the name of the details table.

D. Define a data relation between the master table and details table in the dataset.Bind the detailsDataGridView control to the dataset.Set the DataMember property of the child DataGridView control to thename of the details table.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 25You are creating a Windows Forms application to retrieve and modify data. Depending on the installation, thedata source can be a Microsoft Access database or a Microsoft SQL Server 2000 or later database. You needto ensure that your application accesses data by automatically using the data provider that is optimized for thedata source. What should you do?

A. Use the ODBC data provider classes.B. Use the OLE DB data provider classes.C. Use the SQL Server data provider classes.D. Use the DbProviderFactory class and related classes.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 26A method in your Windows Forms application executes a stored procedure in a Microsoft SQL Server 2005database, and then executes a second stored procedure in a second SQL Server 2005 database. You need toensure that the call to the first stored procedure writes changes only if the call to the second stored proceduresucceeds. Installation requirements prohibit you from introducing new components that use the COM+ hostingmodel. What should you do?

Page 65: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

A. Implement a transactional serviced component.Add methods to this component to encapsulate the connectoperation and execution of each stored procedure.Register and use this serviced component.

B. Add a TransactionScope block.Connect to each database and execute each stored procedure within theTransactionScope block.Call the TransactionScope.Complete method if the call to both stored proceduresucceeds.

C. Connect to both databases.Call the SqlConnection.BeginTransaction method for each connection.Call theSqlTransaction.Commit method on both returned transactions only if both stored procedures succeed.

D. Add a try-catch-finally block.Connect to each database and execute each stored procedure in the try block.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 27You are creating a Windows Forms application that includes the databasehelper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQLServer 2005 database, executes a Transact-SQL statement, and then disconnects from the database. Youmust ensure that changes to the database that result from the UpdateAccount method are committed only if theUpdateOrder method succeeds. You need to execute the UpdateAccount method and the UpdateOrdermethod. Which code segment should you use?

A. using (TransactionScope ts = new TransactionScope() ) { UpdateOrder(); UpdateAccount(); ts.Complete();}

B. using (TransactionScope ts1 = new TransactionScope( )) { UpdateOrder(); using (TransactionScope ts2 = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateAccount(); ts2.Complete(); } ts1.Complete();}

C. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder(); ts.Complete();}using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)){ UpdateAccount(); ts.Complete();}

D. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder();}using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)){ UpdateAccount(); ts.Complete();}

Page 66: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 28You are creating a Windows Forms application. The application uses a SqlCommand object named cmd. Thecmd object executes the following stored procedure.

CREATE PROCEDURE GetPhoneListASBEGINSELECT CompanyName, Phone FROM CustomersSELECT CompanyName, Phone FROM SuppliersEND

You need to add all returned rows to the ListBox control named lstPhones. Which code segment should you use?

A. SqlDataReader rdr = cmd.ExecuteReader();do { while (rdr.Read()) { lstPhones.Items.Add(rdr.GetString(0) + "\t" + rdr. GetString(1)); }} while (rdr.NextResult());

B. SqlDataReader rdr = cmd.ExecuteReader();while (rdr.Read()) { lstPhones.Items.Add(rdr.GetString(0) + "\t" + rdr. GetString(1));}

C. SqlDataReader rdr = cmd.ExecuteReader();while (rdr.NextResult()) { while (rdr.Read()) { lstPhones.Items.Add(rdr.GetString(0) + "\t" + rdr. GetString(1)); }}

D. SqlDataReader rdr = cmd.ExecuteReader();while (rdr.NextResult()) { lstPhones.Items.Add(rdr.GetString(0) + "\t" + rdr. GetString(1));}

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 29A Windows Forms application loads an XmlDocument from a file named books.xml. You need to validate theXML against a schema that is contained in the books.xsd file when the XML loads. What should you do?

A. Associate the schema file with an XmlReader.Load the XmlDocument by using the XmlReader.B. Add the schema to the Schemas property of the XmlDocument.Call the Load method of the XmlDocument

by setting the filename parameter to books.xsd.C. Call the Load method of the XmlDocument by setting the filename parameter to books.xsd, and then call

the Load method by setting the filename parameter to books.xml.D. Call the Load method of the XmlDocument by setting the filename parameter to

Page 67: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

books.xsd.Programmatically add the attribute xsi:schemaLocation to the root node. Set the value of thisattribute to books.xsd.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 30You create Microsoft Windows-based applications. You create a component that calls an existing function. Thedesign for the function specifies that it might throw an application-specific exception namedInvalidChecksumException, which inherits from System.ApplicationException. The InvalidChecksumExceptionexception is an error that can be handled. But the component cannot handle any other type of error. Thecomponent does not have any additional information that can be added to other types of errors. You need todesign the component to correctly handle exceptions. You also need to ensure that the exception-handlingstrategy does not affect performance. What should you do?

A. Use a catch statement that has a filter for ApplicationExceptions and find the exception type. If it isInvalidChecksumException, handle it automatically or rethrow the exception.

B. Use only a catch statement that has a filter for InvalidChecksumExceptions and handle them automatically.C. Use a catch statement that has an empty filter. Verify the Message property to see if the exception is an

InvalidChecksumException and perform the automatic recovery or rethrow the exception.D. Use a catch statement that has a filter for InvalidChecksumException, followed by another catch statement

that has a filter for Exception. In the first catch block, automatically handle the exception. In the secondcatch block, log the error and rethrow the exception.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 31You create Microsoft Windows-based applications. You are upgrading an application that contains customdata-centric user controls. Each of these controls implements its own custom data-binding logic. Much of thedata-binding code is similar from control to control. You create a new component that combines the commondata-binding logic. You change the existing controls so they use this new component. You need to decide whichtier of the application architecture this component will belong to. Where should you place the component?

A. Presentation tierB. Business tierC. Data access tierD. Data tier

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 32

Page 68: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

You create Microsoft Windows-based applications. You participate in the planning phase of an incident trackingtool for technical support analysts.

The incident tracking tool must meet the following requirements:

Technical support analysts must open multiple incidents simultaneously.The application can run only one instance at a time.Users must be able to adjust the order and layout of the incident screens.

You need to design an application user interface that meets these requirements with the minimum amount ofcode. Which action should you perform?

A. Create a Multiple Document Interface (MDI) application with a menu strip. Utilize the MdiWindowListItemproperty of the menu strip to automatically merge MDI child forms to the Window list.

B. Create a Single Document Interface application that launches multiple forms. Write code to enable the userto toggle between the active forms.

C. Create a Multiple Document Interface application with a menu strip. Write code to add child Windows to themenu strip to add MDI child forms to the Window list.

D. Create a Single Document Interface application. Create a custom-dockable control that can display eachsupport incident.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 33You are creating a Windows Forms application. The application loads a data table named dt from a databaseand modifies each value in the data table. You add the following code.(Line numbers are included for reference only.)

01 foreach (DataRow row in dt.Rows) {02 foreach (DataColumn col in dt.Columns) {04 Trace.WriteLine(str);05 }06 }

You need to format the string named str to show the value of the column at the time the data is loaded and thecurrent value in the column. Which code segment should you add at line 03?

A. string str = String.Format("Column was {0} is now { 1}", row[col], row[col,DataRowVersion.Current]);

B. string str = String.Format("Column was {0} is now { 1}", row[col,DataRowVersion.Default], row[col]);

C. string str = String.Format("Column was {0} is now { 1}", row[col], row[col,DataRowVersion.Proposed]);

D. string str = String.Format("Column was {0} is now { 1}", row[col,DataRowVersion.Original], row[col]);

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

Page 69: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

QUESTION 34You are creating a Windows Forms application that includes the databasehelper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQLServer 2005 database, executes a Transact-SQL statement, and then disconnects from the database. Youmust ensure that changes to the database that result from the UpdateAccount method are committed only if theUpdateOrder method succeeds. You need to execute the UpdateAccount method and the UpdateOrdermethod. Which code segment should you use?

A. using (TransactionScope ts = new TransactionScope() ) { UpdateOrder(); UpdateAccount(); ts.Complete();}

B. using (TransactionScope ts1 = new TransactionScope( )) { UpdateOrder(); using (TransactionScope ts2 = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateAccount(); ts2.Complete(); } ts1.Complete();}

C. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder(); ts.Complete();}using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)){ UpdateAccount(); ts.Complete();}

D. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder();}using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)){ UpdateAccount(); ts.Complete();}

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 35You create Microsoft Windows-based applications. You are upgrading an application that contains customdata-centric user controls. Each of these controls implements its own custom data-binding logic. Much of thedata-binding code is similar from control to control. You create a new component that combines the commondata-binding logic. You change the existing controls so they use this new component. You need to decide whichtier of the application architecture this component will belong to. Where should you place the component?

A. Presentation tier

Page 70: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

B. Business tierC. Data access tierD. Data tier

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 36You create Microsoft Windows-based applications. You are creating a method. Your applications will call themethod multiple times. You write the following lines of code for the method.

public string BuildSQL(string strFields, string str Table, string strFilterId) { string sqlInstruction = "SELECT "; sqlInstruction += strFields; sqlInstruction += " FROM "; sqlInstruction += strTable; sqlInstruction += " WHERE id ="; sqlInstruction += strFilterid; return sqlInstruction;}

The method generates performance issues. You need to minimize the performance issues that the multiplestring concatenations generate. What should you do?

A. Use a single complex string concatenation.B. Use an array of strings.C. Use an ArrayList object.D. Use a StringBuilder object.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 37You create Microsoft Windows-based applications. You are responsible for evaluating the deployment of aproduct-pricing application. This application will be deployed on portable computers that are used by a team ofsales personnel.

The application must meet the following requirements:

The application must run successfully on a dial-up connection.Users need to run the application locally.New features are added to the application on a monthly basis.

You need to provide a deployment solution that will ensure your users always have the latest version of theapplication when they connect to the corporate network. What should you recommend?

A. Create a Microsoft Windows Installer MSI installation.

Page 71: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

B. Create a ClickOnce deployment.C. Create a setup executable that installs your application.D. Create a Web Deployment installation.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 38You create Microsoft Windows-based applications. You are creating a mathematics educational application.The application will be used to teach students about numeric series. One of the methods in the application isused to calculate a given member of the Fibonacci series. The method uses recursive calls to perform itscalculation. The application calls the method synchronously, and only one instance of the application can berunning at a given time. The application requirements state that the method must take less than 5 seconds toprocess when calculating any of the first 30 members of the Fibonacci series. You profile the application byusing instrumentation. During profiling, you perform a call on the method that is used for calculating the 30thmember of the Fibonacci series. The profiling report, which shows elapsed time in milliseconds, is shown in theexhibit. (Click the Exhibit button.) You need to evaluate the performance of the application based on theestablished requirements.What should you conclude?

A. The report is inconclusive. A sample profiling is required to verify the requirements.B. The report is inconclusive. A load test is required to verify the requirements.C. The report is conclusive. The requirements are not met.D. The report is conclusive. The requirements are met.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 39You create Microsoft Windows-based applications. You create a banking application that will be used by theaccount managers of the bank.

You identify a method to simulate the deposit functionality of a savings account. The method will calculate thefinal balance when monthly deposit, number of months, and quarterly rate are given. The applicationrequirements state that the following criteria must be used to calculate the balance amount:

Apply the quarterly interest rate to the balance amount of the account every three months. Apply the quarterly

Page 72: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

interest rate before the monthly deposit is calculated for the third month.

You translate the outlined specification into pseudo code. You write the following lines of code. (Line numbersare included for reference only.)

Method

public static decimal SimulateSavings

Input parametersint monthsdecimal monthlyPaymentdecimal quarterlyRate

Pseudo code

01 Declare balance variable, initialize it to zero03 Return balance

You need to insert the appropriate code in line 02. Which code segment should you insert?

A. 01 Declare integer variable, x02 For x=1 to months/32.1 balance = balance + 3 * monthlyPayment2.2 balance = (1 + quarterlyRate) * balance

B. 01 Declare integer variable, x02 For x=1 to months/32.1 balance = balance + 2 * monthlyPayment2.2 balance = (1 + quarterlyRate) * balance2.3 balance = balance + monthlyPayment

C. 01 Declare integer variable, x02 For x=1 to months2.1 balance = balance + monthlyPayment2.2 if x mod 3 is 0 then balance = (1 + quarterlyRa te) * balance

D. 01 Declare integer variable, x02 For x=1 to months2.1 if x mod 3 is 0 then balance = (1 + quarterlyRa te) * balance2.2 balance = balance + monthlyPayment

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 40You create Microsoft Windows-based applications. You need to evaluate the design concept of an application.

The application must meet the following requirements:

The application relies on the operating system for authentication. The application minimizes the amount of datasent over the network when connecting to the database. The application exposes data access code so that thefuture Web-based and mobile applications can reuse them.The application permits users to view and edit data contained in tables from a Microsoft SQL Server 2005database.The application controls access to the SQL Server 2005 database at the table level.

The design contains the following elements:

Page 73: PrepKing - GRATIS EXAM · PrepKing Number : 70-552 Passing Score : 700 Time Limit : 120 min File Version : 9.0  PrepKing 70-552

The SQL Server 2005 database uses the Windows Authentication mode. A database schema that grants rightsto the users at the table level. A stored procedure in Transact-SQL that accesses the necessary data requiredby the application. A Web service that uses a pre-defined credential to access the database and run the storedprocedures. A Microsoft Windows-based application that impersonates the logged-on user and calls the Webservice to retrieve and update the data.You need to evaluate the design and recommend appropriately. What should you recommend?

A. The design meets all the requirements.B. Change the Windows-based application to use Windows Authentication.C. Change the Web service to impersonate the caller.D. Change the database schema to use stored procedures in C#.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 41You are creating a Windows Form that contains several ToolStrip controls. You need to add functionality thatallows a user to drag any ToolStrip control from one edge of the form to another. What should you do?

A. Configure a ToolStripContainer control to fill the form. Add the ToolStrip controls to the ToolStripContainercontrol.

B. Configure a Panel control to fill the form. Set the Anchor properties of the ToolStrip controls to Top, Bottom,Left, Right.

C. Add the ToolStrip controls to another ToolStrip control that is hosted by a ToolStripControlHost control.D. Add the ToolStrip controls to the form. Set the Anchor properties of the ToolStrip controls to Top, Bottom,

Left, Right.Set the FormBorderStyle property of the form to SizableToolWindow.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

http://www.gratisexam.com/