Paper 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 26

Q.

1]

Which of the following Service Broker objects defines the content of the messages exchanged
between applications?

A.Contract

B.Message Type

C.Service

D.Queues

Q.2]

Jack is database developer in DoITnow, Inc,. He needs to store the details of one of the tables into an
XML file. What should he do?

A.He should create a managed user-defined type

B.He should create a managed stored procedure

C.He should create a managed trigger

D.He should use T-SQL

Q.3]
John is creating a Web Service in SQL Server 2005. He wants that the name of the function, he needs
to host, should be”Calculate”. Which of the parameter of the CREATE ENDPOINT statement will
John use to accomplish this?

A.Webmethod

B.Schema

C.Path

D.Ports

Q.4]

James, a database developer of AdventureWorks has implemented Service Broker in the database.
He needs to send a message from one of the service to another. Which of the following protocol will
James use for that?

A.HTTP

B.SOAP

C.DIALOG

D.TCP

Q.5]

John is the database developer for AdventureWorks. He has been asked to implement Service
Broker in the database. Which of the following database objects will John not create to implement
Service Broker?
A.MESSAGE TYPE

B.QUEUE

C.SERVICE

D.ASSEMBLY

Q.6]

In which of the following situations will you implement managed code in your database?

A.When you need to perform data access and manipulation operations that can be done using T-
SQL statements.

B.When you need to create database objects, such as procedures, functions, or triggers.

C.When you need to implement complicated programming logic for which you can reuse the
functionality provided by the .NET base class libraries.

D.When you need to implement basic programming logic.

Q.7]

The production database of an organization stores the details of raw material used for the
production process in the Materials table. These details include the ProductID, Description, Unit,
QuantityOnHand, and ReorderLevel. It also stores the requests to be made for purchase of the raw
material in the PurchaseRequests table. In addition, the MaterialIssued table stores the details of
issue of raw material for production. According to the business requirement, whenever, a product is
issued for production, a record is added to the MaterialIssued table. At the same time, the
QuantityOnHand needs to be checked. If the QuantityOnHand reaches the ReorderLevel or below
that, a record should be inserted into the PurchaseRequests table.

James, a database developer, has created a stored procedure that needs to be executed whenever a
new record is inserted in the MaterialIssued table. In this procedure, the QuantityOnHand is
checked for the product that is issued and a record is inserted in the PurchaseRequests table.
However, he has identified that creating a procedure does not ensure that a request will be created
every time a material is issued. What should James do?

A.Create an AFTER INSERT trigger on the MaterialIssued table

B. Create a FOR INSERT trigger on the PurchaseRequests table

C.Create a FOR INSERT trigger on the PurchaseRequests table

D.Create a FOR INSERT trigger on the MaterialIssued table

Q.8]

The production database of an organization stores the details of raw material used for the
production process in the Materials table. These details include the ProductID, Description, Unit,
QuantityOnHand, and ReorderLevel. It also stores the requests to be made for purchase of the raw
material in the PurchaseRequests table. In addition, the MaterialIssued table stores the details of
issue of raw material for production. According to the business requirement, whenever, a product is
issued for production, a record is added to the MaterialIssued table. At the same time, the
QuantityOnHand needs to be checked. If the QuantityOnHand reaches the ReorderLevel or below
that, a record should be inserted into the PurchaseRequests table.

James, a database developer, has created a batch of statements that inserts a record in the
MaterialIssued table. Next, it checks the QuantityOnHand for the product that is issued and then
inserts a record in the PurchaseRequests table, if required. However, he has identified that at times
a purchase request is not created even if the QuantityOnHand reaches below the ReorderLevel.
What should James do to solve this problem in an efficient way?
A.Create a procedure that contains all the statements given in the batch

B. Create an AFTER trigger that contains all the statements given in the batch

C.Create a transaction that contains all the statements given in the batch

D.Create a function that contains all the statements given in the batch

Q.9]

