Free Cheat-test Samples and Demo Questions Download
Adobe exams Adobe
Apple exams Apple
Avaya exams Avaya
Check Point exams Check Point
Cisco exams Cisco
Citrix exams Citrix
CIW exams CIW
CompTIA exams CompTIA
CWNP exams CWNP
EC-Council exams EC-Council
EMC exams EMC
Exin exams Exin
Fortinet exams Fortinet
GIAC exams GIAC
Hitachi exams Hitachi
HP exams HP
IBM exams IBM
Isaca exams Isaca
ISC exams ISC
ISEB exams ISEB
Juniper exams Juniper
LPI exams LPI
McAfee exams McAfee
Microsoft exams Microsoft
Oracle exams Oracle
PMI exams PMI
Riverbed exams Riverbed
SNIA exams SAP
Sun exams SAS
Symantec exams Symantec
VMware exams VMware
All certification exams

Microsoft 70-553 Exam - Cheat-Test.com

Free 70-553 Sample Questions:

1. You 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 collection when a user queries details about aspecific team. You also need to ensure that thedata collection guarantees type 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"};
Answer: C

2. You 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 collection when a user queries details about aspecific team. You also need to ensure that thedata collection guarantees type safety.
Which code segment should you use?
A. Dim teamAs Hashtable = 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. Dim teamAs ArrayList = 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. Dim teamAs New Dictionary(Of Integer, 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. Dim teamAs String() = New String() { _ "1, Hance", _
"2, Jim", _ "3, Hanif", _
"4, Kerim", _ "5, Alex", _ "6, Mark", _ "7, Roger", _ "8, Tommy"}
Answer: C

3. You 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 tocreate a three­column layout that has fixed left and right columns. The fixed columns must each remain 50 pixels wide when the form is resized. The middle column must fill the remainder of the form widthwhen the form is resized. You add the three columns in the 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.Absolute; pnlLayout.ColumnStyles[2].Width = 50F; pnlLayout.ColumnStyles[2].SizeType = SizeType.Absolute;
C. pnlLayout.ColumnStyles[0].Width = 50F; pnlLayout.ColumnStyles[0].SizeType = SizeType.Absolute; pnlLayout.ColumnStyles[1].Width = 100F; pnlLayout.ColumnStyles[1].SizeType = SizeType.AutoSize; pnlLayout.ColumnStyles[2].Width = 50F; pnlLayout.ColumnStyles[2].SizeType = SizeType.Absolute;
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));
Answer: D

4. Your Web site uses custom Themes. Your Web site must support additional Themes based on the user's company name.
The company name is set when a user logs on to theWeb site. The company's Theme name is stored in a variablenamed ThemeName.
You need to use this variable to dynamically set the Web site'sTheme. What should you do?
A. Add the following code segment to the markup source of each page on the Web site.
<%@ PageTheme="ThemeName" ... %>
B. Add the following code segment to the Load event of each page on the Web site. Page.Theme = ThemeName;
C. Add the following code segment to the PreInit event of each page on the Web site. Page.Theme = ThemeName;
D.Add the following code segment to the Web site's configuration file.
<pages theme="ThemeName" />
Answer: C

5. You 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 tocreate a three­column layout that has fixed left and right columns. The fixed columns must each remain 50 pixels wide when the form is resized. The middle column must fill the remainder of the form width when the form is resized. You add the three columns in the 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, 50.0F)) pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.AutoSize, 100.0F)) pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 50.0F))
B. pnlLayout.ColumnStyles(0).Width = 50.0F
pnlLayout.ColumnStyles(0).SizeType = SizeType.Absolute
pnlLayout.ColumnStyles(2).Width = 50.0FpnlLayout.ColumnStyles(2).SizeType = SizeType.Absolute
C. pnlLayout.ColumnStyles(0).Width = 50.0F
pnlLayout.ColumnStyles(0).SizeType = SizeType.Absolute
pnlLayout.ColumnStyles(1).Width = 100.0FpnlLayout.ColumnStyles(1).SizeType = SizeType.AutoSize pnlLayout.ColumnStyles(2).Width = 50.0FpnlLayout.ColumnStyles(2).SizeType = SizeType.Absolute
D. pnlLayout.ColumnStyles.Clear()
pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 50.0F)) pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 100.0F)) pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 50.0F))
Answer: D

