application uses the ADO.NET Entity Framework to model entities. You define a Category class by writing
the following code segment. (Line numbers are included for reference only.)
01 public class Category
02 {
03 public int CategoryID { get; set; }
04 public string CategoryName { get; set; }
05 public string Description { get; set; }
06 public byte[] Picture { get; set; }
07
08 }
You need to add a collection named Products to the Category class. You also need to ensure that the
collection supports deferred loading. Which code segment should you insert at line 07?
A.public static List
B.public virtual List
C.public abstract List
D.protected List
Answer: B
2.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Forms
application. You plan to deploy the application to several shared client computers. You write the following
code segment. (Line numbers are included for reference only.)
01Configuration config = ConfigurationManager.OpenExeConfiguration(exeConfigName);
02
03config.Save();
04...
You need to encrypt the connection string stored in the .config file. Which code segment should you insert
at line 02?
A.ConnectionStringsSection section = config.GetSection("connectionString") as
ConnectionStringsSection;
section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
B.ConnectionStringsSection section = config.GetSection("connectionStrings") as
ConnectionStringsSection;
section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
C.ConnectionStringsSection section = config.GetSection("connectionString") as
ConnectionStringsSection;
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
D.ConnectionStringsSection section = config.GetSection("connectionStrings") as
ConnectionStringsSection;
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
Answer: D
3.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity
The safer , easier way to help you pass any IT exams.
3 / 8
Framework to model entities. The database includes objects based on the exhibit. The application
includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities context = new AdventureWorksEntities()){
02
03 foreach (SalesOrderHeader order in customer.SalesOrderHeader){
04Console.WriteLine(String.Format("Order: {0} ", order.SalesOrderNumber));
05 foreach (SalesOrderDetail item in order.SalesOrderDetail){
06Console.WriteLine(String.Format("Quantity: {0} ", item.Quantity));
07Console.WriteLine(String.Format("Product: {0} ", item.Product.Name));
08}
09}
10}
You want to list all the orders for a specified customer. You need to ensure that the list contains the
following fields: "Order number "Quantity of products "Product name Which code segment should you
insert at line 02?
A.Contact customer = context.Contact.Where("it.ContactID = @customerId", new
ObjectParameter("@customerId", customerId)).First();
B.Contact customer = context.Contact.Where("it.ContactID = @customerId", new
ObjectParameter("customerId", customerId)).First();
C.context.ContextOptions.LazyLoadingEnabled = true; Contact customer = (From contact in
context.Contact include("SalesOrderHeader.SalesOrderDetail") select conatct). FirstOrDefault();
D.Contact customer = (From contact in context.Contact include("SalesOrderHeader") select conatct).
FirstOrDefault();
Answer: B
4.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You
use the ADO.NET Entity Framework to model entities. You write the following code segment. (Line
numbers are included for reference only.)
01AdventureWorksEntities context = New AdventureWorksEntities
(http://localhost:1234/AdventureWorks.svc );
02
03var q = from c in context.Customers
04where c.City == "London"
05orderby c.CompanyName
06select c;
You need to ensure that the application meets the following requirements: "Compares the current values
of unmodified properties with values returned from the data source. "Marks the property as modified when
the properties are not the same. Which code segment should you insert at line 02?
A.context.MergeOption = MergeOption.AppendOnly;
B.context.MergeOption = MergeOption.PreserveChanges;
C.context.MergeOption = MergeOption.OverwriteChanges;
D.context.MergeOption = MergeOption.NoTracking;
Answer: B
The safer , easier way to help you pass any IT exams.
4 / 8
5.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You
use the ADO.NET Entity Framework to model entities. You write the following code segment. (Line
numbers are included for reference only.)
01public partial class SalesOrderDetail : EntityObject
02{
03partial void OnOrderQtyChanging(short value)
04{
05
06{
07...
08}
09}
10}
You need to find out whether the object has a valid ObjectStateEntry instance. Which code segment
should you insert at line 05?
A.if (this.EntityState != EntityState.Detached)
B.if (this.EntityState != EntityState.Unchanged)
C.if (this.EntityState != EntityState.Modified)
D.if (this.EntityState != EntityState.Added)
Answer: D
6.You use Microsoft Visual Studio 2010, Microsoft Sync Framework, and Microsoft .NET Framework 4 to
create an application. You have a ServerSyncProvider connected to a Microsoft SQL Server database.
The database is hosted on a Web server. Users will use the Internet to access the Customer database
through the ServerSyncProvider. You write the following code segment. (Line numbers are included for
reference only.)
01SyncTable customerSyncTable = new SyncTable("Customer");
02customerSyncTable.CreationOption = TableCreationOption. UploadExistingOrCreateNewTable;
03
04customerSyncTable.SyncGroup = customerSyncGroup;
05 this.Configuration.SyncTables.Add(customerSyncTable);
You need to ensure that the application meets the following requirements: "Users can modify data locally
and receive changes from the server. "Only changed rows are transferred during synchronization. Which
code segment should you insert at line 03?
A.customerSyncTable.SyncDirection = SyncDirection.DownloadOnly;
B.customerSyncTable.SyncDirection = SyncDirection.Snapshot;
C.customerSyncTable.SyncDirection = SyncDirection.Bidirectional;
D.customerSyncTable.SyncDirection = SyncDirection.UploadOnly;
Answer: C
7.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows
Communication Foundation (WCF) Data Services service. The service connects to a Microsoft SQL
Server 2008 database. The service is hosted by an Internet Information Services (IIS) 6.0 Web server.
The application works correctly in the development environment. However, when you connect to the
The safer , easier way to help you pass any IT exams.
5 / 8
service on the production server, attempting to update or delete an entity results in an error. You need to
ensure that you can update and delete entities on the production server. What should you do?
A.Add the following line of code to the InitializeService method of the service.
config.SetEntitySetAccessRule ("*",EntitySetRights.WriteDelete | EntitySetRights.WriteInsert);
B.Add the following line of code to the InitializeService method of the service.
config.SetEntitySetAccessRule ("*",EntitySetRights.WriteDelete | EntitySetRights.WriteMerge);
C.Configure IIS to allow the PUT and DELETE verbs for the .svc Application Extension.
D.Configure IIS to allow the POST and DELETE verbs for the .svc Application Extension.
Answer: C
8.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server 2008 database. The database includes a table named
dbo.Documents that contains a column with large binary dat a. You are creating the Data Access Layer
(DAL). You add the following code segment to query the dbo.Documents table. (Line numbers are
included for reference only.)
01public void LoadDocuments(DbConnection cnx)
02{
03var cmd = cnx.CreateCommand();
04cmd.CommandText = "SELECT * FROM dbo.Documents";
05...
06cnx.Open();
07
08ReadDocument(reader); }
You need to ensure that data can be read as a stream. Which code segment should you insert at line 07?
A.var reader = cmd.ExecuteReader(CommandBehavior.Default);
B.var reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly);
C.var reader = cmd.ExecuteReader(CommandBehavior.KeyInfo);
D.var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
Answer: D
9.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. You create a DataSet object in the application.
You add two DataTable objects named App_Products and App_Categories to the DataSet. You add the
following code segment to populate the DataSet object. (Line numbers are included for reference only.)
01public void Fill(SqlConnection cnx, DataSet ds) {
03var cmd = cnx.CreateCommand();
04cmd.CommandText = "SELECT * FROM dbo.Products; " + "SELECT * FROM dbo.Categories";
05var adapter = new SqlDataAdapter(cmd);
06
07}
You need to ensure that App_Products and App_Categories are populated from the dbo.Products and
dbo.Categories database tables. Which code segment should you insert at line 06?
A.adapter.Fill(ds, "Products"); adapter.Fill(ds, "Categories");
B.adapter.Fill(ds.Tables["App_Products"]);
The safer , easier way to help you pass any IT exams.
6 / 8
adapter.Fill(ds.Tables["App_Categories"]);
C.adapter.TableMappings.Add("Table", "App_Products");
adapter.TableMappings.Add("Table1", "App_Categories");
adapter.Fill(ds);
D.adapter.TableMappings.Add("Products", "App_Products");
adapter.TableMappings.Add("Categories", "App_Categories");
adapter.Fill(ds);
Answer: C
10.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows
Communication Foundation (WCF) Data Services service. You deploy the data service to the followin
URL: http://contoso.com/Northwind.svc. You add the following code segment. (Line numbers are included
for reference only.)
01var uri = new Uri(@"http://contoso.com/Northwind.svc/");
02var ctx = new NorthwindEntities(uri);
03var categories = from c in ctx.Categories 04select c;
04foreach (var category in categories) {
05PrintCategory(category);
06
07foreach (var product in category.Products) {
08
09PrintProduct(product);
10}
11}
You need to ensure that the Product data for each Category object is lazy-loaded. What should you do?
A.Add the following code segment at line 06.
ctx.LoadProperty(category, "Products");
B.Add the following code segment at line 08.
ctx.LoadProperty(product, "*");
C.Add the following code segment at line 06.
var strPrdUri = string.Format("Categories({0})?$expand=Products", category.CategoryID);
var productUri = new Uri(strPrdUri, UriKind.Relative);
ctx.Execute
D.Add the following code segment at line 08.
var strprdUri= string.format("Products?$filter=CatgoryID eq {0}", category.CategoryID);
VarProdcutUri = new Uri(strPrd, UriKind.Relative);
ctx.Execute
Answer: A
11.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database.
You load records from the Customers table into a DataSet object named dataset.
You need to retrieve the value of the City field from the first and last records in the Customers table.
Which code segment should you use?
The safer , easier way to help you pass any IT exams.
7 / 8
A.DataTable dt = dataset.Tables["Customers"];
string first = dt.Rows[0]["City"].ToString();
string last = dt.Rows[dt.Rows.Count - 1]["City"].ToString();
B.DataTable dt = dataset.Tables["Customers"];
string first = dt.Rows[0]["City"].ToString();
string last = dt.Rows[dt.Rows.Count]["City"].ToString();
C.DataRelation relationFirst = dataset.Relations[0];
DataRelation relationLast = dataset.Relations[dataset.Relations.Count - 1];
string first = relationFirst.childTable.Columns["City"].ToString();
string last = relationLast.childTable.Columns["City"].ToString();
D.DataRelation relationFirst = dataset.Relations[0];
DataRelation relationLast = dataset.Relations[dataset.Relations.Count];
string first = relationFirst.childTable.Columns["City"].ToString();
string last = relationLast.childTable.Columns["City"].ToString();
Answer: A
12.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. The application has two DataTable objects that
reference the Customers and Orders tables in the database. The application contains the following code
segment. (Line numbers are included for reference only.
01DataSet customerOrders = new DataSet();
02customerOrders.EnforceConstraints = true;
03ForeignKeyConstraint ordersFK = new ForeignKeyConstraint("ordersFK",
04customerOrders.Tables["Customers"].Columns["CustomerID"],
05customerOrders.Tables["Orders"].Columns["CustomerID"]);
06
07customerOrders.Tables["Orders"].Constraints.Add(ordersFK);
You need to ensure that an exception is thrown when you attempt to delete Customer records that have
related Order records. Which code segment should you insert at line 06?
A.ordersFK.DeleteRule = Rule.SetDefault;
B.ordersFK.DeleteRule = Rule.None;
C.ordersFK.DeleteRule = Rule.SetNull;
D.ordersFK.DeleteRule = Rule.Cascade;
Answer: B
13.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. The application uses a DataTable named
OrderDetailTable that has the following columns: "ID "OrderID "ProductID "Quantity "LineTotal Some
records contain a null value in the LineTotal field and 0 in the Quantity field. You write the following code
segment. (Line numbers are included for reference only.)
01DataColumn column = new DataColumn("UnitPrice", typeof(double));
02
03OrderDetailTable.Columns.Add(column);
You need to add a calculated DataColumn named UnitPrice to the OrderDetailTable object. You also need
The safer , easier way to help you pass any IT exams.
8 / 8
to ensure that UnitPrice is set to 0 when it cannot be calculated. Which code segment should you insert at
line 02?
A.column.Expression = "LineTotal/Quantity";
B.column.Expression = "LineTotal/ISNULL(Quantity, 1)";
C.column.Expression = "if(Quantity > 0, LineTotal/Quantity, 0)";
D.column.Expression = "iif(Quantity > 0, LineTotal/Quantity, 0)";
Answer: D
14.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database and contains a LINQ to SQL data model. The
data model contains a function named createCustomer that calls a stored procedure. The stored
procedure is also named createCustomer. The createCustomer function has the following signature.
createCustomer (Guid customerID, String customerName, String address1)
The application contains the following the following code segment. (Line numbers are included for
reference only.)
01CustomDataContext context = new CustomDataContext();
02Guid userID = Guid.NewGuid();
03String address1 = "1 Main Steet";
04String name = "Marc";
05
You need to use the createCustomer stored procedure to add a customer to the database. Which code
segment should you insert at line 05?
A.context.createCustomer(userID, customer1, address1)
B.context.ExecuteCommand("createCustomer", userID, customer1, address1);
Customer customer = new Customer() { ID = userID, Address1 = address1, Name = customer1, };
C.context.ExecuteCommand("createCustomer", customer);
Customer customer = new Customer() { ID = userID, Address1 = address1, Name = customer1, };
D.context.ExecuteQuery(typeof(Customer), "createCustomer", customer);
Answer: A
15.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. You use the ADO.NET Entity Framework to
manage persistence-ignorant entities. You create an ObjectContext instance named context. Then, you
directly modify properties on several entities. You need to save the modified entity values to the database.
Which code segment should you use?
A.context.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);
B.context.SaveChanges(SaveOptions.DetectChangesBeforeSave);
C.context.SaveChanges(SaveOptions.None);
D.context.SaveChanges();
Answer: B
Free download MCTS 70-516(TS: Accessing Data with Microsoft .NET Framework 4) training material and Practice Test,if you need more IT exam real Q&As,u can leave ur mailbox,or like my facebook page.
i need mroe...can send it to caomeiqin@hotmail.com
ReplyDeletecould u send full list to tihar@yandex.ru
ReplyDeletecould u send full list to kimev_work@mail.ru
ReplyDeletePlease send me a copy on gooogle.ghost@gmail.com
ReplyDeleteI would like to have the entire test : ptitom_temp-misc@yahoo.fr
ReplyDeleteThank you.
hi can you post the test to cfl250@gmail.com
ReplyDeletethanks.
Could you send a copy to tliuar@hotmail.com, thanks a lot.
ReplyDeleteHi,
ReplyDeleteDo you have the new testlets for the 70-516 exam ? if so can you send me a copy to joaoamabrandao@hotmail.com
any one have latest dump4certs testlet dumps
ReplyDeleteHi,
ReplyDeleteThis is venkat recently I had written 70-516 exam and failed in that exams because of testlets.Do you have the new testlets for the 70-516 exam ? if so could you please send me a copy to kadiyamramana@gmail.com