KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务
Exam : 70-566 Title : Upgrade: Transition your MCPD Windows Developer Skills to MCPD Windows Developer 3 Version : Demo 1 / 14
1.You are creating a Windows Forms application by using the.net Framework 3.5. The application requires a form to display a clock. You need to create a circular form to display the clock. Which code segment should you use? A. this.formborderstyle = System.Windows.Forms.FormBorderStyle.None; System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); path.addellipse(0, 0, this.width, this.height); Region reg = new Region(); this.region = reg; B. this.formborderstyle = System.Windows.Forms.FormBorderStyle.FixedSingle; System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); path.addellipse(0, 0, this.width, this.height); Region reg = new Region(path); this.region = reg; C. this.formborderstyle = System.Windows.Forms.FormBorderStyle.None; System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); path.addellipse(0, 0, this.width, this.height); Region reg = new Region(path); this.region = reg; D. this.formborderstyle = System.Windows.Forms.FormBorderStyle.FixedSingle; System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); path.addellipse(0, 0, this.width, this.height); Region reg = new Region(); this.region = reg; 2 / 14
Answer: C 2.You are creating a Windows Forms application by using the.net Framework 3.5. The application requires a form to display a clock. You need to create a circular form to display the clock. Which code segment should you use? A. Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Dim path As New System.Drawing.Drawing2D.GraphicsPath() path.addellipse(0, 0, Me.Width, Me.Height) Dim reg As New Region() Me.Region = reg B. Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Dim path As New System.Drawing.Drawing2D.GraphicsPath() path.addellipse(0, 0, Me.Width, Me.Height) Dim reg As New Region(path) Me.Region = reg C. Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Dim path As New System.Drawing.Drawing2D.GraphicsPath() path.addellipse(0, 0, Me.Width, Me.Height) Dim reg As New Region(path) Me.Region = reg D. Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Dim path As New System.Drawing.Drawing2D.GraphicsPath() path.addellipse(0, 0, Me.Width, Me.Height) Dim reg As New Region() Me.Region = reg Answer: C 3 / 14
3.You are creating a Windows Forms application by using the.net Framework 3.5. You create a new form in the application. You add a ContextMenuStrip control named ctxmenu to the form. You have a user-defined class named CustomControl. 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 top-level item of the ctxmenu control. Which code segment should you add at line 02 A. ToolStripControlHost host = new ToolStripControlHost(myControl); ctxmenu.items.add(host); B. ToolStripPanel panel = new ToolStripPanel(); panel.controls.add(mycontrol); ctxmenu.controls.add(panel); C. ToolStripContentPanel panel = new ToolStripContentPanel(); panel.controls.add(mycontrol); ctxmenu.controls.add(panel); D. ToolStripMenuItem menuitem = new ToolStripMenuItem(); ToolStripControlHost host = new ToolStripControlHost(myControl); menuitem.dropdownitems.add(host); ctxmenu.items.add(menuitem); Answer: A 4.You are creating a Windows Forms application by using the.net Framework 3.5. You create a new form in your application. You add a PrintDocument control named pntdoc to the form. To support the print functionality, you write the following code segment in the application. (Line numbers are included for reference only.) 01 pntdoc.beginprint += new PrintEventHandler(PrintDoc_BeginPrint); 02... 4 / 14
03 bool canprint = CheckPrintAccessControl(); 04 if (!canprint) { 05 06 07 You need to ensure that the following requirements are met: When the user has no print access, font and file stream initializations are not executed and the print operation is cancelled. Print operations are logged whether or not the user has print access. What should you do? A. Add the following code segment at line 05. pntdoc.beginprint -= new PrintEventHandler(PrintDoc_BeginPrint); pntdoc.beginprint += new PrintEventHandler((obj, args) => args.cancel = true); pntdoc.beginprint += new PrintEventHandler((obj1, args1) => LogPrintOperation()); B. Add the following code segment at line 05. pntdoc.beginprint += new PrintEventHandler(delegate(object obj, PrintEventArgs args){); pntdoc.beginprint -= new PrintEventHandler(PrintDoc_BeginPrint); pntdoc.beginprint += new PrintEventHandler((obj1, args1) => LogPrintOperation()); C. Add the following code segment at line 05. pntdoc.beginprint -= new PrintEventHandler(PrintDoc_BeginPrint); pntdoc.beginprint -= new PrintEventHandler(delegate(object obj, PrintEventArgs args){); pntdoc.beginprint -= 5 / 14
new PrintEventHandler((obj1, args1) => LogPrintOperation()); D. Add the following code segment at line 05. pntdoc.beginprint -= new PrintEventHandler((obj, args) => args.cancel = true); pntdoc.beginprint += new PrintEventHandler(PrintDoc_BeginPrint); pntdoc.beginprint -= new PrintEventHandler((obj1, args1) => LogPrintOperation()); Answer: A 5.You are creating a Windows Forms application by using the.net Framework 3.5. You create a new form in your application. You add a PrintDocument control named pntdoc to the form. To support the print functionality, you write the following code segment in the application. (Line numbers are included for reference only.) 01 AddHandler pntdoc.beginprint, _ AddressOf PrintDoc_BeginPrint 02... 03 Dim canprint As Boolean = CheckPrintAccessControl() 04 If canprint = False Then 05 06 07 You need to ensure that the following requirements are met: When the user has no print access, font and file stream initializations are not executed and the print operation is cancelled. Print operations are logged whether or not the user has print access. What should you do? A. Add the following code segment at line 05. RemoveHandler pntdoc.beginprint, AddressOf PrintDoc_BeginPrint AddHandler pntdoc.beginprint, _ 6 / 14
Function(obj1, args1) args1.cancel = True AddHandler pntdoc.beginprint, AddressOf LogPrintOperation B. Add the following code segment at line 05. AddHandler pntdoc.beginprint, AddressOf EmptyEventHandler RemoveHandler pntdoc.beginprint, AddressOf PrintDoc_BeginPrint AddHandler pntdoc.beginprint, AddressOf LogPrintOperation C. Add the following code segment at line 05. RemoveHandler pntdoc.beginprint, AddressOf PrintDoc_BeginPrint RemoveHandler pntdoc.beginprint, AddressOf EmptyEventHandler RemoveHandler pntdoc.beginprint, AddressOf LogPrintOperation D. Add the following code segment at line 05. AddHandler pntdoc.beginprint, _ Function(obj1, args1) args1.cancel = True AddHandler pntdoc.beginprint, AddressOf PrintDoc_BeginPrint RemoveHandler pntdoc.beginprint, AddressOf LogPrintOperation Answer: A 6.You are creating a Windows Forms application by using the.net Framework 3.5. You plan to modify a list of orders within a DataGridView control in the application. You need to ensure that a value is required in the first column of the grid control. Which code segment should you use? A. private void datagridorders_cellvalidated( 7 / 14
object sender, DataGridViewCellEventArgs e) { if (e.columnindex == 0)? { var cellvalue = datagridorders[ e.columnindex, e.rowindex].value; if (cellvalue == null string.isnullorempty(cellvalue.tostring())) { datagridorders.endedit(); B. private void datagridorders_validated( object sender, EventArgs e) { if (datagridorders.currentcell.columnindex == 0) { var cellvalue = datagridorders.text;?if (cellvalue == null?string.isnullorempty(cellvalue.tostring())) {?datagridorders.endedit(); C. private void datagridorders_validating( object sender, CancelEventArgs e) { if (datagridorders.currentcell.columnindex == 0) { var cellvalue = datagridorders.text;?if (cellvalue == null string.isnullorempty(cellvalue.tostring()))?{ e.cancel = true; 8 / 14
? D. private void datagridorders_cellvalidating( object sender, DataGridViewCellValidatingEventArgs e) { if (e.columnindex == 0) { if (e.formattedvalue == null string.isnullorempty(e.formattedvalue.tostring()))?{ e.cancel = true;? Answer: D 7.You create a Windows application by using the.net Framework 3.5. The application is named APP1. APP1 has the following specifications: It merges information from text files. It reads each text file as a string. It runs on a server computer named Server1. Another application named APP2 also runs on Server1. You discover that when a function is used to merge the text files, APP1 consumes additional memory. This additional memory consumption affects the operations of APP2. You need to modify the design of APP1 to ensure minimum effect on APP2. What should you do? A. Use the + operator for the merge process. B. Use the StringBuilder.Append method for the merge process. C. Write a code segment to perform the merge process on a new thread. D. Write a code segment in a separate project to perform the merge process. Configure the project to start the merge operation as a new process. 9 / 14
Answer: B 8.You are creating a Windows Forms application by using the.net Framework 3.5. You plan to modify a list of orders within a DataGridView control in the application. You need to ensure that a value is required in the first column of the grid control. Which code segment should you use? A. Private Sub datagridorders_cellvalidated( _ ByVal sender As Object, _ ByVal e As DataGridViewCellEventArgs) _ Handles datagridorders.cellvalidated If e.columnindex = 0 Then Dim cellvalue = datagridorders(e.columnindex, e.rowindex).value If cellvalue = Nothing _ Or String.IsNullOrEmpty(cellValue.ToString()) Then datagridorders.endedit() End Sub B. Private Sub datagridorders_validated( _ ByVal sender As Object, _ ByVal e As EventArgs) _ Handles datagridorders.validated If datagridorders.currentcell.columnindex = 0 Then Dim cellvalue = datagridorders.text If cellvalue = Nothing Or _ String.IsNullOrEmpty(cellValue.ToString()) Then datagridorders.endedit() End Sub 10 / 14
C. Private Sub datagridorders_validating( _ ByVal sender As Object, _ ByVal e As CancelEventArgs) _ Handles datagridorders.validating If datagridorders.currentcell.columnindex = 0 Then Dim cellvalue = datagridorders.text If cellvalue = Nothing Or _ String.IsNullOrEmpty(cellValue.ToString()) Then e.cancel = True End Sub D. Private Sub datagridorders_cellvalidating( _ ByVal sender As Object, _ ByVal e As DataGridViewCellValidatingEventArgs) _ Handles datagridorders.cellvalidating If e.columnindex = 0 Then If e.formattedvalue = Nothing _ Or String.IsNullOrEmpty(e.FormattedValue.ToString()) Then e.cancel = True End Sub Answer: D 9.You are creating a Windows Forms application by using the.net Framework 3.5. You write the following code segment to bind a list of categories to a drop-down list. (Line numbers are included for reference only.) 01 OleDbConnection cnnnorthwind = new OleDbConnection(connectionString); 11 / 14
02 OleDbCommand cmdcategory = new OleDbCommand( "SELECT CategoryID, CategoryName FROM Categories ORDER BY CategoryName", cnnnorthwind); 03 OleDbDataAdapter dacategory = new OleDbDataAdapter(cmdCategory); 04 DataSet dscategory = new DataSet(); 05 dacategory.fill(dscategory); 06 You need to ensure that the drop-down list meets the following requirements: Displays all category names. Uses the category ID as the selected item value. Which code segment should you add at line 06? A. ddlcategory.datasource = dscategory; ddlcategory.displaymember = "CategoryName"; ddlcategory.valuemember = "CategoryID"; B. ddlcategory.datasource = dscategory.tables[0]; ddlcategory.displaymember = "CategoryName"; ddlcategory.valuemember = "CategoryID"; C. ddlcategory.databindings.add("displaymember", dscategory, "CategoryName"); ddlcategory.databindings.add("valuemember", dscategory, "CategoryID"); D. ddlcategory.databindings.add("displaymember", dscategory.tables[0], "CategoryName"); ddlcategory.databindings.add("valuemember", dscategory.tables[0], "CategoryID"); Answer: B 10.You are creating a Windows Forms application by using the.net Framework 3.5. You write the following code segment to update multiple databases on a SQL Server 2008 database. 12 / 14
(Line numbers are included for reference only.) 01 string connectionstringcustomer = @"Data Source=CUSTOMER;Integrated Security= SSPI;"; 02 string connectionstringorders = @"Data Source=ORDER ;Integrated Security= SSPI;"; 03 SqlCommand cmdcustomer = new SqlCommand(); 04 SqlCommand cmdorders = new SqlCommand(); 05 SqlConnection cnncustomer = new SqlConnection(connectionStringCustomer); 06 SqlConnection cnnorders = new SqlConnection(connectionStringOrders); 07 You need to ensure that all database updates are included in a single distributed transaction. Which code fragment should you add on Line 07? A. cnncustomer.open(); cnnorders.open();... cmdorders.executenonquery();... cmdcustomer.executenonquery(); cnnorders.close(); cnncustomer.close(); B. TransactionScope scope = new TransactionScope(); cnncustomer.open(); cnnorders.open();... cmdorders.executenonquery();... cmdcustomer.executenonquery(); cnnorders.close(); 13 / 14
cnncustomer.close(); scope.complete(); C. TransactionScope customerscope = new TransactionScope() { using (SqlConnection cnncustomer =?new SqlConnection (connectionstringcustomer)) { customerscope.complete(); using (TransactionScope ordersscope = new TransactionScope()) { using (SqlConnection cnnorders = new SqlConnection(connectionStringOrders)) { ordersscope.complete(); D. try { cmdorders.transaction = cnnorders.begintransaction();... cmdorders.executenonquery();... cmdcustomer.transaction = cnncustomer.begintransaction();... cmdcustomer.executenonquery(); cmdcustomer.transaction.commit(); cmdorders.transaction.commit(); catch { cmdcustomer.transaction.rollback(); cmdorders.transaction.rollback(); Answer: B 14 / 14