Exam 70-561 preparation questions

Page 1

Exam 70-561 study material Made available by Testkingprep.com

Free 70-561 Exam Preparation Questions Exam 70-561: TS: Microsoft .NET Framework 3.5, ADO.NET Application Development

For Latest 70-561 Exam Questions and study guides- visit- http://www.testkingprep.com/70-561.html


Question:1 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, ordistributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you are using the Microsoft .NET Framework 3.5 and Microsoft Synchronization Services for Microsoft ADO.NET to create an application. You write the following code segment. (Line numbers are used for reference only.) 1 Private Sub Option() 2 Dim scr As New SyncConflictResolver() 3 scr.ClientUpdateServerUpdateAction = ResolveAction.FireEvent 4 Dim csp As New SqlCeClientSyncProvider() 5 6 End Sub Now your company CIO assigns a task to you. According to his requirement, you must make sure that when data is updated in the database of the application, the application deals with synchronization conflicts. At line5, which line of code should you insert? A. AddHandler csp.SyncProgress, AddressOf _ csp_SyncProgress B. AddHandler csp.ChangesApplied, AddressOf _ csp_ChangesApplied C. AddHandler csp.ApplyChangeFailed, AddressOf _ csp_ApplyChangeFailed D. AddHandler csp.ApplyingChanges, AddressOf _ csp_ApplyingChanges Answer: C Question:2 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, ordistributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application. The application reads data from a Microsoft SQL Server 2005 database. In the exception handler of the application, you write the code segment below. (Line numbers are usedfor reference only.) 01 Private Function ShowSQLErrors(ByVal ex As _ SqlException) As String 02 Dim sb As New StringBuilder() 03 For Each err As SqlError In ex.Errors04 sb.Append("Message: ") 05 sb.Append(err.Number.ToString()) 06 sb.Append(", Level: ") 07 08 sb.Append(" ,State: ") 09 sb.Append(err.State.ToString()) 10 sb.Append(" ,Source: ") 11 sb.AppendLine(err.Source.ToString()) 12 sb.AppendLine(err.Message.ToString()) 13 sb.AppendLine() 14 Next 15 Return sb.ToString() 16 End Function You need to ensure that the error message for each SQL error that occurs includes the original severity level of the error. At line7, which line of code should be inserted? A. sb.Append(err.LineNumber.ToString()) B. sb.Append(err.ToString()) C. sb.Append(err.[Class].ToString()) D. sb.Append(err.Procedure.ToString()) Answer: C Question:3 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, ordistributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application. The application reads data from a Microsoft SQL Server 2005 database. There's a table named Sorts in the database. The Sorts table contains a primary key identity column named SortID. The application uses the following stored procedure to insert new records by. CREATE PROCEDURE dbo.InsertSort@SortName nvarchar(15),@Identity int OUT AS INSERT INTO Sorts (SortName) VALUES(@SortName) SET @Identity = SCOPE_IDENTITY() RETURN @@ROWCOUNT You write the following code segment. Dim adapter As New SqlDataAdapter("SELECT SortID," + _ " SortName FROM dbo.Sorts", connection)

For Latest 70-561 Exam Questions and study guides- visit- http://www.testkingprep.com/70-561.html