6. Your Web site uses custom Themes. Your Web site must support additional Themes based on the user's company name.
The company name is set when a user logs on to theWeb site. The company's Theme name is stored in a variablenamed ThemeName.
You need to use this variable to dynamically set the Web site'sTheme. What should you do?
A. Add the following code segment to the markup source of each page on the Web site.
<%@ PageTheme="ThemeName" ... %>
B. Add the following code segment to the Load event of each page on the Web site. Page.Theme = ThemeName
C. Add the following code segment to the PreInit event of each page on the Web site. Page.Theme = ThemeName
D.Add the following code segment to the Web site's configuration file.
<pages theme="ThemeName" />
Answer: C

7. You are creating a Windows Forms application. Youadd an ErrorProvider component named erpErrors and a DateTimePicker control named dtpStartDate to the application.The application also contains other controls.
You needtoconfigure theapplication to display anerror notification icon next todtpStartDate when the user enters a date that is greater than today's date.
Which two actions should you perform? (Eachcorrect answer presents part of the solution. Choose two.)
A. For the Validating eventof dtpStartDate, create an event handler named VerifyStartDate.
B. For theValidated event of dtpStartDate, create an event handler named VerifyStartDate.
C. In the Properties Window for dtpStartDate, set the value of Error on erpErrors toDate out of range.
D. In VerifyStartDate, call erpErrors.SetError(dtpStartDate, "Date outof 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.
Answer: A, D

8.You need to create amethod 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();
Answer: C

9. AWindows Forms application contains the following code segment.
Dim SQLAs String = "SELECT EmployeeID, LastName, FirstName FROM Employees" Dim daAs New SqlDataAdapter(SQL, connStr)
Dim dtAs New DataTable()
da.MissingSchemaAction = MissingSchemaAction.AddWithKeyDim bldAs 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 rowsmust still be added. The code must log how many new rows failed to be added.
You need to propagate the additions to the database andlog a failed count. Which code segment should you use?
A. da.ContinueUpdateOnError = True da.Update(dt)
Dim dtErrors As DataTable= dt.GetChanges(DataRowState.Unchanged) Trace.WriteLine((dtErrors.Rows.Count.ToString() + " rows not added."))
B. da.ContinueUpdateOnError = False da.Update(dt)
Dim dtErrors As DataTable= dt.GetChanges(DataRowState.Unchanged) Trace.WriteLine((dtErrors.Rows.Count.ToString() + " rows not added."))
C. da.ContinueUpdateOnError = True da.Update(dt)
Dim rows As DataRow() = dt.GetErrors()
Trace.WriteLine((rows.Length.ToString() + " rows not added."))
D. da.ContinueUpdateOnError = False da.Update(dt)
Dim rows As DataRow() = dt.GetErrors() Trace.WriteLine((rows.Length.ToString() + " rows not added."))
Answer: C

10. You need to create a method to clear a Queue named q. Which code segment should you use?
A. Dim e As Object For Each e In q q.Dequeue()
Next
B. Dim e As Object For Each e In q q.Enqueue(Nothing)
Next
C. q.Clear()
D. q.Dequeue()
Answer: C

11. You are creating a Windows Form that includes a TextBox control named txtDate.
When a user right­clicks within the text box, you want the application to display a MonthCalendar control. You need to implement a context 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 = newToolStripControlHost(mnuContext);
txtDate.ContextMenuStrip = mnuContext;
B. Add the following code to the form initialization. ContextMenuStrip mnuContext = new ContextMenuStrip(); MonthCalendar cal = new MonthCalendar(); ToolStripControlHost host = newToolStripControlHost(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 theTextBox control that contains the following code.
if (e.Button == MouseButtons.Right) {
txtDate.Controls[0].Show();
}
D. Add a MouseClick eventhandler for the TextBox control that contains the following code.
if (e.Button == MouseButtons.Right) { ContextMenuStripmnuContext = new ContextMenuStrip(); MonthCalendar cal = new MonthCalendar(); ToolStripControlHosthost = newToolStripControlHost(cal); mnuContext.Items.Add(host);
txtDate.ContextMenuStrip= mnuContext;
}
Answer: B

12. You are creating a Windows Form that includes a TextBox control named txtDate.
When a user right­clicks within the text box, you want the application to display a MonthCalendar control. You need to implement a context menu that provides this functionality.
What should you do?
A. Add the following code to the form initialization. Dim cal As New MonthCalendar()
DimmnuContext As New ContextMenuStrip()
Dim host As New ToolStripControlHost(mnuContext)
txtDate.ContextMenuStrip = mnuContext
B. Add the following code to the form initialization. DimmnuContext As New ContextMenuStrip()
Dim cal As New MonthCalendar()
Dim host As New ToolStripControlHost(cal)
mnuContext.Items.Add(host)
txtDate.ContextMenuStrip = mnuContext
C. Add the following code to the form initialization. Dim ctr As New ToolStripContainer()
Dim cal As New MonthCalendar() ctr.ContentPanel.Controls.Add(cal) txtDate.Controls.Add(ctr)
Add a MouseClick event handler for theTextBox control that contains the following code.
If e.Button =MouseButtons.RightThen txtDate.Controls(0).Show()
End If
D. Add a MouseClick eventhandler for the TextBox control that contains the following code.
If e.Button =MouseButtons.RightThen DimmnuContext AsNewContextMenuStrip() Dim cal As New MonthCalendar()
Dimhost As New ToolStripControlHost(cal) mnuContext.Items.Add(host) txtDate.ContextMenuStrip= mnuContext End If
Answer: B

13. You are writing a custom dictionary.The custom­dictionary class is named MyDictionary. You need to ensure thatthe dictionaryis 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<string, string>(); MyDictionary dictionary = (MyDictionary)t;
Answer: A

14. You are writing a custom dictionary.The custom­dictionary class is named MyDictionary. You need to ensure thatthe dictionaryis type safe.
Which code segment should you use?
A. Class MyDictionary
Implements Dictionary(Of String, String)
B. Class MyDictionary
Inherits HashTable
C. Class MyDictionary
Implements IDictionary
D. Class MyDictionary
...
End ClassDim t As New Dictionary(Of String, String) Dim dict As MyDictionary = CType(t, MyDictionary)
Answer: A

15. You are creating an undo buffer that stores datamodifications.
You need to ensure that the undo functionalityundoesthe most recent data modifications first.You alsoneed to ensure that the undo buffer permits the storage 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();
Answer: A

16. You are creating an undo buffer that stores datamodifications.
You need to ensure that the undo functionalityundoesthe most recent data modifications first.You alsoneed to ensure that the undo buffer permits the storage of strings only.
Which code segment should you use?
A. Dim undoBuffer As New Stack(Of String)
B. Dim undoBuffer As New Stack()
C. Dim undoBuffer As New Queue(Of String)
D. Dim undoBuffer As New Queue()
Answer: A

17. You 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 the IsManager 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, "IsManager");
C. chkIsManager.Text= "{Users.IsManager}";
chkIsManager.AutoCheck =true;
D. this.DataBindings.Add("chkIsManager.Checked", ds, "Users.IsManager");
Answer: A

18. You 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 the IsManager 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, "IsManager")
C. chkIsManager.Text= "{Users.IsManager}" chkIsManager.AutoCheck =True
D. Me.DataBindings.Add("chkIsManager.Checked", ds, "Users.IsManager")
Answer: A

