70 461 PDF
70 461 PDF
70 461 PDF
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database named ProductsDB. The relevant part of the ProductsDB is shown in the following
database diagram:
You need to write a Transact-SQL query that display a single row in the following XML format:
A.
SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS [InStock],
CompanyName AS [Supplier], ContactName AS [Contact], Phone
FROM Products
B.
SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS [InStock],
CompanyName AS [Supplier], ContactName AS [Contact], Phone
FROM Products
FOR XML
C.
SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS [InStock],
CompanyName AS [Supplier], ContactName AS [Contact], Phone
D.
SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS [InStock],
CompanyName AS [Supplier], ContactName AS [Contact], Phone
FROM Products
Answer: A
Explanation:
QUESTION NO: 2
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB. The SalesDB is shown in the following database diagram:
A.
SELECT in.InvoiceID, in.InvoiceDate AS [Date], in.InvoiceValue AS [Value], cu.CustomerName
AS [Name], cu.CustomerCity AS [ShippedTo] FROM Invoices AS in
B.
SELECT InvoiceID, InvoiceDate AS [Date], InvoiceValue AS [Value], CustomerName AS [Name],
CustomerCity AS [ShippedTo] FROM Invoices
FOR XML
C.
SELECT Invoices.InvoiceID, Invoices.InvoiceDate AS [Date], Invoices.InvoiceValue AS [Value],
Customers.CustomerName AS [Name], Customers.CustomerCity AS [ShippedTo] FROM Invoices
D.
SELECT InvoiceID, InvoiceDate AS [Date], InvoiceValue AS [Value], CustomerName AS [Name],
CustomerCity AS [ShippedTo] FROM Invoices
Answer: A
QUESTION NO: 3
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database named ProductsDB. The ProductsDB database is shown in the following database
diagram:
You need to write a Transact-SQL query that displays all the products received by a single
supplier in the following XML format:
</Suppliers>
A.
SELECT s.SupplierID, s.CompanyName AS [Company], s.ContactNumber, p.ProductID,
p.UnitPrice, p.UnitsInStock
FROM Suppliers AS s
WHERE s.SupplierID = 22
B.
SELECT s.SupplierID, s.CompanyName AS [Company], s.ContactNumber, p.ProductID,
p.UnitPrice, p.UnitsInStock
WHERE s.SupplierID = 22
FOR XML
C.
SELECT Suppliers.SupplierID, Suppliers.CompanyName AS [Company],
Suppliers.ContactNumber, Products.ProductID, Products.UnitPrice, Products.UnitsInStock
FROM Suppliers
WHERE Suppliers.SupplierID = 22
D.
SELECT Suppliers.SupplierID, Suppliers.CompanyName AS [Company],
Suppliers.ContactNumber, Products.ProductID, Products.UnitPrice, Products.UnitsInStock
FROM Suppliers
WHERE Suppliers.SupplierID = 22
Answer: D
Explanation:
You work as a SQL Server 2012 database developer at TestKing.com. You are developing a
query for a database driven Web application that allows visitors to vote for the cricket player of the
week. The number of votes is stored in a table named WeeklyVotes that has columns named
Week, PlayerName, Votes.
You need to write a Transact-SQL query that ranks the top 30 cricket players by the average votes
over the last 12 months. You want the top 10 cricket players to have a rank of 1, the next 10 to
have a rank of 2, and the last 10 to have a rank of 3.
Answer:
SELECT TOP 30 PlayerName,
FROM WeeklyVotes
GROUP BY PlayerName
QUESTION NO: 5
You work as a database developer at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB that has a table named WeeklySales. The WeeklySales table records
the sales amount for each of TestKing.com's 20 sales representitives.
You need to write a Transact-SQL query that ranks the sales representatives by the average sales
amount for the past year. You want the sales representatives with the same average sales amount
to have the same rank with the subsequent rank being skipped.
A.
The RANK( ) OVER function.
B.
The NTILE( ) OVER function
C.
The DENSE_RANK( ) OVER function
D.
The ROW_NUMBER( ) OVER function
E.
The FORMAT function.
Answer: A
Explanation:
Ref: http://msdn.microsoft.com/en-us/library/ms189798.aspx
QUESTION NO: 6
You work as a SQL Server 2012 database developer at TestKing.com. You are developing a
query for a database driven Web application that allows visitors to vote for the cricket player of the
week. The number of votes is stored in a table named WeeklyVotes that has columns named
Week, PlayerName, Votes.
You need to write a Transact-SQL query that returns the cricket player that received the most
votes for each week, as well as the number of votes they received.
A.
SELECT PlayerName, Votes
WHERE Rank = 1
B.
SELECT PlayerName, Votes
RANK() OVER (PARTITION BY Week ORDER BY Votes DESC) AS Rank FROM WeeklyVotes)
AS tmp
WHERE Rank = 1
C.
SELECT PlayerName, Votes
FROM WeeklyVotes
D.
SELECT PlayerName, Votes
FROM WeeklyVotes
Answer: B
Explanation:
QUESTION NO: 7
You work as a database developer at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB that has a table named Inventory.
The Inventory table has three columns named ProductID, InStore and InWarehouse. The
ProductID column is the primary key and is linked to the Products table. The InStore column
stores the quantity of a product that is held at TestKing.com's retail shop, while the InWarehouse
column stores the quantity of a product that is held at TestKing.com's warehouse.
You need to add a computed column that stores the total number of a product that TestKing.com
has.
A.
ALTER TABLE Inventory
B.
ALTER TABLE Inventory
C.
ALTER TABLE Inventory
D.
DROP TABLE Inventory
GO
Answer: A
Explanation:
Ref: http://www.kodyaz.com/articles/sql-server-computed-column-calculated-column-sample.aspx
QUESTION NO: 8
TestKing.com has a SQL Server 2012 database instance that hosts a database named ComDB.
The ComDB database has a table named Partners that was created using the following Transact-
SQL code:
[CompanyID] ASC
ON PRIMARY
You want to create a FOR UPDATE trigger that will track changes to the ContactName and Phone
columns.
Which of the following statements should you use in the trigger definition?
A.
IF COLUMNS_UPDATED (ContactName, Phone)
B.
IF COLUMNS_UPDATED (ContactName) OR COLUMNS_UPDATED (Phone)
C.
IF UPDATED (ContactName, Phone).
D.
IF UPDATED (ContactName) OR UPDATED (Phone)
Answer: D
Explanation:
QUESTION NO: 9
You are the database administrator of a SQL Server 2012 database infrastructure at
TestKing.com.
You need to optimize a very large database table that contains several million rows of data by
designing a view based on the table. The view must allow users to perform aggregations on
several columns.
A.
You should create the view as an indexed view.
B.
You should create a clustered index on the view.
C.
You should make use of a stored procedure to return that data.
D.
"Pass Any Exam. Any Time." - www.actualtests.com 11
Microsoft 70-461 Exam
You should make use of a table-valued function.
Answer: A
Explanation:
QUESTION NO: 10
You are the database developer at TestKing.com. TestKing.com has a SQL Server 2012 database
infrastructure that has a database named ComDB with a table named Partners.
The Partners table was created using the following Transact-SQL code:
You develop a new table named Events using the following Transact-SQL code:
A.
You should add a Foreign Key Constraint on the Events table.
B.
You should add a Check Constraint on the Events table.
C.
You should add a Unique Constraint on the Events table.
D.
You should specify Events.CompanyID as a spars column.
E.
You should change the Events table to a partitioned table.
Answer: A
Explanation:
Ref: http://msdn.microsoft.com/en-us/library/ms179610.aspx
QUESTION NO: 11
TestKing.com has a SQL Server 2012 database infrastructure that has a database named
ComDB.
AS
FROM CommList
FROM CommList
GO
You want the view to be used to edit all columns except the CompanyID, CompanyName and
Location columns.
A.
You should consider implementing an AFTER UPDATE trigger.
B.
You should consider implementing an Index.
C.
You should consider implementing an INSTEAD OF UPDATE trigger.
D.
You should consider implementing a CHECK constraint.
Answer: C
Explanation:
QUESTION NO: 12
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB. The SalesDB database is shown in the following database diagram:
You create a view on the SalesDB using the following Transact-SQL code:
WITH SCHEMABINDINGS
AS
OrderDetail.ProductID = Products.ProducID
OrderDetail.InvoiceID = Invoices.InvoiceID
GO
How should you alter this view to allow users to update data through the SalesV?
A.
You should add a CHECK constraint to the SalesV view.
B.
You should add an INSTEAD OF trigger to the SalesV view.
D.
You should add an AFTER UPDATE trigger to the SalesV view.
E.
Create a columnstore index on all columns used in the SalesV view.
Answer: B
Explanation:
You are employed as a SQL Server 2012 database developer at TestKing.com. TestKing.com has
a SalesDB database with a view named SalesV. The SalesV view was created using the following
Transact-SQL code:
AS
FROM SalesDB.Orders;
You want to create an inline table-valued function named fn_testking that accepts a @ProductID
parameter of the integer data type. The inline table-valued function should also allow for sales
orders for each product to be listed by the latest sale.
Answer:
CREATE FUNCTION SalesDB.fn_testking ( @ProductID int )
RETURNS TABLE
AS
RETURN
(
"Pass Any Exam. Any Time." - www.actualtests.com 16
Microsoft 70-461 Exam
SELECT OrderID, ProductID, ShipDate, OrderDate, Amount
);
You are employed as a SQL Server 2012 database developer at TestKing.com. TestKing.com has
a database named SalesDB with tables named Customer and Orders. The Customer and Orders
tables were created using the following Transact-SQL code:
GO
GO
You must now create an OrderDetails table as shown in the following database diagram:
The TotalPrice column must be a computed column based on the product of the UnitPrice and
Quantity columns and the data must be stored in the table.
Answer:
CREATE TABLE SalesDB.OrderDetails
You work as a SQL Server 2012 database developer at TestKing.com. TestKing.com has a
database named SalesDB.
You are developing a stored procedure that takes a parameter named @date that uses the
varchar datatype. The @date parameter must be compared to the value in a datetime column
named OrderDate.
Which of the following WHERE clauses would be the most efficient WHERE clause to use?
A.
WHERE OrderDate = CAST(datetime,@date)
B.
WHERE OrderDate = CONVERT(datetime,@date)
C.
WHERE OrderDate =@date
D.
WHERE OrderDate = CAST(@date AS datetime)
E.
WHERE OrderDate = PARSE(@date AS Date)
Answer: C
Explanation:
QUESTION NO: 16
You work as a database developer at TestKing.com. You want to create a Transact-SQL query will
call a table-valued function for every row the query returns.
A.
You should make use of a UNION.
B.
You should make use of a CONVERT function.
C.
You should make use of an INNER JOIN.
"Pass Any Exam. Any Time." - www.actualtests.com 19
Microsoft 70-461 Exam
D.
You should make use of a Trigger.
E.
You should make use of a CAST function.
F.
You should make use of an OUTER JOIN.
G.
You should make use of a CROSS APPLY.
H.
You should make use of the FORMAT function.
Answer: G
Explanation:
QUESTION NO: 17
Which of the following datatypes has a fixed precision and a scale of six digits?
A.
Double
B.
Money
C.
Int
D.
Numeric
E.
SmallInt
F.
VarInt
G.
Float
Answer: D
QUESTION NO: 18
You work as a database developer at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB as illustrated in the following database diagram:
TestKing.com has retail stores in a few major cities across the country. The company wants a list
of Customers who live in a city that does not have a TestKing.com store, along with the customer's
City. The result set must be sorted alphabetically by City name.
Which of the following Transact-SQL statements would return the required information?
A.
SELECT CustomerName, CustomerCity
FROM Customers
ORDER BY CustomerCity
B.
SELECT CustomerName, CustomerCity
FROM Customers
FROM Customers
ORDER BY CustomerCity
D.
SELECT CustomerName, CustomerCity
FROM Customers
ORDER BY StoreCity
Answer: C
Explanation:
QUESTION NO: 19
You work as a database developer at TestKing.com. TestKing.com has a SQL Server 2012
database infrastructure with several databases. You have permissions on two of these databases,
namely, CommDB and SalesDB.
You need to develop a stored procedure named dbo.tk_addEntry in a database named AssetsDB.
The dbo.tk_addEntry stored procedure will run stored procedures in CommDB and SalesDB.
How should you design the stored procedure so that callers that do not paver permissions on
CommDB and SalesDB can run the dbo.tk_addEntry stored procedure successfully?
A.
You should configure the stored procedure to call the xp_cmdshell extended stored procedure.
B.
You should configure the stored procedure to call the sp_configure system stored procedure.
C.
You should assign users permission to the stored procedure.
E.
You should include the EXECUTE AS OWNER clause when creating the stored procedure.
Answer: E
Explanation:
You are the database developer at TestKing.com. TestKing.com has a SQL Server 2012 database
infrastructure that has a database named ComDB with tables named Partners and Events. These
tables were created using the following Transact-SQL code:
)
"Pass Any Exam. Any Time." - www.actualtests.com 23
Microsoft 70-461 Exam
You add a foreign key relationship between the two tables on the CompanyID column.
You need to develop a stored procedure named sp_coEvents that retrieves CompanyName for all
partners and the EventDate for all events that they have coordinated.
Answer:
A
AS
Partners.CompanyID = Events.CompanyID
QUESTION NO: 21
You work as a database developer at TestKing.com. TestKing.com has a SQL Server 2012
database infrastructure with a very large database named SalesDB. You create a new table
named SalesHistory that will hold historical data from the SalesDB database.
You need to perform a batch update from the SalesDB database to the SalesHistory table. You
want the status information from the batch process to be logged to a SQL Server table that must
be created by the batch process.
A.
You should make use of the FORMAT function.
B.
You should make use of the CONVERT function.
C.
You should make use of a scalar user-defined function.
D.
You should make use of an inline function.
F.
You should make use of a stored procedure.
Answer: C
Explanation:
QUESTION NO: 22
You are developing a SQL Server 2012 database for TestKing.com. You need to create a
computed column that returns the data by referencing another table using an INNER JOIN.
A.
You should make use of the FORMAT function.
B.
You should make use of a scalar user-defined function.
C.
You should make use of an inline function.
D.
You should make use of a table-valued user-defined function.
E.
You should make use of a stored procedure.
Answer: C
Explanation:
QUESTION NO: 23
Which of the following statements regarding SQL Server 2012 objects is TRUE?
A.
A user-defined data type can accept an input variable and return a table of results but cannot be
B.
A scalar function can accept an input variable and return a table of results but cannot be used
within a view.
C.
A table-valued function can accept an input variable and return a table of results but cannot be
used within a view.
D.
A table-valued type can accept an input variable and return a table of results but cannot be used
within a view.
Answer: C
Explanation:
QUESTION NO: 24
You work as a SQL Server 2012 database developer at TestKing.com. TestKig.com has a
database named DataDB.
You are developing a complex stored procedure named sp_updater that will use a single
transaction to update several tables in the DataDB database.
You are concerned about data integrity and incomplete updates should the sp_updater stored
procedure cause a run-time error.
To mitigate this potential problem you want the transaction to terminate and the transaction to be
rolled back if the sp_updater stored procedure raises a run-time error.
A.
You should make use of the SET XACT_ABORT ON statement in the stored procedure.
B.
You should have the stored procedure run in the SERIALIZABLE ISOLATION LEVEL.
C.
"Pass Any Exam. Any Time." - www.actualtests.com 26
Microsoft 70-461 Exam
You should make use of a LOOP hint in the stored procedure.
D.
You should have the stored procedure run in the SNAPSHOT ISOLATION LEVEL.
E.
You should make use of an INSTEAD OF UPDATE trigger in the stored procedure.
Answer: A
Explanation:
Ref: http://msdn.microsoft.com/en-us/library/ms188792
QUESTION NO: 25
Testking.com has a database SalesDB with a large Orders table. You create a heap named
OldData that will store historical data from the Orders table.
You need to write a Transact-SQL query that will insert rows of data from the Orders table that are
marked as closed and are more than six months old.
Which of the following table hints should you use in your query if you want to optimize transaction
logging and locking for the query?
A.
You should make use of the READPAST hint.
B.
You should make use of the HOLDLOCK hint.
C.
You should make use of the READCOMMITTED hint.
D.
You should make use of the NOLOCK hint.
E.
You should make use of the TABLOCK hint.
F.
You should make use of the UPDLOCK hint.
QUESTION NO: 26
You are employed as a SQL Server 2012 database developer at TestKing.com. You have a stored
procedure that is executed quite often. The stored procedure joins data from two tables.
TestKing.com users report that the stored procedure takes a long time to execute. You analyze
the query plan and find that the stored procedure often makes use of table scans rather than
indexes when the estimated rows do not match the actual rows on one of the tables.
A.
You should make use of the KEEPIDENTITY table hint in the stored procedure.
B.
You should make use of the KEEPDEFAULTS table hint in the stored procedure.
C.
You should make use of the IGNORE_CONSTRAINTS table hint in the stored procedure.
D.
You should make use of the FORCESEEK table hint in the stored procedure.
E.
You should update statistics on the tables queried by the stored procedure.
Answer: D
Explanation:
QUESTION NO: 27
You work as a SQL Server 2012 database developer at TestKing.com. You are developing a
database driven Web application. The application executes a store procedure based on the
location of the web user.
The location of the Web user is determined by IP Geolocation. You want to develop a process that
A.
You should make use of a foreach SQLCLR statement.
B.
You should make use of a scalar user-defined function.
C.
You should make use of an inline function.
D.
You should make use of a cursor.
Answer: D
Explanation:
QUESTION NO: 28
You work as a SQL Server 2012 database administrator at TestKing.com. You have developing a
database named WebAnDB that will be used by a web site analysis application. The WebAnDB
database has a table named Visitors that stores date and time data in a column named Accessed.
You must now develop a stored procedure that will insert data into the Accessed column. You
want the stored procedure to store time zone data as well.
A.
You should make use of a scalar user-defined function.
B.
You should make use of the SET CONTEXT_INFO statement in the stored procedure.
C.
You should make use of the DATETIMEOFFSET data type.
D.
You should make use of the TODATETIMEOFFSET function.
E.
F.
You should make use of a cursor.
Answer: D
Explanation:
QUESTION NO: 29
You are developing a database that will be used by a Web application. The database will store
small multimedia files in several tables. The largest multimedia file is 975 kB. These multimedia
files will be retrieved quite often.
A.
You should make use of a cursor.
B.
You should make use of a row-level compression.
C.
You should make use of the FileStream data type.
D.
You should make use of the VARBINARY data type.
Answer: D
Explanation:
QUESTION NO: 30
You work as a database administrator at TestKing.com. You are developing a database that will
be used by a web site analysis application name TKWeb1.
The TKWeb1 application must display the date and time each visitor visits a page on a website as
well as the date and time they leave that web page. This data needs to be displayed in different
date and time formats.
A.
You should make use of a scalar user-defined function.
B.
You should make use of the SET CONTEXT_INFO statement in the stored procedure.
C.
You should make use of the DATETIMEOFFSET data type.
D.
You should make use of the FORMAT function.
E.
You should make use of the SET FORCEPLAN ON statement in the stored procedure.
F.
You should make use of a cursor.
Answer: D
Explanation:
QUESTION NO: 31
You work as a database developer at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB that has a table named Inventory.
The Inventory table has three columns named ProductID, InStore and InWarehouse. The
ProductID column is the primary key and is linked to the Products table. The InStore column
stores the quantity of a product that is held at TestKing.com's retail shop, while the InWarehouse
column stores the quantity of a product that is held at TestKing.com's warehouse.
You need to add a computed column that is the sum of values in the InStore and InWarehoue
columns for each product.
B.
ALTER TABLE Inventory
C.
ALTER TABLE Inventory
D.
DROP TABLE Inventory
GO
Answer: A
Explanation:
Ref: http://www.kodyaz.com/articles/sql-server-computed-column-calculated-column-sample.aspx
QUESTION NO: 32
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB. The SalesDB database is shown in the following database diagram:
You create a view on the SalesDB database using the following Transact-SQL code:
WITH SCHEMABINDINGS
AS
OrderDetail.ProductID = Products.ProducID
OrderDetail.InvoiceID = Invoices.InvoiceID
GO
You want the SalesV view to persist data to disk in order to improve performance.
A.
You should add a clustered index to the SalesV view.
C.
You should drop and recreate the SalesV view as a system view.
D.
You should drop and recreate the SalesV view as a partitioned view.
Answer: C
Explanation:
Ref: http://msdn.microsoft.com/en-us/library/ms190174
QUESTION NO: 33
You work as a database developer at TestKing.com. You need to store Microsoft Word documents
in a SQL Server 2012 database table.
The Word documents must not be accessed by Windows applications that do not use Transact-
SQL queries.
A.
You should store the documents using the VARBINARY(MAX) datatype.
B.
You should store the documents using the VARCHAR(MAX) datatype.
C.
You should store the documents using the FILESTREAM datatype.
D.
You should store the documents using the NVARCHAR(MAX) datatype.
Answer: A
Explanation:
QUESTION NO: 34
Application developers are developing several in-house applications that will access the Invoices
table. You need to develop a solution that will allow the applications to access the table indirectly
while still allowing them to update the Invoice table.
A.
You should create a view on the Invoices table.
B.
You should create a columnstore index on all columns used by the applications.
C.
You should allow the applications access to the Invoices table via stored procedures.
D.
You should drop and recreate the Invoices table as a partitioned table.
Answer: C
Explanation:
QUESTION NO: 35
Which of the following can be used to protect the code in a stored procedure?
A.
The ENCRYPBYKEY statement.
B.
The ENCRYPBYASYMKEY statement.
C.
The SET TRUSTWORTHY ON option.
D.
The SET XACT_ABORT ON statement.
E.
The ENCRYPTBYPASSPHRASE statement.
F.
The ENCRYPTBYCERT statement.
"Pass Any Exam. Any Time." - www.actualtests.com 35
Microsoft 70-461 Exam
G.
The SIGNBYASYMKEY statement.
H.
The CRYPT_GEN_RANDOM statement.
Answer: A
Explanation:
QUESTION NO: 36
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB. The SalesDB database is shown in the following database diagram:
You need to write a Transact-SQL query that displays all Customers, whether they have invoices
or not. The query must also display the InvoiceDate for a Customer that has an Invoice.
A.
You should make use of a UNION.
B.
You should make use of an INNER JOIN.
C.
"Pass Any Exam. Any Time." - www.actualtests.com 36
Microsoft 70-461 Exam
You should make use of a CROSS JOIN.
D.
You should make use of an OUTER JOIN.
E.
You should make use of a CROSS APPLY.
Answer: D
Explanation:
You are employed as a SQL Server 2012 database developer at TestKing.com. TestKing.com has
a database named HRDB with tables named Staff and SalaryHistory. The Staff and SalaryHistory
tables were created using the following Transact-SQL code:
GO
GO
You must write a Transact-SQL query to affect a salary increase of 6.5% for all staff members with
a JobTitle of Support Technician. Your query must also update the data in the SalaryHistory table.
Answer:
UPDATE Staff
QUESTION NO: 38
You work as a SQL Server 2012 database developer at TestKing.com. You are developing a
batch process that accepts an input parameter and allows the result set to be joined with a table.
A.
You should make use of a stored procedure to perform the batch process.
B.
You should make use of a table-valued user-defined function.
C.
You should make use of the SET XACT_ABORT ON statement.
"Pass Any Exam. Any Time." - www.actualtests.com 38
Microsoft 70-461 Exam
D.
You should make use of a scalar user-defined function.
E.
You should make use of a schema-bound user-defined function.
Answer: B
Explanation:
Ref: h http://msdn.microsoft.com/en-us/library/ms191007.aspx
QUESTION NO: 39
You want to write the Transact-SQL query that returns the number of items produced at each
location for each week. In addition, you want the result set to include a column named
PrevItemsProduced that holds the number of items produced at each location for the week before.
A.
SELECT Location, Week, ItemsProduced,
FROM Sites
B.
SELECT Location, Week, ItemsProduced,
"Pass Any Exam. Any Time." - www.actualtests.com 39
Microsoft 70-461 Exam
FIRST_VALUE(ItemsProduced) OVER (PARTITION BY Location ORDER BY Week) AS
PrevItemsProduced
FROM Sites
C.
SELECT Location, Week, ItemsProduced,
FROM Sites
D.
SELECT Location, Week, ItemsProduced,
FROM Sites
E.
SELECT Location, Week, ItemsProduced,
FROM Sites
Answer: C
Explanation:
QUESTION NO: 40
You work as a SQL Server 2012 database developer at TestKing.com. You are developing a
stored procedure for TestKing.com's e-Commerce application.
Your stored procedure must display unique values from one column in multiple columns in the
result set.
A.
You should make use of the OUTER APPLY operator.
B.
You should make use of a dynamic cursor.
D.
You should make use of the CROSS APPLY operator.
E.
You should make use of the UNPIVOT operator.
F.
You should make use of a keyset cursor.
Answer: C
Explanation:
QUESTION NO: 41
You work as a database developer at TestKing.com. TestKing.com has a SQL Server 2012
database named SalesDB as illustrated in the following database diagram:
TestKing.com has retail stores in a few major cities across the country. The company wants to
ascertain whether it would be advantageous to open a store in other cities based on feedback
from its customers.
You are required to provide the company's CEO with a list of Customers who live in a city that
does not have a TestKing.com store, along with the customer's Phone Number and the customer's
City, and arranged alphabetically by City name.
A.
SELECT CustomerName, CustomerCity, CustomerPhone
FROM Customers
ORDER BY CustomerCity
B.
SELECT CustomerName, CustomerCity, CustomerPhone
FROM Customers
ORDER BY StoreCity
C.
SELECT CustomerName, CustomerCity, CustomerPhone
FROM Customers
ORDER BY CustomerCity
D.
SELECT CustomerName, CustomerCity, CustomerPhone
FROM Customers
ORDER BY StoreCity
Answer: C
Explanation:
QUESTION NO: 42
You work as a database developer at TestKing.com. You are developing a SQL server 2012
database for TestKing.com's e-Commerce application. The application allows TestKing.com
employees from different regions to execute a store procedure based on their location.
A.
You should make use of a client cursor.
B.
You should make use of a static cursor.
C.
You should make use of a forward-only cursor.
D.
You should make use of a dynamic cursor.
E.
You should make use of a keyset cursor.
Answer: E
Explanation:
Ref: http://msdn.microsoft.com/en-us/library/ms191179.aspx
QUESTION NO: 43
You work as a SQL Server 2012 database developer at TestKing.com. TestKing.com has a large
database named SalesDB.
New rows are inserted into the tables in the SalesDB database and updates to existing rows occur
on a high frequency. The inserts and updates often blocked by queries retrieving and reading
data.
How would you prevent queries that retrieve and read data from blocking queries that insert and
update data?
A.
You should make use of the SERIALIZABLE ISOLATION LEVEL.
B.
C.
You should make use of the REPEATABLE READ ISOLATION LEVEL.
D.
You should make use of the READCOMMITTED ISOLATION LEVEL.
E.
You should make use of the READPAST ISOLATION LEVEL
Answer: A
Explanation:
Ref: http://msdn.microsoft.com/en-us/library/ms173763.aspx
QUESTION NO: 44
You work as a SQL Server 2012 database developer at TestKing.com. You are developing a
stored procedure that updates rows in several tables.
You want the entire transaction to be rolled back should the stored procedure cause a run-time
error.
A.
You should make use of the SET XACT_ABORT ON statement in the stored procedure.
B.
You should have the stored procedure run in the SERIALIZABLE ISOLATION LEVEL.
C.
You should make use of a LOOP hint in the stored procedure.
D.
You should have the stored procedure run in the SNAPSHOT ISOLATION LEVEL.
E.
You should make use of an INSTEAD OF UPDATE trigger in the stored procedure.
F.
You should make use of RAISERROR in the stored procedure.
Ref: http://msdn.microsoft.com/en-us/library/ms188792
QUESTION NO: 45
You work as a database developer at TestKing.com. TestKing has an in-house application named
TKApp3 that runs a Transact-SQL query against a SQL Server 2012 database named SalesDB.
TestKing.com users report that TKApp3 is functioning sluggishly. You discover that concurrent
updates are causing blockages on the SalesDB database.
How would you ensure that the query to use the original data when updates occur?
A.
You should have the query run in the REPEATABLE READ ISOLATION LEVEL.
B.
You should have the query run in the SERIALIZABLE ISOLATION LEVEL.
C.
You should have the query run in the READCOMMITTED ISOLATION LEVEL.
D.
You should have the query run in the SNAPSHOT ISOLATION LEVEL.
E.
You should have the query run in the READPAST ISOLATION LEVEL.
Answer: D
Explanation:
QUESTION NO: 46
You work as a database developer at TestKing.com. TestKing has an in-house application named
TKApp3 that runs a Transact-SQL query against a SQL Server 2012 database.
You want to run an execution plan against the query that will provide detailed information on
missing indexes.
A.
You should make use of the READPAST hint in the queries.
B.
You should make use of the READCOMMITTED hint in the queries.
C.
You should make use of the SET SHOWPLAN_XML ON statement in the query.
D.
You should make use of the SET STATISTICS XML ON statement in the query.
E.
You should make use of the SET XACT_ABORT OFF statement in the query.
F.
You should make use of the SET CONTEXT_INFO statement in the query.
Answer: C
Explanation:
QUESTION NO: 47
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database infrastructure that contains a database named SalesDB.
The SalesDB database is used by an in-house application named TKApp3. TestKing.com users
report that TKApp3 is functioning sluggishly.
You discover that application consumes considerable memory when it runs single-use dynamic
queries against the SalesDB database. You suspect that these queries are making excessive use
of procedure cache.
How would you reduce procedure cache if you cannot create new indexes on the SalesDB
database?
A.
You should replace the queries with recursive stored procedures.
B.
You should add make use of the INCLUDE clause in the index.
D.
You should make use of the READCOMMITTED hint in the queries.
E.
You should make use of the optimize for ad hoc workloads option.
Answer: E
Explanation:
QUESTION NO: 48
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database infrastructure that contains a database named TestKingDB.
The TestkingDB database is used by an in-house application named TKApp3 that queries a read-
only table with a clustered index. TestKing.com users report that TKApp3 is functioning sluggishly.
You suspect query the application uses is causing the problem. You analyze the query and
discover that column referenced in the WHERE clause is not part of the clustered index. You also
notice that the query returns five columns, as well as a COUNT (*) clause grouped on the five
columns.
A.
You should replace the query with recursive stored procedure.
B.
You should replace the COUNT (*) clause with a persisted computed column.
C.
You should create nonclustered indexes on all columns used in the query.
D.
You should create a filtered index on the column used in the WHERE clause.
E.
You should add an INCLUDE clause to the clustered index.
F.
You should create a columnstore index on all columns used in the query.
Answer: F
Explanation:
QUESTION NO: 49
You work as a database administrator at TestKing.com. TestKing.com has a SQL Server 2012
database named ProductsDB. The ProductsDB database is shown in the following database
diagram:
You need to write a Transact-SQL query that displays rows of data in the following XML format:
<Suppliers>
<CompanyName>Company Name</CompanyName>
<ContactName>Contact Name</ContactName>
<Products>
<ProductID>10</ProductID>
<ProductName>Product Name</ProductName>
<UnitPrice>559.00</UnitPrice>
<UnitsInStock>12</UnitsInStock>
</Products>
<Products>
<ProductID>132</ProductID>
<ProductName>Product Name</ProductName>
"Pass Any Exam. Any Time." - www.actualtests.com 48
Microsoft 70-461 Exam
<UnitPrice>59.00</UnitPrice>
<UnitsInStock>102</UnitsInStock>
</Products>
<Products>
<ProductID>259</ProductID>
<ProductName>Product Name</ProductName>
<UnitPrice>599.00</UnitPrice>
<UnitsInStock>6</UnitsInStock>
</Products>
</Suppliers>
A.
SELECT s.SupplierID, s.CompanyName, s.ContactName, s.Phone, p.ProductID, p.UnitPrice,
p.UnitsInStock
FROM Suppliers AS s
B.
SELECT s.SupplierID, s.CompanyName, s.ContactName, s.Phone, p.ProductID, p.UnitPrice,
p.UnitsInStock
FROM Suppliers AS s
FOR XML
C.
SELECT Suppliers.SupplierID, Suppliers.CompanyName, Suppliers.ContactName,
Suppliers.Phone, Products.ProductID, Products.UnitPrice, Products.UnitsInStock
FROM Suppliers
FROM Suppliers
Answer: A
Explanation:
QUESTION NO: 50
You work as a SQL Server 2012 database developer at TestKing.com. TestKing.com has a
database named SalesDB with tables named Customer and Orders. The Customer and Orders
tables were created using the following Transact-SQL code:
GO
GO
You are developing a stored procedure named OrdersByDate that returns the OrderID,
CustomerID, CustomerName and OrderDate. The stored procedure will take a parameter named
@date that uses the int datatype. The @date parameter will be used to filter the result set based
on the OrderDate column in the Orders table.
A.
CREATE PROCEDURE OrdersByDate
@date int
AS
B.
CREATE PROCEDURE OrdersByDate
@date int
AS
C.
CREATE PROCEDURE OrdersByDate
@date int
"Pass Any Exam. Any Time." - www.actualtests.com 51
Microsoft 70-461 Exam
AS
D.
CREATE PROCEDURE OrdersByDate
@date int
AS
Answer: C
Explanation: