You are on page 1of 29

Microsoft-MCTS Exam.70-505.v2010-09-06.by.Clooney.

43Q
Number: 070-505 Passing Score: 800 Time Limit: 120 min File Version: 2010-10-19

Exam : Microsoft 70-505 Title : MCTS-Microsoft .NET Framework 3.5 Windows.Forms Application Version : 2010-08-20 Questions : 43 By CornPet Revised by Clooney
Sections 1. Mixed Topics 2. Printing & Related Topics 3. Threads & Related Topics 4. Forms, Controls & Other Topics 5. Data & Databound Controls 6. Deployment & Related Topics 7. Userdefined Controls & Related Topics

Exam A QUESTION 1 You are creating a Windows Forms application by using the .NET Framework 3.5. The application stores a list of part numbers in an integer based array as shown in the following code segment (Line numbers are included for reference only) 01 var parts = new int[] 02 { 105, 110, 110, 235, 105, 03 135, 137, 205, 105, 100, 100 } ; 03 04 05 foreach (var item in results) { 06 tbResults.Text.+= item + "\r\n"; 07 } You need to use a LINQ to Objects query to perform the following tasks: - Obtain a list of duplicate part numbers - Order the list by part numbers - Provide the part numbers and the total count of part numbers in the results Which code segment should you insert at line 04 ? A. var results = (from n in parts orderby n group n by n into n1 select new { n1.Key, count = n1.Count() }) Distinct(); B. var results = (from n in parts group n by n into n1 where n1.Count() > 1 orderby n1 select new { n1.Key, count = n1.Count() }); C. var results = (from n in parts orderby n group n by n into n1 where n1.Count() > 1 select n1); D. var results = (from n in parts orderby n group n by n into n1 where n1.Count() > 1 select new { n1.Key, count = n1.Count() }); Answer: D Section: Mixed Topics Explanation/Reference:

QUESTION 2 You are creating a Windows Forms application by using the .NET Framework 3.5. You use LINQ expressions to read a list of customers from the following XML file. <customers> <customer id="135" birthDate="4/1/1968"> Paul Koch </customer> <customer id="122" birthDate="7/5/1988"> Bob Kelly </customer> <customer id="044" birthDate="3/24/1990"> Joe Healy </customer> <customer id="982" birthDate="9/15/1974"> Matt Hink </customer> <customer id="325" birthDate="1/7/2004"> Tom Perham </customer> <customer id="134" birthDate="9/23/1946"> Jeff Hay </customer> <customer id="653" birthDate="5/15/1947"> Kim Shane </customer> <customer id="235" birthDate="4/24/1979"> Mike Ray </customer> </customers> You need to obtain a list of names of customers who are 21 years of age or older. Which code segment should you use ? A. XDocument customers = XDocument.Load("Customers.xml"); var results = from c in customers.Descendants("customer") where ((DateTime)c.Attribute("birthDate")). AddYears(21)< DateTime.Now select.c.Attribute("Name") ;

Answer: B Section: Mixed Topics Explanation/Reference: QUESTION 3 You are creating a Windows Forms application for a courier company by using the . You create a form that allows customers to track the progress of their shipments. which code segment should you use? A.SetError(txtTN. CancelEventArgs e){ if (!ValidTrackingNumber(txtTN.Descendants() where ((DateTime)c.AddYears (21) < DateTime.B. var results = from c in customers. XDocument customers = XDocument. "") e.Text)) errorProvider1.Load("Customers.xml") var results = from c in customers. "InvalidTracking Number") txtTN.5.Cancel = true.Now select new { FullName = c.Value } .A function named ValidTrackingNumber that validates tracking numbers You need to ensure that the txtTN text box is validated.Load("Customers.SetError(txtTN. var results = from c in customers.Text)) { errorProvider1.xml"). } else errorProvider1. The form contains the following elements: .Cancel = true } } C. EventArgs e){ if (!ValidTrackingNumber(txtTN.Load("Customers.Element("customer") . AddYears(21)< DateTime. XDocument customers = XDocument. D. "Invalid Tracking Number") else{ errorProvider1.Value}.SetError(txtTN.Attribute("birthDate")).SetError(txtTN.SetError(txtTN.NET Framework 3.SetError(txtTN.An ErrorProvider control named ErrorProvider1 that informs users of an invalid tracking number . EventArgs e){ if (!ValidTrackingNumber(txtTN. private void txtTN_Validated(object sender. private void txtTN_Validating(object sender.SetError(txtTN.A text box named txtTN that allows users to enter a tracking number . CancelEventArgs e) { if (!ValidTrackingNumber(txtTN. C. "") } B.Now select c. AddYears(21)< DateTime.Descendants("customer") where ((DateTime)c.Focus() } } D. "") } .xml").SetError(txtTN.Attribute("birthDate")). "InvalidTracking Number") e. private void txtTN_Validating(object sender.Text)){ errorProvider1.Attribute("birthDate")).Descendants("customer") where ((DateTime)c. private void txtTN_Validated(object sender.Now select new { FullName = c.Focus() } else errorProvider1. "Invalid Tracking Number") else{ errorProvider1. "") txtTN. XDocument customers = XDocument.Text)) errorProvider1.