19. A method in your Windows Forms application executesa stored procedure ina Microsoft SQL Server
2005 database, andthen executes a second stored procedure in a second SQL Server 2005database.
You need to ensure that the call to the first stored procedure writes changes only if the call to the second storedprocedure succeeds. Installation requirements prohibityou from introducing new components that use the COM+ hosting model.
What should you do?
A. Implement a transactional serviced component.
Add methods to this component to encapsulate the connect operationand executionof each stored procedure.
Register and use this serviced component.
B. Add a TransactionScope block.
Connect toeach database and execute each stored procedure within the TransactionScope block. Call the TransactionScope.Completemethod if the call to both stored procedure succeeds.
C. Connect toboth databases.
Call the SqlConnection.BeginTransaction method for each connection.
Call the SqlTransaction.Commit method on both returned transactions only if bothstored procedures succeed.
D. Add a try­catch­finally block.
Connect toeach database and execute each stored procedure in the try block.
Answer: B

20. A method in your Windows Forms application executesa stored procedure ina Microsoft SQL Server
2005 database, andthen executes a second stored procedure in a second SQL Server 2005database.
You need to ensure that the call to the first stored procedure writes changes only if the call to the second storedprocedure succeeds. Installation requirements prohibityou from introducing new components that use the COM+
hosting model.
What should you do?
A. Implement a transactional serviced component.
Add methods to this component to encapsulate the connect operationand executionof each stored procedure.
Register and use this serviced component.
B. Add a TransactionScope block.
Connect toeach database and execute each stored procedure within the TransactionScope block. Call the TransactionScope.Completemethod if the call to both stored procedure succeeds.
C. Connect toboth databases.
Call the SqlConnection.BeginTransaction method for each connection.
Call the SqlTransaction.Commit method on both returned transactions only if bothstored procedures succeed.
D. Add a Try.­Catch.­Finally block.
Connect toeach database and execute each stored procedure in the try block.
Answer: B

