Microsoft 70-487 Exam Practice Questions (P. 5)
- Full Access (200 questions)
- Six months of Premium Access
- Access to one million comments
- Seamless ChatGPT Integration
- Ability to download PDF files
- Anki Flashcard files for revision
- No Captcha & No AdSense
- Advanced Exam Configuration
Question #21
You are developing an ASP.NET MVC application. The application has a page that searches for and displays an image stored in a database. Members of the
EntityClient namespace are used to access an ADO.NET Entity Framework data model Images and associated metadata are stored in a database table.
You need to run a query that returns only the image while minimizing the amount of data that is transmitted.
Which method of the EntityCommand type should you use?
EntityClient namespace are used to access an ADO.NET Entity Framework data model Images and associated metadata are stored in a database table.
You need to run a query that returns only the image while minimizing the amount of data that is transmitted.
Which method of the EntityCommand type should you use?
- AExecuteScalar
- BExecuteDbDataReader
- CExecuteReader
- DExecuteNonQuery A
Correct Answer:
Explanation
The SqlCommand.ExecuteScalar method executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
References:
https://msdn.microsoft.com/en-us/library/system.data.entityclient.entitycommand(v=vs.110).aspx
Explanation
The SqlCommand.ExecuteScalar method executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
References:
https://msdn.microsoft.com/en-us/library/system.data.entityclient.entitycommand(v=vs.110).aspx
send
light_mode
delete
Question #22
DRAG DROP -
You have an Azure SQL Database that contains two tables named Country and City.
You need to insert a country into the Country table and a city into the City table. The solution must meet the following requirements:
✑ If an error occurs while attempting to add the country, the city must NOT be added.
✑ If an error occurs while attempting to add the city, the country must NOT be added.
How should you complete the code? To answer, drag the appropriate code blocks to the correct locations in the answer area. Each code block may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Select and Place:

You have an Azure SQL Database that contains two tables named Country and City.
You need to insert a country into the Country table and a city into the City table. The solution must meet the following requirements:
✑ If an error occurs while attempting to add the country, the city must NOT be added.
✑ If an error occurs while attempting to add the city, the country must NOT be added.
How should you complete the code? To answer, drag the appropriate code blocks to the correct locations in the answer area. Each code block may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Select and Place:

Correct Answer:
References:
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction(v=vs.110).aspx

References:
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction(v=vs.110).aspx
send
light_mode
delete
Question #23
You are developing an ASP.NET MVC application that displays a report. The report includes large images that are stored in a database. Members of the
EntityClient namespace are used to access the database through the ADO.NET Entity Framework data model.
You need to prevent memory exceptions while generating a report using the EntityDataReader type.
Which CommandBehavior type should you use?
EntityClient namespace are used to access the database through the ADO.NET Entity Framework data model.
You need to prevent memory exceptions while generating a report using the EntityDataReader type.
Which CommandBehavior type should you use?
- ASequentialAccess
- BSingleRow
- CSingleResult
- DFastForwardReadOnly
Correct Answer:
A
SequentialAccess provides a way for the DataReader to handle rows that contain columns with large binary values. Rather than loading the entire row,
SequentialAccess enables the DataReader to load data as a stream. You can then use the GetBytes or GetChars method to specify a byte location to start the read operation, and a limited buffer size for the data being returned.
A
SequentialAccess provides a way for the DataReader to handle rows that contain columns with large binary values. Rather than loading the entire row,
SequentialAccess enables the DataReader to load data as a stream. You can then use the GetBytes or GetChars method to specify a byte location to start the read operation, and a limited buffer size for the data being returned.
send
light_mode
delete
Question #24
You are developing a library management application that uses the ADO.NET Entity Framework against a SQL Server database.
The application has a method that returns check outs filtered by date.
The Book class is shown below.

You must filter the data on the SQL server before it is returned to the application server.
You need to return books checked out more recently than the entered date.
Which code segment should you use?
A)

B)

C)

D)

The application has a method that returns check outs filtered by date.
The Book class is shown below.

You must filter the data on the SQL server before it is returned to the application server.
You need to return books checked out more recently than the entered date.
Which code segment should you use?
A)

B)

C)

D)

- AOption A
- BOption B
- COption C
- DOption D
Correct Answer:
D
IQueryable should be used when we want to filter the data.
D
IQueryable should be used when we want to filter the data.
send
light_mode
delete
Question #25
HOTSPOT -
You are developing a web application that will store data in an Azure SQL Database.
The application will contain three classes named Vehicle, Car, and SportsCar. Car will inherit the Vehicle class. SportsCar will inherit the Car class.
You plan to create the table structure for the three classes by using mapping strategies in the Entity Framework.
You need to identify how many tables will be created by each mapping strategy.
How many tables should you identify? To answer, select the appropriate options in the answer area.
Hot Area:

You are developing a web application that will store data in an Azure SQL Database.
The application will contain three classes named Vehicle, Car, and SportsCar. Car will inherit the Vehicle class. SportsCar will inherit the Car class.
You plan to create the table structure for the three classes by using mapping strategies in the Entity Framework.
You need to identify how many tables will be created by each mapping strategy.
How many tables should you identify? To answer, select the appropriate options in the answer area.
Hot Area:

Correct Answer:
Box 1: Table-per-type: 3 -
Table per Type is about representing inheritance relationships as relational foreign key associations. Every class/subclass that declares persistent properties"" including abstract classes""has its own table. The table for subclasses contains columns only for each noninherited property (each property declared by the subclass itself) along with a primary key that is also a foreign key of the base class table. This approach is shown in the following figure:

Box 2: Table-per-hierarchy: 1 -
Table-per-hierarchy (TPH) inheritance uses one database table to maintain data for all of the entity types in an inheritance hierarchy.
Box 3: Table-per-concrete class: 2
In Table per Concrete type (aka Table per Concrete class) we use exactly one table for each (nonabstract) class.
Vehicle is an abstract class, while car and sportscar and nonabstract classes.
References:
https://weblogs.asp.net/manavi/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-1-table-per-hierarchy-tph https://msdn.microsoft.com/en-us/library/jj618292(v=vs.113).aspx

Box 1: Table-per-type: 3 -
Table per Type is about representing inheritance relationships as relational foreign key associations. Every class/subclass that declares persistent properties"" including abstract classes""has its own table. The table for subclasses contains columns only for each noninherited property (each property declared by the subclass itself) along with a primary key that is also a foreign key of the base class table. This approach is shown in the following figure:

Box 2: Table-per-hierarchy: 1 -
Table-per-hierarchy (TPH) inheritance uses one database table to maintain data for all of the entity types in an inheritance hierarchy.
Box 3: Table-per-concrete class: 2
In Table per Concrete type (aka Table per Concrete class) we use exactly one table for each (nonabstract) class.
Vehicle is an abstract class, while car and sportscar and nonabstract classes.
References:
https://weblogs.asp.net/manavi/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-1-table-per-hierarchy-tph https://msdn.microsoft.com/en-us/library/jj618292(v=vs.113).aspx
send
light_mode
delete
All Pages