Which two actions should you perform (Each correct answer presents part of the solution.NET Framework 3. You need to read and validate the XMLdocuments in the most time efficient manner. C. Answer: D Section: Mixed Topics Explanation/Reference: QUESTION 6 You are creating a Windows Forms application by using the .NET Framework 3. You plan to deploy the application in multiple countries and languages. D. You need to ensure that the application meets the globalization requirements.NET Framework 3. You need to test the application in each language.5. Set the CurrentCulture property explicitly to IsNeutralCulture for each language.5. Handle server names and URLs as ASCII data B. What should you do? A. You discover that the service provider transfers large amounts of data by using XML. Use Unicode strings throughout the application . The XmlReader class The XmlDocument class The XmlResolver class The LINQ to XML method Answer: A Section: Mixed Topics Explanation/Reference: QUESTION 5 You are creating a Windows Forms application by using the . Set the CurrentCulture property explicitly to the respective culture for each language.Answer: A Section: Mixed Topics Explanation/Reference: QUESTION 4 You are creating a Windows Forms application by using the . Set the CurrentUICulture property explicitly to the respective culture for each language. D. Set the CurrentUICulture property explicitly to IsNeutralCulture for each language. choose two )? A. B. You have resource files in five different languages. Which technology should you use? A. B. C.5 The application is used by a financial service provider.