adapter.InsertCommand = New SqlCommand("dbo.InsertSort", _ connection)adapter.InsertCommand.CommandType = CommandType.StoredProcedure adapter.InsertCommand.Parameters.Add( _ New SqlParameter("@SortName", SqlDbType.NVarChar, _ 15, "SortName")) Now the identity value for the newly created record has to be retrieved. You have to perform this. In the options below, which code segment should you add? A. Dim parameter As SqlParameter = _ adapter.InsertCommand.Parameters.Add("@SortID", _ SqlDbType.Int, 0)parameter.Direction = ParameterDirection.Output B. Dim parameter As SqlParameter = _ adapter.InsertCommand.Parameters.Add("SortID", _ SqlDbType.Int, 0)parameter.Direction = ParameterDirection.Output C. Dim parameter As SqlParameter = _ adapter.InsertCommand.Parameters.Add("@Identity", _ SqlDbType.Int, 0)parameter.Direction = ParameterDirection.ReturnValue D. Dim parameter As SqlParameter = _ adapter.InsertCommand.Parameters.Add("@Identity", _ SqlDbType.Int, 0)parameter.Direction = ParameterDirection.Output Answer: D Question:4 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, or distributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application. The application reads data from a Microsoft SQL Server 2005 database. Now according to the company requirements, the security-related exceptions have to be seperated from the other exceptions for database operations when running. In the options below, which code segment should you choose to use? A. Catch ex As System.Security.SecurityException 'Handle all database security related exceptions.End Try B. Catch ex As System.Data.SqlClient.SqlException For i As Integer = 0 To ex.Errors.Count - 1 If ex.Errors(i).Number = 14 Then 'Handle all database security related exceptions. Else 'Handle other exceptions End If NextEnd Try C. Catch ex As System.Data.SqlClient.SqlException For i As Integer = 0 To ex.Errors.Count - 1 If ex.Errors(i).[Class].ToString() = "14" Then 'Handle all database security related exceptions. Else 'Handle other exceptions End If NextEnd Try D. Catch ex As System.Data.SqlClient.SqlException For i As Integer = 0 To ex.Errors.Count - 1 If ex.Errors(i).Message.Contains("Security") Then 'Handle all database security related eceptions. Else 'Handle other exceptions End If NextEnd Try Answer: C Question:5 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, ordistributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application. You write the following code segment. (Line numbers are used for reference only.) 1 Dim dt As New DataTable() 2 dt.Columns.Add("number") 3 dt.Columns.Add("string") 4 dt.Rows.Add(1, "3") 5 dt.Rows.Add(2, "2") 6 dt.Rows.Add(3, "1") 7 Dim result = From p In dt.AsEnumerable() _ 8 9 For Each number In result 10 Console.Write(number.ToString()) 11 Next You have to display the string "321". At line 8, which line of code should you insert? A. Order By p("string") Descending Select p("number") B. Order By p("number") Descending Select p("string") C. Order By p("number") Select p("string") D. Order By p("string") Ascending Select p("string") Answer: C Question:6

For Latest 70-561 Exam Questions and study guides- visit- http://www.testkingprep.com/70-561.html


You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, or distributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application. The application reads data from a Microsoft SQL Server 2005 database. Look at the stored procedure below which is used by the application. CREATE PROCEDURE [dbo].[UpdateShippers] @CountryCode NVarchar(10) ,@NewRateCode int AS BEGIN Update dbo.Shippers SET RateCode = @NewRateCode Where CountryCode = @CountryCode RETURN @@ROWCOUNTEND You write the following code segment. (Line numbers are used for reference only.) 1 Using connection As New SqlConnection(connectionString)2 connection.Open() 3 Dim command As New SqlCommand("UpdateShippers", connection) 4 5 command.ExecuteNonQuery() 6 End Using Now you must make sure that the application can update the Shippers table. At line 4, which code segment should be inserted? A. command.CommandType = CommandType.StoredProcedureDim parameter As SqlParameter = _ command.Parameters.Add("@RowCount", SqlDbType.Int)parameter.Direction = ParameterDirection.ReturnValueparameter = command.Parameters.Add("CountryCode", _ SqlDbType.NVarChar, 10, "@CountryCode")parameter = command.Parameters.Add("RateCode", _ SqlDbType.Int, 0, "@NewRateCode")command.Parameters("CountryCode").Value "USA"command.Parameters("RateCode").Value = "778" B. command.CommandType = CommandType.StoredProcedureDim parameter As SqlParameter = _ command.Parameters.Add("@RowCount", SqlDbType.Int)parameter.Direction = ParameterDirection.ReturnValueparameter = command.Parameters.Add("@CountryCode", _ SqlDbType.NVarChar, 10)parameter = command.Parameters.Add("@NewRateCode", _ SqlDbType.Int)command.Parameters("@CountryCode").Value = "USA"command.Parameters("@NewRateCode").Value = "778" C. command.CommandType = CommandType.StoredProcedureDim parameter As SqlParameter = _ command.Parameters.Add("@RowCount", SqlDbType.Int)parameter.Direction = ParameterDirection.InputOutputparameter = command.Parameters.Add("@CountryCode", _ SqlDbType.NVarChar, 10)parameter = command.Parameters.Add("@NewRateCode", _ SqlDbType.Int, 0)command.Parameters("@CountryCode").Value = "USA"command.Parameters("@NewRateCode").Value = "778" D. command.CommandType = CommandType.StoredProcedureDim parameter As SqlParameter = _ command.Parameters.Add("@RowCount", SqlDbType.Int)parameter.Direction = ParameterDirection.Outputparameter = command.Parameters.Add("@CountryCode", _ SqlDbType.NVarChar, 10, "CountryCode")parameter = command.Parameters.Add("@NewRateCode", _ SqlDbType.Int, 0, "RateCode")command.Parameters("@CountryCode").Value = "USA"command.Parameters("@NewRateCode").Value = "778" Answer: B Question:7 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, or distributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application. You write the following code segment. (Line numbers are used for reference only.) 1 Private Sub GetRecords(ByVal da As SqlDataAdapter, _ ByVal table As DataTable) 2 3 Try 4 da.Fill(table) 5 Catch exp As SqlException 6 7 Finally 8 9 End Try 10 End Sub 11 You set the da.SelectCommand.CommandText property to a stored procedure. You declare a variable named @ctf in the stored procedure. For each record which contains a bad shipping address, the stored procedure sets @ctf with the id of the record and raises an error for the record. The error raised is as shown in the following text: RaiseError(@ctf, 10, 1) You must make sure that even if invalid records are