21. You are creating a Windows Forms application that includes the database helper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQL Server 2005 database, executes a Transact­SQLstatement, and thendisconnects from the database.
You must ensure that changes to the database that result from the UpdateAccountmethod are committed only if the UpdateOrder method succeeds.
You need to execute the UpdateAccount method and the UpdateOrder method. 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 = newTransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder();
ts.Complete();
}
using (TransactionScope ts = newTransactionScope(TransactionScopeOption.Required)){ UpdateAccount();
ts.Complete();
}
D. using (TransactionScope ts = newTransactionScope(TransactionScopeOption.RequiresNew)){ UpdateOrder();
}
using (TransactionScope ts = newTransactionScope(TransactionScopeOption.Required)){ UpdateAccount();
ts.Complete();
}
Answer: A

22. You are creating a Windows Forms application that includes the database helper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQL Server 2005 database, executes a Transact­SQLstatement, and thendisconnects from the database.
You must ensure that changes to the database that result from the UpdateAccountmethod are committed only if the UpdateOrder method succeeds.
You need to execute the UpdateAccount method and the UpdateOrder method. Which code segment should you use?
A. Usingts As New TransactionScope() UpdateOrder()
UpdateAccount() ts.Complete() End Using
B. Using ts1As New TransactionScope() UpdateOrder()
Using ts2 AsNewTransactionScope(TransactionScopeOption.RequiresNew) UpdateAccount()
ts2.Complete() End Using ts1.Complete() End Using ts1.Complete();
C. Using ts1As New TransactionScope() UpdateOrder()
Using ts2 AsNewTransactionScope(TransactionScopeOption.RequiresNew) UpdateAccount()
ts2.Complete() End Using ts1.Complete() End Using
D. Usingts As New TransactionScope(TransactionScopeOption.RequiresNew) UpdateOrder()
End Using
Using ts AsNewTransactionScope(TransactionScopeOption.Required) UpdateAccount()
ts.Complete() End Using
Answer: A

23. You are creating a Windows Forms application. The application uses a SqlCommand object named cmd. The cmd object executes the following stored procedure. CREATE PROCEDURE GetPhoneList AS BEGIN
SELECT CompanyName, Phone FROM Customers
SELECT CompanyName, Phone FROM Suppliers
END
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));
}
Answer: A

24. You have an SQL querythat takesone minute to execute.
You use the following code segment to execute the SQLquery asynchronously. IAsyncResult ar = cmd.BeginExecuteReader();
You need to execute a method named DoWork() that takes one second to run while the SQL query is executing.
DoWork() must run as many times as possible while the SQL query isexecuting. Which code segment should you use?
A. while (ar.AsyncWaitHandle == null) { DoWork();
}
dr = cmd.EndExecuteReader(ar);
B. while (!ar.IsCompleted) { DoWork();
}
dr = cmd.EndExecuteReader(ar);
C. while (Thread.CurrentThread.ThreadState == ThreadState.Running) { DoWork();
}
dr = cmd.EndExecuteReader(ar);
D. while (!ar.AsyncWaitHandle.WaitOne()) { DoWork();
}
dr = cmd.EndExecuteReader(ar);
Answer: B