"InvalidTracking Number"). } } .Focus() . CancelEventArgs e) { if (!ValidTrackingNumber(txtTN.SetError(txtTN. "").NET Framework 3.A function named ValidTrackingNumber that validates tracking numbers.Text)) errorProvider1.SetError(txtTN. private void txtTN_Validated(object sender. "Invalid Tracking Number") .A text box named txtTN that allows users to enter a tracking number. "Invalid Tracking Number"). } else errorProvider1. "") } B. Which code segment should you use? A.SetError(txtTN.5. EventArgs e) { if (!ValidTrackingNumber(txtTN.C.Cancel = true. CancelEventArgs e) { if (!ValidTrackingNumber(txtTN. private void txtTN_Validating(object sender. private void txtTN_Validating(object sender. ""). . You need to ensure that the txtTN text box is validated. else { errorProvider1. e.SetError(txtTN. Use the NumberFormatInfo class for numeric formatting D. Cancel = true.SetError(txtTN. Handle strings as a series of individual characters instead of entire strings E. Avoid usage of the SortKey class and the CompareInfo class for sorting purposes Answer: BC Section: Mixed Topics Explanation/Reference: QUESTION 7 You are creating a Windows Forms application for a courier company by using the . else { errorProvider1. . You create a form that allows customers to track the progress of their shipments.Text)) { errorProvider1. } } C.Text)) errorProvider1.SetError(txtTN.An ErrorProvider control named ErrorProvider1 that informs users of an invalid tracking number. The form contains the following elements: . txtTN.

Focus() . "") .SetError(txtTN. txtTN. } else errorProvider1.D.SetError(txtTN. EventArgs e) { if (!ValidTrackingNumber(txtTN. } Answer: A Section: Mixed Topics Explanation/Reference: . private void txtTN_Validated(object sender.Text)) { errorProvider1. "InvalidTracking Number") .

pntDoc.BeginPrint -= new PrintEventHandler(PrintDoc_BeginPrint).BeginPrint -= new PrintEventHandler(PrintDoc_BeginPrint).canPrint = CheckPrintAccessControl() . PrintEventArgs. Add the following code segment at line 05 pntDoc. C. You implement the PrintPage page event for the form.obj.Cancel = true).When the user has no print access.NET Framework 3.BeginPrint -= new PrintEventHandler(delegate(object. args1) => LogPrintOperation()). B.Print operations are logged whether or not the user has print access What should you do ? A.args){}). Add the following code segment at line 05 pntDoc.NET Framework 3.BeginPrint -= new PrintEventHandler((obj1. Add the following code segment at line 07 pntDoc.Exam B QUESTION 1 You are creating a Windows Forms application by using the . args1) => LogPrintOperation()). Add the following code segment at line 05 pntDoc. 02 03 bool. You add a PrintDocument control named pntDoc to the form. Answer: A Section: Printing & Related Topics Explanation/Reference: QUESTION 2 You are creating a Windows Forms application that has the print functionality by using the .5. Add the following code segment at line 07 pntDoc.BeginPrint += new PrintEventHandler((obj. You need to provide a print preview for the user by adding a code segment to the Click event of the button .BeginPrint += new PrintEventHandler(PrintDoc_BeginPrint). pntDoc.5. PrintEventArgs.BeginPrint += new PrintEventHandler((obj.) 01 pntDoc. Add the following code segment at line 05 pntDoc.BeginPrint -= new PrintEventHandler((obj1. pntDoc. args) => args.obj. You want to set the default size of the PrintPreviewDialog class to full screen. 04 if (!canPrint) { 05 06 } 07 You need to ensure that the following requirements are met: .BeginPrint -= new PrintEventHandler(PrintDoc_BeginPrint). args) => args. args1) => LogPrintOperation()).PrintEventHandler(PrintDoc_BeginPrint) .BeginPrint += new PrintEventHandler((obj1. D.BeginPrint += new PrintEventHandler((obj1. args1) => LogPrintOperation()).BeginPrint += new. You create a new form in your application. Add the following code segment at line 07 pntDoc. you write the following code segment in the application (Line numbers are included for reference only.BeginPrint += new PrintEventHandler(delegate(object. font and file stream initializations are not executed and the print operation is cancelled .args){}). Add the following code segment at line 07 pntDoc.Cancel = true). You associate an instance of the PrintDocument control along with an instance of the PrintPreviewDialog control named prevDialog1. pntDoc. To support the print functionality.

The zoom setting of the preview control is adjusted automatically when the form is resized You need to ensure that the requirements are met when the form that contains the custom print preview .Printing.Drawing.Height. prevDialog1.PrintingPermissionLevel.= prevDialog1. prevDialog1. [System.NET Framework 3.PrintingPermission (System.PrintingPermission (System.Width . prevDialog1.Width = Screen. The previewed documents must meet the following requirements: . [System. prevDialog1.Height.SecurityAction.5.Permissions.Demand.The fullscale preview is set as default for the documents .PrintingPermissionLevel.Height.Security. prevDialog1. You need to ensure that users can print reports only by selecting a printer from the printer dialog box.PrintingPermission (System.Height.Update(). prevDialog1. [System. Level=System.AllPrinting)].Height.= prevDialog1.ShowDialog() .Security. prevDialog1.Printing.Drawing. Answer: A Section: Printing & Related Topics Explanation/Reference: QUESTION 3 You are creating a Windows Forms application by using the .Drawing. D.ShowDialog() . prevDialog1.PrintPreviewControl.Width = prevDialog1.PrintPreviewControl.SecurityAction. [System.Bounds.Width = prevDialog1.Width .DefaultPrinting)].ShowDialog() .Permissions.Width = 1024 .Printing. B.NET Framework 3.PrintingPermissionLevel.Printing.PrintPreviewControl.PrintingPermissionLevel.The graphics and text are displayed clearly . D. Answer: D Section: Printing & Related Topics Explanation/Reference: QUESTION 4 You are creating a Windows Forms application for the design of circuit boards and electronic equipment.Drawing.Height = 768 .Drawing.PrintPreviewControl. You use the .Printing.Drawing. B. Which code segment should you use? A. prevDialog1.Printing. The application is configured to use rolebased security.PrintingPermission (System. prevDialog1.SecurityAction.SecurityAction.Demand.Demand. prevDialog1.SafePrinting)].PrimaryScreen.Drawing.on the form.Drawing.Printing.Printing.Security.Bounds. Level=System.5 to create the application x that allows designers to preview designs before printing them. You want to achieve this goal by using the minimum level of permission.Demand. C.PrimaryScreen.Permissions. Level=System. Level=System.Height = Screen.Security. C.Width. prevDialog1.Permissions. Which code segment should you use ? A.NoPrinting)].

D.0 .ShowDialog() .Zoom = 1.AutoZoom = true .AllowSomePages = true. printPreviewControl1. PrintDialog printDialog1 = new PrintDialog(). PageSetupDialog pageSetupDialog1 = new PageSetupDialog() . Which code segment should you use? A. DialogResult result = pageSetupDialog1.Zoom = 100.0.Print(). printPreviewControl1.AutoZoom = false .control is displayed.Document = printDocument1. You have implemented the PrintPage event to send the page output to the printer. DialogResult result = printDialog1. Which code segment should you use? A. printPreviewControl1. printPreviewControl1.Document = printDocument1 .Yes) { printDocument1.Print().UseAntiAlias = false . DialogResult result = pageSetupDialog1.Zoom = 1. pageSetupDialog1.UseAntiAlias = true .Document = printDocument1. printPreviewControl1.OK) { printDocument1. if(result == DialogResult. } B. } C. printPreviewControl1.OK) { printDocument1. printDialog1.Print(). printDialog1. Answer: A Section: Printing & Related Topics Explanation/Reference: QUESTION 5 You are creating a Windows Forms application by using the .ShowDialog(). printPreviewControl1. printPreviewControl1. printPreviewControl1. B.ShowDialog(). PageSetupDialog pageSetupDialog1 = new PageSetupDialog().UseAntiAlias = true . The users must select the printer and the page range before printing. C. printPreviewControl1.0 .NET Framework 3.5.0 .AutoZoom = true .AutoZoom = false . printPreviewControl1. } . You need to ensure that users can print the content of the form by clicking the button control.UseAntiAlias = true . printPreviewControl1. if (result == DialogResult. if (result == DialogResult. pageSetupDialog1.Zoom = 100.

printDialog1.Document = printDocument1.Print(). PrintDialog printDialog1 = new PrintDialog().AllowSomePages = true.Yes) { printDocument1. printDialog1.D. } Answer: C Section: Printing & Related Topics Explanation/Reference: . if (result == DialogResult. DialogResult result = printDialog1.ShowDialog().

. 03 You need to declare the method signature of the DoWork method. the background task is cancelled. You create an image processing function and a delegate. D.It is not blocked when the delegate is running . B.NET Framework 3. You write the following code segment (Line numbers are included for reference only.5.5. 02 myThread. C. Call the BeginInvoke method by specifying a callback method to be executed when the delegate is complete Call the EndInvoke method of the delegate in the calling thread. C. public void DoWork(Delegate oCounter). Call the BeginInvoke and EndInvoke methods of the delegate in the calling thread.5. public void DoWork(int nCounter). Call the Invoke method of the delegate. public void DoWork(object oCounter). D. public void DoWork().NET Framework 3.Exam C QUESTION 1 You are creating a Windows Forms application by using the .It is notified when the delegate is complete What should you do? A. B. You need to ensure that when the Cancel button is pressed. You plan to invoke the image processing function by using the delegate. You need to ensure that the calling thread meets the following requirements: . Call the BeginInvoke method by specifying a callback method to be executed when the delegate is complete Call the EndInvoke method in the callback method. The application requires a thread that accepts a single integer parameter. Answer: C Section: Threads & Related Topics Explanation/Reference: QUESTION 2 You are creating a Windows application for graphical image processing by using the .Start(100).) 01 Thread myThread = new Thread(new ParameterizedThreadStart(DoWork)) .NET Framework 3. Which method signature should you use? A. You add a Cancel button to the form. Answer: C Section: Threads & Related Topics Explanation/Reference: QUESTION 3 You are creating a Windows application by using the . You add a BackgroundWorker component to a Windows form to handle a timeconsuming operation.

) . System. D. Answer: B Section: Threads & Related Topics Explanation/Reference: QUESTION 4 You are creating a Windows application by using the .ReportProgress().Threading. } private void ReportProgress().5.Thread". You use the QueueUserWorkItem method and a Label control named lblResult. } C. Set the DoWorkEventArgs.Threading.Monitor.CancelAsync() method from the DoWork event handler of the BackgroundWorker. Call the BackgroundWorker.Thread".{ this.Enter(this). private void DoWork(objectmyParameter){ // thread work this.Monitor.lblResult.TryEnter(this).Threading. private void DoWork(objectmyParameter){ // thread work System.NET Framework 3.What should you do? A.NET Framework 3. private void DoWork(objectmyParameter){ // thread work System. } B. You plan to create a form that might result in a timeconsuming operation.lblResult Text = "Finished.Text = "Finished.lblResult.lblResult. private void DoWork(objectmyParameter){ // thread work this Invoke(new MethodInvoker(ReportProgress)) .Cancel property to False in the DoWork event handler of BackgroundWorker.CancelAsync() method from the OnClick event handler of the Cancel button. B. You write the following code segment in the application (Line numbers are included for reference only. Which code segment should you use? A.Thread".Monitor. CancellationPending property is True. Stop the process in the OnClick event handler of the Cancel button if the BackgroundWorker. You need to update the users by using the lblResult control when the process has completed the operation. } Answer: A Section: Threads & Related Topics Explanation/Reference: QUESTION 5 You are creating a Windows application by using the .Text = "Finished Thread".Exit(this). } private void ReportProgress(){ this. Call the BackgroundWorker.this. C. } D. You create an instance of the BackgroundWorker component named backgroundWorker1 to asynchronously process timeconsuming reports in the application.Text = "Finished.5.

CancellationPending) MessageBox.Error != null) MessageBox.Show("Report Cancelled") else MessageBox.Show("Report Completed") D. if (e.Show("Report Cancelled") else MessageBox.The process is successfully completed Which code segment should you insert at line 03? A.Error.Show("Report Cancelled") else MessageBox.Result == "Cancelled" || e.Show("Report Cancelled") else MessageBox.Show("Report Completed") B. if (e.Cancelled == null) MessageBox.The process is cancelled .Show(e.Result == "Error") MessageBox.01 private void backgroundWorker1_RunWorkerCompleted( object sender.Show("Report Completed") C. if (backgroundWorker1.Cancelled) MessageBox. if (e.Show("Report Completed") Answer: D Section: Threads & Related Topics Explanation/Reference: .An exception is thrown . RunWorkerCompletedEventArgs e) 02 { 03 04 } You need to write a code segment that reports to the application when the background process detects any of the following actions: .Message) else if (e.

Region reg = new.Drawing.Width.GraphicsPath path = new.Drawing.System.Drawing2D.AddEllipse(0. You write the following code segment in the application (Line numbers are included for reference only ) 01 CustomControl myControl = new CustomControl() 02 You need to ensure that an instance of CustomControl is displayed on the form as a toplevel item of the ctxMenu control.Items.Width.Add(panel) .Controls. ToolStripPanel panel = new ToolStripPanel() .5 The application requires a form to display a clock.FormBorderStyle.Add(host) . path. this. System.Controls.Drawing2D. this.None. .FormBorderStyle.FormBorderStyle = System.Height). path.Windows. this.Exam D QUESTION 1 You are creating a Windows Forms application by using the . You need to create a circular form to display the clock.Add(panel) . ToolStripContentPanel panel = new ToolStripContentPanel() .Forms. Region reg = new.Drawing.Drawing. ctxMenu. this.Drawing2D.FormBorderStyle = System.FixedSingle.Drawing. System.FormBorderStyle.Controls.GraphicsPath path = new System.Drawing2D. this. You have a user defined class named CustomControl.Region = reg.Drawing.5. 0.Region = reg.Drawing2D.AddEllipse(0. Controls & Other Topics Explanation/Reference: QUESTION 2 You are creating a Windows Forms application by using the . this. 0. 0. Which code segment should you use ? A. this.Forms. Answer: C Section: Forms. B.= System.FormBorderStyle.GraphicsPath path = new. this. ctxMenu. You add a ContextMenuStrip control named dctxMenu to the form. You create a new form in the application. this. this.Windows.Controls.Windows. path.FormBorderStyle = System.Drawing.FormBorderStyle. this. Which code segment should you add at line 02? A.Drawing2D.GraphicsPath(). this.Height). this.Windows. this. this.FixedSingle.NET Framework 3.Width.GraphicsPath().Drawing2D. Region reg = new. 0.AddEllipse(0. ToolStripControlHost host = new ToolStripControlHost(myControl) . Region. System.Forms.AddEllipse(0. B.GraphicsPath(). path.reg = new.Forms.NET Framework 3.None. panel.Region(path).Region(path). panel.GraphicsPath(). ctxMenu.System. C.Height). C.Width.Region(). this.Drawing2D.Region = reg.Add(myControl) .GraphicsPath path = new System. System.Region = reg.Add(myControl) . D.Drawing.Region().Height).

Panel1.FixedPanel = FixedPanel.MdiParent = frmParent. frmChild. spcFrame.ShowDialog() .MdiParent = frmParent. Answer: C Section: Forms. frmChild. B.SplitterDistance = 200. C.Add(host) .Items. ToolStripControlHost host = new ToolStripControlHost(myControl) . frmChild. ToolStripMenuItem menuItem = new ToolStripMenuItem() .SplitterWidth = 200.) 01 Form frmChild = new Form(). spcFrame. ctxMenu. spcFrame.DropDownItems. B. The SplitContainer control has two SplitterPanel controls named Panel1 and Panel2.5. 02 Form frmParent = this .D. You are configuring the SplitContainer control to define the layout of the form. You configure the frmParent form to be an MDI parent. Which code segment should you add at line 03 ? A. Controls & Other Topics Explanation/Reference: QUESTION 3 You are creating a Windows Forms application by using the .5 . spcFrame.Framework 3. D. You add a SplitContainer control named spcFrame to the form. You need to ensure that the following requirements are met: .Add(menuItem). spcFrame. spcFrame. menuItem.Panel2MinSize = 0.ShowDialog() . frmChild.SplitterIncrement = 200. Answer: A Section: Forms. You write the following code segment (Line numbers are included for reference only. You create a new form in your application.IsMdiContainer = true .The initial distance from the left edge of the spcFrame splitter is set to 200 pixels -The size of the Panel2 SplitterPanel remains unchanged when the form is resized Which code segment should you use ? A. 03 You need to associate and display the frmChild form and the frmParent form. Controls & Other Topics Explanation/Reference: QUESTION 4 You are creating a multiple document interface ( MDI) application by using the .NET.NET Framework 3.Show() . frmChild.Panel1MinSize = 200. frmChild. C.Panel2.FixedPanel = FixedPanel. spcFrame. .IsSplitterFixed = true. spcFrame.

Call the InitLayout method of the form before adding all the controls.Show(). Call the ResumeLayout method of the form after adding all the controls. What should you do? A. B. B. Answer: B Section: Forms. Call the PerformLayout method of the form after adding all the controls. the application displays a message in the title bar of the parent MDI that a child form has received focus.NET Framework 3. D. You create a new form in your application. You add 100 controls at run time in the Load event handler of the form. Call the SuspendLayout method of the form before adding all the controls. C. frmChild. Controls & Other Topics Explanation/Reference: QUESTION 7 .D. You have to implement a multiple document interface (MDI) in the application to allow users to open multiple financial documents simultaneously.IsMdiContainer = true . What should you do? A. You need to improve the performance of the form. Answer: D Section: Forms.5. Call the ResumeLayout method of the form after adding all the controls. frmChild. C. Controls & Other Topics Explanation/Reference: QUESTION 6 You are creating a Windows Forms application for a financial service provider by using the .NET Framework 3. Call the SuspendLayout method of the form before adding all the controls. D. Implement theActivated event Implement the MdiChildActivate event Override the OnParentVisibleChanged method Override the OnParentBindingContextChanged method Answer: B Section: Forms. Call the InitLayout method of the form before adding all the controls. Users report that the form takes a long time to get displayed. You need to ensure that whenever the child MDI form is created. Controls & Other Topics Explanation/Reference: QUESTION 5 You are creating a Windows Forms application by using the . Call the PerformLayout method of the form after adding all the controls.5.

B. C. Answer: BD Section: Forms.NET Framework 3. Set theAllowDrag property to true.You are creating a Windows Forms application by using the . You need to implement the drag and drop functionality in the TreeView control. Set theAllowDrag property to true. Create an event handler for the DragEnter event to call the DoDragDrop method . Controls & Other Topics Explanation/Reference: . Which two actions should you perform (Each correct answer represents part of the solution Choose two )? A. The application displays employee names by using the TreeView control. Create an event handler for the DragEnter event to handle the move or copy by itself. E. Create an event handler for the DragDrop event to handle the move or copy by itself. Create an event handler for the ItemDrag event to call the DoDragDrop method. Set theAllowDrag property to true. Create an event handler for the DragOver event.5. D.

You plan to modify a list of orders within a DataGridView control in the application.5. e.ToString())){ dataGridOrders.CurrentCell.EndEdit(). if (cellValue == null || string. } } } B. private void dataGridOrders_CellValidated( object sender.RowIndex]. DataGridViewCellValidatingEventArgs e) { if (e. private void dataGridOrders_Validating( object sender.IsNullOrEmpty(cellValue.ColumnIndex == 0) { var cellValue = dataGridOrders[ e.NET Framework 3. if (cellValue == null || string.IsNullOrEmpty(cellValue.5.ToString())){ e Cancel = true.ToString())){ e.ToString())){ dataGridOrders.Text.Exam E QUESTION 1 You are creating a Windows Forms application by using the .EndEdit() . You need to ensure that a value is required in the first column of the grid control. EventArgs e) { if (dataGridOrders. } } } C. } } } D. private void dataGridOrders_Validated( object sender.ColumnIndex.NET Framework 3. Which code segment should you use ? A.Value. if (cellValue == null || string.Cancel = true. CancelEventArgs e) { if (dataGridOrders.FormattedValue == null || string.FormattedValue. .ColumnIndex == 0) { var cellValue = dataGridOrders.ColumnIndex == 0) { var cellValue = dataGridOrders. DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { if (e.IsNullOrEmpty(cellValue.CurrentCell. } } } Answer: D Section: Data & Databound Controls Explanation/Reference: QUESTION 2 You are creating a Windows Forms application by using the . private void dataGridOrders_CellValidating( object sender.Text.IsNullOrEmpty(e. You write the following code segment to bind a list of categories to a dropdown list.

It logs all other exceptions by using the LogExceptionToFile Which code segment should you use ? A.Tables[0]. ddlCategory. 05 dsCategory.DataBindings. 06 You need to ensure that the dropdown list meets the following requirements: . 04 DataSet dsCategory = new DataSet() . . 03 OleDbDataAdapter daCategory = new OleDbDataAdapter(cmdCategory) .ValueMember = "CategoryID".Add("DisplayMember".) 01 OleDbConnection cnnNorthwind = new OleDbConnection(connectionString) . } . ddlCategory.5. dsCategory.(Line numbers are included for reference only. D. } catch (SqlException ex) { MessageBox. dsCategory. C. try{ categoryDataAdapter. "CategoryName").Displays all category names .It displays all database exceptions.Fill(dsCategory).DataSource = dsCategory. cnnNorthwind) . You write a code segment to connect to a MicrosoftAccess database and populate a DataSet.Message.DataSource = dsCategory.Add("DisplayMember". ddlCategory. ddlCategory.Add("ValueMember". Answer: B Section: Data & Databound Controls Explanation/Reference: QUESTION 3 You are creating a Windows Forms application by using the .NET Framework 3. "CategoryID").DataBindings.DataBindings.Message). dsCategory. ddlCategory. ddlCategory. ddlCategory.DisplayMember = "CategoryName".Fill(dsCategory) . ddlCategory.ValueMember = "CategoryID".Add("ValueMember". ddlCategory. "CategoryName").Uses the category ID as the selected item value Which code segment should you add at line 06 ? A. "Exception").Show(ex. "CategoryID"). dsCategory.DisplayMember = "CategoryName". You need to ensure that the application meets the following requirements: .DataBindings. 02 OleDbCommand cmdCategory = new OleDbCommand( "SELECT CategoryID.Tables[0]. CategoryName FROM Categories ORDER BY CategoryName". ddlCategory.Tables[0]. B. LogExceptionToFile(ex.

try { categoryDataAdapter. } catch (OleDbException ex) { MessageBox.5.Message). } catch (OleDbException ex) { MessageBox.Message.Read()) { lbCategories.ExecuteReader().Fill(dsCategory).Message. "Exception").Message). OleDbConnection cnnNorthwind = new OleDbConnection( connectionString). reader = cmdCategory.Fill(dsCategory).Add(reader["CategoryName"]).Message). } catch (Exception ex) { LogExceptionToFile(ex. } cnnNorthwind. You need to populate a list box control along with category names by using a DataReader control. LogExceptionToFile(ex.Message. OleDbCommand cmdCategory = new OleDbCommand( "SELECT * FROM. try { categoryDataAdapter.Show(ex. } catch (SqlException ex) { MessageBox. cnnNorthwind. } Answer: C Section: Data & Databound Controls Explanation/Reference: QUESTION 4 You are creating a Windows Forms application by using the . } catch (Exception ex) { LogExceptionToFile(ex.Items.B.close(). } C. "Exception").Show(ex. OleDbDataReader reader.Open().Fill(dsCategory). "Exception"). while (reader. cnnNorthwind). . } D.NET Framework 3. Which code segment should you use ? A.Show(ex. try { categoryDataAdapter.Categories".

reader = cmdCategory.NextResult()). } while (reader.close().NET Framework 3.OleDbConnection( connectionString)).Open().Close(). OleDbConnection cnnNorthwind = new OleDbConnection( connectionString).Orders". Answer: A Section: Data & Databound Controls Explanation/Reference: QUESTION 5 You are creating a Windows Forms application for inventory management by using the .Save(dsStockBalance). reader = cmdCategory. if(dsStockBalance.AcceptChanges().Items.Items. The scInventory component provides a method named Save. The application provides a form that allows users to maintain stock balances.close() C. .5. { lbCategories.Open(). } cnnNorthwind. OleDbCommand cmdCategory = new OleDbCommand( "SELECT * FROM. OleDbCommand cmdCategory = new OleDbCommand( "SELECT * FROM. OleDbDataReader reader. OleDbDataReader reader.ExecuteReader(). { lbCategories. reader = cmdCategory. cnnNorthwind).A dataset named dsStockBalance to store the stock information .Orders".cnnNorthwind = new.HasChanges()) dsStockBalance. } cnnNorthwind.Add(reader["CategoryName"]). dsUpdates = dsStockBalance.ExecuteReader(). D.A business component named scInventory. cnnNorthwind). using (OleDbConnection.Items.B. OleDbConnection cnnNorthwind = new OleDbConnection( connectionString). Which code segment should you use ? A. cnnNorthwind.Add(reader["CategoryName"]). { cnnNorthwind. scInventory. OleDbCommand cmdCategory = new OleDbCommand( "SELECT * FROM.GetChanges().ExecuteReader(). { lbCategories. OleDbDataReader reader. cnnNorthwind. while (reader. The form has the following features: .Read()).Open(). cnnNorthwind. cnnNorthwind). You need to ensure that only the modified stock balances of dsStockBalance are passed to the scInventory Save method.Add(reader["CategoryName"]).close().Orders". while (reader. } cnnNorthwind.Read()).

5. connString).Read().HasChanges()) { dsUpdates = dsStockBalance. dsUpdates = dsStockBalance.GetChanges() . C.AcceptChanges().) 01 string queryString = 02 "SELECT CategoryID.Save(dsUpdates).Fill(categories. } D.B.Fill(categories. Which code segment should you add at line 03 ? A. OleDbDataReader reader = cmd. conn. connString).DataSource = reader. if(dsStockBalance. OleDbCommand cmd = new OleDbCommand(queryString. dsStockBalance. gridCAT.GetChanges().DataSource = categories. OleDbDataReader reader = cmd.Tables[0]. gridCAT.HasChanges()) { dsStockBalance. D. DataSet categories = new DataSet(). DataSet categories = new DataSet().Open(). "Categories"). gridCAT. OleDbCommand cmd = new OleDbCommand(queryString. conn). conn. adapter.GetChanges() . OleDbConnection conn = new OleDbConnection(connString). "Categories"). OleDbConnection conn = new OleDbConnection(connString). if(dsStockBalance. if(dsStockBalance. } Answer: D Section: Data & Databound Controls Explanation/Reference: QUESTION 6 You are creating a Windows application for a financial services provider by using the . CategoryName FROM Categories" . 03 The connection string for the financial services database is stored in the variable named connString. scInventory. dsStockBalance. B. You write the following code segment in the form (Line numbers are included for reference only.Open() .AcceptChanges(). gridCAT.Save(dsStockBalance) . adapter. You need to ensure that the form populates a DataGridView control named gridCAT. Answer: A Section: Data & Databound Controls Explanation/Reference: . conn).AcceptChanges() .ExecuteReader().NET Framework 3. scInventory.Save(dsUpdates). C.DataSource = reader. OleDbDataAdapter adapter =new OleDbDataAdapter(queryString. OleDbDataAdapter adapter =new OleDbDataAdapter(queryString.DataSource = categories.HasChanges()) dsUpdates = dsStockBalance. scInventory.ExecuteReader().

ddlCategory.Displays all category names . ddlCategory.DisplayMember = "CategoryName".NET Framework 3. "CategoryName"). ddlCategory. 03 OleDbDataAdapter daCategory = new OleDbDataAdapter(cmdCategory). "CategoryName"). dsCategory.Uses the category ID as the selected item value Which code segment should you add at line 06? A.5. CategoryName FROM Categories ORDER BY CategoryName". cnnNorthwind). dsCategory.DataSource = dsCategory.DisplayMember = "CategoryName". Answer: B Section: Data & Databound Controls Explanation/Reference: . ddlCategory.ValueMember = "CategoryID". ddlCategory. C. 02 OleDbCommand cmdCategory = new OleDbCommand( "SELECT CategoryID. dsCategory.Add("DisplayMember". "CategoryID").Tables[0].DataSource = dsCategory.Tables[0]. 04 DataSet dsCategory = new DataSet(). ddlCategory. D. ddlCategory. ddlCategory.ValueMember = "CategoryID".DataBindings. 05 daCategory.Add("DisplayMember".DataBindings.DataBindings.DataBindings.QUESTION 7 You are creating a Windows Forms application by using the .Add("ValueMember". B.Add("ValueMember". ddlCategory. "CategoryID"). ddlCategory.Tables[0]. (Line numbers are included for reference only.) 01 OleDbConnection cnnNorthwind = new OleDbConnection(connectionString). 06 You need to ensure that the dropdown list meets the following requirements: .Fill(dsCategory). dsCategory. You write the following code segment to bind a list of categories to a dropdown list.

You plan to deploy a new application by using the ClickOnce deployment technology.5. the application performs the following tasks: .Exam F QUESTION 1 You create Windows Forms applications by using the . Add the manifest to the executable file of the application. users are not prompted to elevate their permissions What should you do? A. Create a manifest that includes the <requestedExecutionLevel level="requireAdministrator"/> tag. B. Create a manifest and set the RequestedExecutionLevel level attribute to AsInvoker. D.exe tool to install the CTL on the local computer.5. Create a new certificate trust list (CTL).Modifies registry keys .5. Create a new certificate trust list (CTL). You need to ensure that the application requires elevated permissions on execution. During deployment. C.Administrative permissions are not granted to users who install the application You need to ensure that the following requirements are met: . Answer: C Section: Deployment & Related Topics Explanation/Reference: QUESTION 2 You create Windows Forms applications by using the . You create a new application for Windows Vista client computers. Create a manifest and set the RequestedExecutionLevel level attribute to As Administrator. Answer: D Section: Deployment & Related Topics Explanation/Reference: QUESTION 3 You create Windows Forms applications by using the .NET Framework 3. You plan to deploy a new application by using the ClickOnce technology. What should you do? A. Use the CertMgr. Install the CTL on the server that has theClickOnce application published.NET Framework 3. Create a manifest that includes the <requestedExecutionLevel level="asInvoker"/> tag. B. C. . Create a new certificate trust list (CTL).The application can be deployed to Windows Vista client computers that are not part of an Active Directory domain . Create a new certificate trust list (CTL). Install the CTL on the server that has the ClickOnce application published.When the application is deployed. D. Use the CertMgr exe tool to install the CTL on the local computer. Add the manifest to the executable file of the application.Modifies the files located in the %PROGRAM FILES% folder .NET Framework 3. The application requires elevated access to read files from the local file system.

NET Framework 3. Install the CTL on the server that has the ClickOnce application published. What should you do? A. Add a launch condition that is set to Version NT64.5. You plan to use the Windows Installer to deploy a new application.applications.the . Create a new certificatetrust list (CTL).The application is signed by using a certificate obtained from a trustworthy authority. B.by. Use the MinVersion property.the. Add a launch condition that is set to NOT Version NT64.property. You plan to use a setup project to deploy a new Windows Forms application.using. Create a manifest and set the RequestedExecutionLevel level attribute to AsAdministrator. Create a single MSI file. D.5. Create a new certificate trust list (CTL). Use. Use the Depth property.create Windows. You need to create a launch condition so that the application can be deployed on client computers. Create a manifest and set the RequestedExecutionLevel level attribute to AsInvoker. Answer: B Section: Deployment & Related Topics Explanation/Reference: QUESTION 5 You. D. . B. The application uses a component that requires the Microsoft NET Framework 1.NET Framework 3.Version. C.Forms. You need to ensure that the application can be deployed as a trusted application to Windows Vista client computers on a corporate network.Support deployment to 32bit and 64bit operating systems . B. The application must meet the following requirements: .Use the 64bit Program Files folder when deployed to 64bit platforms You need to ensure that the application is deployed appropriately What should you do? A. What should you do? A. Request the network administrator to deploy the CTL by using Group Policy.1. Use the ComponentID property. Answer: D Section: Deployment & Related Topics Explanation/Reference: QUESTION 4 You create Windows Forms applications by using the . Create a single MSI file. C.

B. Deploy the application by using the ClickOnce technology. C.NET Framework 3. Set the Install attribute of the deployment tag to true in the deployment manifest.C. D. You plan to deploy a new application. Create an MSI file that is targeted to 64bit platforms. D. B. XCOPY ClickOnce MicrosoftWindows Installer Remote Desktop connections Answer: B Section: Deployment & Related Topics Explanation/Reference: QUESTION 7 You create Windows Forms applications by using the . The deployment must meet the following requirements: .5. Answer: C Section: Deployment & Related Topics Explanation/Reference: QUESTION 6 You create Windows Forms applications by using the .shortcut is added to the Start menu .It is removed from the client computer after the application is closed . Create a merge module that contains the 32bit and 64bit code. Deploy the application by using the ClickOnce technology.NET Framework 3. Execute the application from the CDROM. Access the application by using the Remote Desktop Connection tool. Use the Mage exe tool to set the Online Only option in the deployment manifest.The most recent version of the application is installed and executed on client computers .Users can uninstall the application from the control panel You need to identify a deployment technology that meets the specified requirements. Which deployment technology should you use? A. You want to achieve this goal by using the minimum amount of development effort. Create a single MSI file.It is not displayed in theAdd/Remove programs panel on the client computer What should you do? A. C. the application meets the following requirements: .It is executed on the client computer . Answer: B . Create an MSI file that is targeted to 32bit platforms. Deploy the application to a CDROM by using the ClickOnce technology. Deploy the application to a central network server. D. You need to ensure that on deployment. You plan to deploy a new Windows Presentation Foundation (WPF) XAML browser application (XBAP).5.

Section: Deployment & Related Topics Explanation/Reference: .

Answer: B Section: Userdefined Controls & Related Topics Explanation/Reference: QUESTION 3 You are creating a Windows Forms application by using the . You plan to develop a new control for the application. You plan to develop a custom control for the application. D. D.NET Framework 3. and then implement a custom DrawNode event handler.Exam G QUESTION 1 You are creating a Windows Forms application by using the . B. the ContainerControl class.5. B. Write a code segment to handle the CellPainting event.NET Framework 3. The control will be a composite control. C. Override the OnPaint method. B. Set the DrawMode property of the control to OwnerDrawAll. What should you do? A. Answer: D Section: Userdefined Controls & Related Topics Explanation/Reference: QUESTION 2 You are creating a Windows Forms application by using the . Override the OnPaint method. Write a code segment to handle the CellParsing event. Your need to derive from the class that will create the control by using the minimum amount of development effort.NET Framework 3. the FrameworkElement class. Set the DrawMode property of the control to OwnerDrawText.5. Derive from Derive from Derive from Derive from the Control class.and then implement a custom DrawNode event handler. Write a code segment in the DrawNode event handler to specify the highlight color. What should you do? A. You need to ensure that the control extends the DataGridView control by allowing the cells to contain multicolored text. the UserControl class. You plan to develop a new control for the application. You need to ensure that the control extends the TreeView control by adding a custom node tag and a highlight color. . What should you do? A. C. C.5.

Create a new class that is derived from theTextBox control class. Create a new class that is derived from theTextBox control class. Create a new class that is derived from the Control class. What should you do? A.D. C. Answer: B Section: Userdefined Controls & Related Topics Explanation/Reference: QUESTION 4 You are creating a Windows Forms application by using the . You plan to develop a new control for the application. D.5. B. Override the OnPaint method in the constructor. Write a code segment to handle the RowPostPaint event. Set the BackColor property of the control to Transparent in the constructor.NET Framework 3. Call the SetStyle method in the constructor. The control will have the same properties as a TextBox control. Answer: D Section: Userdefined Controls & Related Topics Explanation/Reference: . Create a new class that is derived from the Control class. You need to ensure that the control has a transparent background when it is painted on form. Set the BackColor property of the control to Transparent. You want to achieve this goal by using the minimum amount of development effort. Call the SetStyle method in the constructor. Call the SetStyle method in the constructor.