A university uses the StudentsRegistration application to store and manage the student details.
When a new student takes admission, the users enter the details of that student in a form. When the
form is submitted, the details are stored in four different tables.

You have created a batch of statements to perform data manipulation operations in all the tables
that store the student details. You have identified that for some of the students records are not
saved in all the tables. What should you do to solve this problem in an efficient way?

A.Create a procedure that contains all the statements given in the batch

B.Create an AFTER trigger for each statement to execute the next statement

C.Create a transaction that contains all the statements given in the batch

D.Create a function that contains all the statements given in the batch

Q.10]

A trgInsert trigger was created on HumanResources.Employee table. This trigger is no longer


required. So, the following statement was executed to
delete the trigger:

DROP TRIGGER trgInsert

The above statement generates an error. Identify the error and provide the solution.

A. DELETE TRIGGER trgInsert

B. DROP TRIGGER Employee.trgInsert

C. DELETE TRIGGER Employee.trgInsert

D. DROP TRIGGER HumanResources.trgInsert

Q.11]

Two AFTER triggers have been created for the DELETE operation on the Employee table as follows:

CREATE TRIGGER trgDelete1 ON HumanResources.Employee

AFTER

DELETE

AS

PRINT 'This is the first trigger'

CREATE TRIGGER trgDelete2 ON HumanResources.Employee

AFTER

DELETE
AS

PRINT 'This is the second trigger'

trgDelete1 is the first one to be created. You want to change the execution order of the above two
triggers so that trgDelete1 is executed after

the trgDelete2 trigger. For this, the following statement was

executed:

sp_settriggerorder 'trgDelete2', 'FIRST', 'DELETE'

However, the above statement results in an error. Identify the error and provide the solution.

A. sp_settriggerorder 'HumanResources.trgDelete2', 'FIRST', 'DELETE'

B. sp_settriggerorder 'trgDelete1', 'SECOND', 'DELETE'

C. sp_settriggerorder 'trgDelete2', 'SECOND', 'DELETE'

D. sp_settriggerorder 'HumanResources.trgDelete1', 'FIRST', 'DELETE'

Q.12]

You have created a stored procedure named prcDisplayEmpDetails in the AdventureWorks


database. This procedure displays the Employee Id, and

Login Id of all the employees. Now, you are also required to display the Manager id and title of the
employees along with the existing employee details.

What will you do to implement this in the existing stored procedure?


A. Delete the prcDisplayEmpDetails stored procedure and create a new one.

B. Create another procedure displaying the employee id, login id, manager id and title of all the
employees.

C. Alter the prcDisplayEmpDetails stored procedure to display the employee id, login id, manager id
and title of all the employees.

D. Create another procedure displaying the manager id and title of all the employees and call this
procedure from the prcDisplayEmpDetails stored procedure.

Q.13]

You have created the function, fx_Employee that accepts an employee id as a parameter and returns
the details of the department and shift for that employee?

CREATE FUNCTION fx_Employee( @EmployeeID int )

RETURNS table

AS

RETURN (

SELECT *

FROM HumanResources.EmployeeDepartmentHistory

WHERE EmployeeID = @EmployeeID

How will you execute the above function to display the details of the employee having 1 as
EmployeeID?

A. EXECUTE fx_Employee(1)
B. EXECUTE FUNCTION fx_Employee(1)

C. SELECT * FROM fx_Employee(1)

D. SELECT fx_Employee(1)

Q.14]

You need to display a report containing the employee ids of all the employees who work with a
specific manager. How will you implement this?

A. CREATE PROCEDURE prcEmpDetails @ManagerID int

AS

BEGIN

SELECT EmployeeID FROM HumanResources.Employee

WHERE ManagerID = @ManagerID

END

B. CREATE PROCEDURE prcEmpDetails @EmployeeID int

AS

BEGIN

SELECT EmployeeID FROM HumanResources.Employee

WHERE EmployeeID = @EmployeeID

END

C. CREATE PROCEDURE prcEmpDetails

AS

BEGIN