25. You are creating a Windows Forms application. Theapplication uses a SqlCommand object named cmd.
The cmd object executes the following stored procedure. CREATE PROCEDURE GetPhoneList AS BEGIN
SELECT CompanyName, Phone FROM Customers SELECT CompanyName, Phone FROM Suppliers END
You need to add all returned rows to the ListBox control named lstPhones. Which code segment should you use?
A. Dim rdr As SqlDataReader = cmd.ExecuteReader() Do While rdr.Read()
lstPhones.Items.Add((rdr.GetString(0) + ControlChars.Tab + rdr.GetString(1)))
EndWhileLoop While rdr.NextResult()
B. Dim rdr As SqlDataReader = cmd.ExecuteReader() While rdr.Read()
lstPhones.Items.Add((rdr.GetString(0) + ControlChars.Tab + rdr.GetString(1))) End While
C. Dim rdr As SqlDataReader = cmd.ExecuteReader() While rdr.NextResult()
While rdr.Read()
lstPhones.Items.Add((rdr.GetString(0) + ControlChars.Tab + rdr.GetString(1))) EndWhileEnd While
D. Dim rdr As SqlDataReader = cmd.ExecuteReader() While rdr.NextResult()
lstPhones.Items.Add((rdr.GetString(0) + ControlChars.Tab + rdr.GetString(1))) End While
Answer: A

26. You have an SQL querythat takesone minute to execute.
You use the following code segment to execute the SQLquery asynchronously.
Dim ar As IAsyncResult = cmd.BeginExecuteReader()
You need to execute a method named DoWork() that takes one second to run while the SQL query is executing.
DoWork() must run as many times as possible while the SQL query isexecuting. Which code segment should you use?
A. While ar.AsyncWaitHandle Is Nothing
DoWork() End While
dr = cmd.EndExecuteReader(ar)
B. WhileNot ar.IsCompleted DoWork()
End While
dr = cmd.EndExecuteReader(ar)
C. While Thread.CurrentThread.ThreadState = ThreadState.Running
DoWork() End While
dr = cmd.EndExecuteReader(ar)
D. While Not ar.AsyncWaitHandle.WaitOne() DoWork()
End While
dr = cmd.EndExecuteReader(ar)
Answer: B

27. You are creating a Windows Forms application. The application loads a data table named dt from a database
and modifies each value in the datatable.
You add the following code. (Line numbers are included for reference only.)
01 foreach (DataRow row in dt.Rows) {
02foreach (DataColumn col in dt.Columns) {
03
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 loadedand 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]);
Answer: D

28. You are creating a Windows Forms application. The application loads a data table named dt from a database
and modifies each value in the datatable.
You add the following code. (Line numbers are included for reference only.)
01 Dim row As DataRow
02 For Each row In dt.Rows
03 Dimcol As DataColumn04For Each col In dt.Columns
05
06 Trace.WriteLine(str)
07 Nextcol
08 Next rowYou need to format the string named str to show the value of the column at the time the data is loadedand thecurrent value in the column.
Which code segment should you add at line 05?
A. Dim str AsString = String.Format("Column was {0} is now {1}", row(col), row(col, DataRowVersion.Current))
B. Dim str As String = String.Format("Column was {0} is now {1}", row(col, DataRowVersion.Default), row(col))
C. Dim str As String = String.Format("Column was {0} is now {1}", row(col), row(col, DataRowVersion.Proposed))
D. Dim str AsString = String.Format("Column was {0} is now {1}", row(col, DataRowVersion.Original), row(col))
Answer: D

29. AWindows Forms application contains the following code segment.
string SQL = @"SELECT EmployeeID, LastName, FirstName FROM Employees"; SqlDataAdapter da = new SqlDataAdapter(SQL, connStr);
DataTable dt = new DataTable();
da.MissingSchemaAction = MissingSchemaAction.AddWithKey; SqlCommandBuilder bld = newSqlCommandBuilder(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 rowsmust still be added. The code must log how many new
rows failed to be added.
You need to propagate the additions to the database andlog a failed count.
Which code segment should you use?
A. da.ContinueUpdateOnError = true; da.Update(dt);
DataTable dtErrors = dt.GetChanges(DataRowState.Unchanged); Trace.WriteLine(dtErrors.Rows.Count.ToString() + " rows not added.");
B. da.ContinueUpdateOnError = false;
da.Update(dt);
DataTable dtErrors = dt.GetChanges(DataRowState.Unchanged); 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.");
Answer: C


© 2014 Cheat-Test.com, All Rights Reserved