For Latest 70-561 Exam Questions and study guides- visit- http://www.testkingprep.com/70-561.html


present, all valid records are retrieved. Besides this, you must make sure that for each invalid record, a list item is added to the lstResults list box. What action should you perform? A. At line6, the following code segment should be inserted. For Each [error] As SqlError In exp.Errors lstResult.Items.Add(exp.Message)Next B. At line 8, the following code segment should be inserted. For Each row As DataRow In table.Rows If row.HasErrors Then lstResult.Items.Add(row.RowError) End IfNext C. At line 2, the following code segment should be inserted da.SelectCommand.Connection.InfoMessage += new SqlInfoMessageEventHandler(Connection_InfoMessage); At line 11, the following code segment has to be inserted at line 11. Private Sub Connection_InfoMessage(ByVal sender As Object, _ ByVal e As SqlInfoMessageEventArgs) lstResult.Items.Add(e.Message)End Sub D. At line 2, the following code segment should be inserted. Dim notices As New SqlNotificationRequest()da.SelectCommand.Notification = notices At line 8, the following line of code has to be inserted. lstResult.Items.Add(notices.UserData) Answer: C Question:8 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, or distributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application. The application reads data from a Microsoft SQL Server 2005 database. There're two tables in the database. The two tables are respectively named Client and Site. A DataSet object that contains two DataTable objects is used by the application. The DataTable objects reference the Client table and the Site table. You write the following code segment. Dim CliSiteDS As New DataSet() CliSiteDS.EnforceConstraints = True Dim CliSiteRel As New DataRelation("CliSiteRel", _ CliSiteDS.Tables("Client").Columns("ClientID"), _ CliSiteDS.Tables("Site").Columns("ClientID")) CliSiteDS.Relations.Add(CliSiteRel) The Client table contains 200 records that are related to records in the Site table. Now you must make sure of two things. First you must make sure that when you update records in the Client table, the application updates the related records in the Site table; Second, you must make sure that when you try to delete related records, an exception is thrown by the application. In the options below, which code segment should be used? A. CliSiteRel.ChildKeyConstraint.UpdateRule = Rule.CascadeCliSiteRel.ChildKeyConstraint.DeleteRule = Rule.Cascade B. CliSiteRel.ChildKeyConstraint.UpdateRule = Rule.SetDefaultCliSiteRel.ChildKeyConstraint.DeleteRule = Rule.Cascade C. CliSiteRel.ChildKeyConstraint.DeleteRule = _ Rule.None D. CliSiteRel.ChildKeyConstraint.UpdateRule = Rule.NoneCliSiteRel.ChildKeyConstraint.DeleteRule = Rule.Cascade Answer: C Question:9 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, ordistributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application. The application reads data from a Microsoft SQL Server 2005 database. The connection string of the application is defined in the following manner. "Server=Prod;Database=WingtipToys;IntegratedSecuri ty=SSPI;Asynchronous Processing=true" The code segment below is contained in the applicaton. (Line numbers are included for reference only.)

For Latest 70-561 Exam Questions and study guides- visit- http://www.testkingprep.com/70-561.html


1 Protected Sub UpdateData(ByVal cmd As SqlCommand) 2 cmd.Connection.Open() 3 4 lblResult.Text = "Updating ..." 5 End Sub It takes a long time for the cmd object to execute. You must make sure that when cmd is executing, the application continues to run. What action should you perform? A. At line 3, the following code segment should be inserted. AddHandler cmd.StatementCompleted, AddressOf UpdateCompletecmd.ExecuteNonQuery() Then the following code segment should be added. Private Sub UpdateComplete(ByVal sender As Object, _ ByVal e As StatementCompletedEventArgs) Dim count As Integer = e.RecordCount LogResults(count)End Sub B. At line 3, the following code segment should be inserted. cmd.BeginExecuteNonQuery(New AsyncCallback( _ AddressOf UpdateComplete), cmd) Then the following code segment should be added. Private Sub UpdateComplete (ByVal ar As IAsyncResult) Dim count As Integer = CInt(ar.AsyncState) LogResults(count)End Sub C. At line 3, the following code segment should be inserted. Dim notification As New _ SqlNotificationRequest("UpdateComplete ", "", 10000)cmd.Notification = notificationcmd.ExecuteNonQuery() Then the following code segment should be added. Private Sub UpdateComplete (ByVal notice As SqlNotificationRequest) Dim count As Integer = Integer.Parse(notice.UserData) LogResults(count)End Sub D. At line 3, the following code segment should be inserted. cmd.BeginExecuteNonQuery(New AsyncCallback( _ AddressOf UpdateComplete), cmd) Then the following code segment should be added. Private Sub UpdateComplete(ByVal ar As IAsyncResult) Dim cmd As SqlCommand = DirectCast(ar.AsyncState, SqlCommand) Dim count As Integer = cmd.EndExecuteNonQuery(ar) LogResults(count)End Sub Answer: D Question:10 You have just graduated from college, now you are serving the internship as the software developer in an international company. You have some experience developing Web, Windows, ordistributed applications by using the Microsoft .NET Framework. Now according to the company requirement, you use the Microsoft .NET Framework 3.5 and Microsoft ADO.NET to create an application which contains a DataTable object named OrderDetailTable. The object has the following columns: ID; OrderID; ProductID; Quantity; LineTotal The OrderDetailTable object is populated with data provided by a business partner. Some of the records contain a null value in the LineTotal field and 0 in the Quantity field. You write the following code segment. (Line numbers are used for reference only.) 1 Dim col As New DataColumn("UnitPrice", GetType(Decimal)) 2 3 OrderDetailTable.Columns.Add(col) A DataColumn named UnitPrice has to be added to the OrderDetailTable object. At line 2, which line of code should you insert? A. col.Expression = "LineTotal/Quantity" B. col.Expression = "LineTotal/ISNULL(Quantity, 1)" C. col.Expression = "LineTotal.Value/ISNULL(Quantity.Value, 1)" D. col.Expression = "iif(Quantity > 0, LineTotal/Quantity, 0)" Answer: D

For Latest 70-561 Exam Questions and study guides- visit- http://www.testkingprep.com/70-561.html


For complete Exam 70-561 Training kits and Self-Paced Study Material Visit: http://www.testkingprep.com/70-561.html

http://www.testkingprep.com/

For Latest 70-561 Exam Questions and study guides- visit- http://www.testkingprep.com/70-561.html


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.