SELECT EmployeeID FROM HumanResources.Employee


END

D. CREATE PROCEDURE prcEmpDetails @ManagerID

AS

BEGIN

SELECT EmployeeID FROM HumanResources.Employee

WHERE ManagerID = @EmployeeID

END

Q.15]

After creating a full-text index on the Description column of the Production.ProductDescription


table, the following query was executed to search for the products containing the word 'bike' in
their description:

SELECT Description FROM Production.ProductDescription

WHERE FREETEXT (Description, bike)

However, the above statement generates an error. Identify and determine which of the following
statement will display the desired output?

A. SELECT Description FROM Production.ProductDescription

WHERE FREETEXT (Description, 'bike')


B. SELECT Description FROM ProductDescription

WHERE FREETEXT (Description, 'bike')

C. SELECT Description FROM Production.ProductDescription

WHERE FREETEXT (Description_bike)

D. SELECT Description FROM Production.ProductDescription

WHERE FREETEXT (Description) = 'bike'

Q.16]

A view displaying the employee id, department id, login id and title of all the employees has been
defined as follows:

CREATE VIEW vwEmpDep

AS

SELECT e.EmployeeID, DepartmentID, LoginID, Title

FROM HumanResources.Employee e

JOIN HumanResources.EmployeeDepartmentHistory d

ON e.EmployeeID = d.EmployeeID

The following update statement when executed generates an error.


UPDATE vwEmpDep

SET DepartmentID = 7, Title = 'Engineering Manager'

WHERE EmployeeID = 2

Identify the cause of error in the above statement?

A. You cannot modify the data in two or more underlying tables through a view.

B. DepartmentID of the Employee cannot be updated.

C. You cannot update the data in the table through views.

D. There is a syntax error in the above UPDATE statement.

Q.17]

Which of the following database does not contains any user data or user metadata?

A.master database

B.model database

C.msdb database

D.Resources database

Q.18]
Which of the following Service Broker objects specifies the type of messages that will be exchanged
during a conversation?

A.Contract

B.Message Type

C.Service

D.Queues

Q.19]

Which of the following services allows you to gather data from various disparate sources and
collate at a single location?

A.Database Engine

B.Reporting Services

C.Analysis Services

D.Integration Services

Q.20]

Which of the following types of commands are used to allow the users access to use database
resources?
A.DCL

B.DDL

C.DML

D.DQL

Q.21]

Sam, a database developer needs to provide access to the data using Web services. Which of the
following feature will you implement in the database to achieve this?

A.By implementing HTTP Endpoints

B.By implementing CLR Integration

C.By implementing Service Broker

D.By implementing High Availability

Q.22]

Which index organizes data logically but does not store data physically?

A. NONCLUSTERED

B. CLUSTERED

C. UNIQUE

D. MULTI COLUMN
Q.23]

Consider the following statements:

Statement A: Clustered indexes should be built on an attribute whose values are unique and do not
change often.

Statement B: Data is physically sorted in a clustered index.

Which of the following option is true with respect to above statements?

A.Both, Statement A and Statement B, are True

B.Statement A is True and Statement B is False

C.Statement A is False and Statement B is True

D.Both, Statement A and Statement B, are False

Q.24]

Consider the following statements:

Statement A: The data of a view can be modified even if the modification affects more than one
underlying table.

Statement B: The user of a view cannot change a column that is the result of a calculation.
Which of the following option is true with respect to above statements?

A.Both, Statement A and Statement B, are True.

B.Statement A is True and Statement B is False.

C.Statement A is False and Statement B is True.

D.Both, Statement A and Statement B, are False.

Q.25]

The Employee table of an organisation contains a large amount of data. The first name of each
employee and their designation are required to create a report. However, it takes a long time to
execute the following query:

SELECT firstname, designation FROM Employee JOIN Department ON


Employee.EmpID=Department.EmpID

The Department table has a primary key defined on the Department ID column. Suggest the best
solution for faster data retrieval.

A. Create a non clustered index on EmpID field of the Department table and the Employee table.

B. Create a clustered index on EmpID field of the Employee table and a non clustered index on
EmpID field of the Department table.

C. Create a non clustered index on EmpID field of the Employee table and clustered index on EmpID
field of the Department table.

D. Create a clustered index on EmpID field of the Department table and the Employee table.
Q.26]

You are the database developer for Lucerne Publishing. You are designing a human resources
database that contains tables as Employee and Salary. On analyzing the past transactions, you have
noticed that the Employee table is often joined with the Salary table on the EmployeeID column.
Individual records in the Employee table are selected by social security number (SSN). An employee
list, in alphabetical order of last name and first name, is required on a routing basis.

You need to design the indexes for the tables while optimizing the performance of the indexes.
Which of the following syntax should you use?

A.CREATE CLUSTERED INDEX IX_EmployeeName ON dbo.Employee (LastName, FirstName)

B. CREATE CLUSTERED INDEX IX_EmployeeSSN ON dbo.Employee (SSN)

C. CREATE INDEX IX_EmployeeFirstName ON dbo.Employee [First Name]

CREATE INDEX IX_EmployeeLastName ON dbo.Employee [Last Name]

D.CREATE CLUSTERED INDEX IX_EmployeeEmployeeID ON dbo.Employee (EmployeeID)

Q.27]

Triggers can be used to ensure and enforce _________________.

A. the security of data.

B. the business rules.

C.the security of data and the business rules.


D. business rules and data integrity.

Q.28]

Which magic table is used to store the updated rows, whenever an update trigger is fired?

A.Deleted table

B.Syscomments table

C.Sysobjects table

D.Inserted table

Q.29]

When a trigger is fired in response to the INSERT statement, how many magic tables are created?

A.One

B.Two

C.Three

D.Four
Q.30]

A trigger is a _____________.

A.Set of T-SQL statements

B. stored procedure

C. function

D. transaction

Q.31]

Which of the following feature of CLR provides the ability of an application to interact with another
application written in a different programming language?

A.Security Management

B.Standard Type System

C.Language Interoperability

D.Platform Independence

Q.32]

John needs to look for similar words or phrases in the database. Which of the following feature of
SQL Server 2005 will John use to accomplish it?
A.Full-text search

B.Service Broker

C.Replication

D.Notification Services

Q.33]

Consider the following statements:

Statement A: Triggers fired in response to the DML statements, refer to two magic tables, Inserted
and Deleted..

Statement B: The magic tables are physical tables with structure different from the table on which
the trigger is defined.

Which of the following option is true with respect to the above statements?

A.Both, Statement A and Statement B, are True.

B.Statement A is True and Statement B is False.

C.Statement A is False and Statement B is True.

D.Both, Statement A and Statement B, are False.


Q.34]

Consider the following Statements:

Statement A: By default, SQL Server scans for the sessions that are waiting for a lock request in
order to detect the deadlock situation.

Statement B: SQL Server provides the SET DEADLOCK_PRIORITY command to customize


deadlocking.

Which of the following option is true with respect to the above statements?

A.Both, Statement A and Statement B, are True

B.Statement A is True and Statement B is False.

C.Statement A is False and Statement B is True.

D.Both, Statement A and Statement B, are False.

Q.35]

Consider the following statements:

Statement A: The Shared(S) Lock mode is used for the operations that change or update the data.

Statement B: The Exclusive(X) Lock mode ensures that multiple updates can not be made to the
same resources at the same time.
Which of the following option is true with respect to above statements?

A.Both, Statement A and Statement B, are True.

B.Statement A is True and Statement B is False.

C.Statement A is False and Statement B is True.

D.Both, Statement A and Statement B, are False.

Q.36]

You are developing an application to manage the records of the Employees table, which has a
column named temp_emp. When the data in this column is no longer required, then the data is
remove it and a message is displayed as 'You have removed it successfully'.

Which method will you incorporate in your application to accomplish this requirement?

A.Create Trigger trgDeletetemp_emp ON Employees

AFTER

UPDATE

AS

Print ‘You have removed it successfully’

B.Create Trigger trgAltertemp_emp ON Employees

AFTER

DROP

AS
Print { You have removed it successfully}

C. Create Trigger trgDeletetemp_emp ON Employees

AFTER

Alter

AS

Print 'You have removed it successfully'

D.Create Trigger trgDeletetemp_emp ON Employees

AFTER

DELETE

AS

Print ‘You have removed it successfully’

Q.37]

Consider the following statement:

CREATE TRIGGER trgDeleteProject

ON Project

FOR DELETE

AS

DELETE ProjectManager

FROM ProjectManager t JOIN Deleted d

ON t.Project_ID = d.Project_ID

What will be the output of this query?


A.A trigger named trgDeleteProject is created on the Project table and all the corresponding records
in the ProjectManager table are deleted whenever a row is deleted from the Projects table.

B.A trigger named trgDeleteProject is created on the ProjectManager table and all the
corresponding records in the ProjectManager table are deleted whenever a row is deleted from the
ProjectManager table.

C.A trigger named trgDeleteProject is created on the Project table and all the corresponding records
in the Project table are deleted whenever a row is deleted from the ProjectManager table.

D.The query will result in an error.

Q.38]

You are a database developer in Inpro, Inc. You have created a procedure in which you are creating
a a table to store some values that need to be processed during the execution of the procedure.
Before the end of execution of that procedure, the table is dropped. You want to monitor when the
table is created and dropped. For this, you have created the Audit table in which you insert a row
whenever the table is created or dropped.

What is the best way to do this?

A. Create an INSERT trigger that will insert rows in the Audit table whenever the table is created
and dropped.

B. Create an DDL trigger that will insert rows in the Audit table whenever the table is created and
dropped.

C.Create an DELETE trigger that will insert rows in the Audit table whenever the table is created
and dropped.

D.Create an INSERT trigger that will insert rows in the Audit table whenever the table is created
and a DELETE trigger whenever the table is dropped.
Q.39]

You are developing an application for RedSky Inc., which is in the process of expansion. The
application should display the formatted report of the status of positions available in the company.
You are required to create a procedure named prcGetPos that will return the position description
and the position requirement for a specific code passed as Pcode.

The Position table has iBudgetStrength column containing the details of budgeted strength for the
position and iCurrentStrength column containing the current strength of the manpower for the
required position.

Which of the following option is the correct way to assign value to the parameters, if the declaration
of the parameters is as follows:

CREATE PROCEDURE prcGetPos

@Pcd char(4),@Description char(20) OUTPUT, @RD int OUTPUT AS

A.SELECT @Description = vDescription,

@RD = iBudgetedStrength - iCurrentStrength

FROM Position

WHERE cPositionCode = @Pcd

B. SELECT vDescription=@Description,

iBudgetedStrength - iCurrentStrength=@RD

FROM Position

WHERE cPositionCode = @Pcd

C.SELECT Description = vDescription,

RD = iBudgetedStrength - iCurrentStrength

FROM Position
WHERE cPositionCode = Pcd

D.SELECT @Description as vDescription,

@RD as iBudgetedStrength - iCurrentStrength

FROM Position

WHERE cPositionCode = @Pcd

Q.40]

Smith is working as a database programmer in Horizon Corporation. He has been assigned a task to
create a query that will give the output of the procedure named prcDisplayEmployee if the
procedure exists. He has executed the following queries:

sp_helptext prcDisplayEmployee

select * from prcDisplayEmployee

However, the queries doesnot display the output. Which of the following query should be used by
him to accomplish the task?

A.sp_helpdb prcDisplayEmployee

exec prcDisplayEmployee

B.sp_helpdb prcDisplayEmployee

output prcDisplayEmployee

C.sp_helptext prcDisplayEmployee

exec prcDisplayEmployee

D.sp_helptext prcDisplayEmployee

show prcDisplayEmployee

You might also like