You are on page 1of 9

Answer All Questions ( 55 M)

Q.1
Which one of the following keywords is used when a subquery returns a list of values and a column
value in the outer query needs to be matched with any of these values? ( 1 M)
o IN
o ANY
o EXIST
o ALL

Q.2
A table named Project has the attributes, EmpID, projectID , and HrsAllocated.The table stores the ID
of the employees and the projects they are working upon.It also stores the total number of working
hours allocated for each project.One employee can work on one or more than one project.In
addition ,a single project can have one or more than one employee. Identify the attributes that are
suitable candidates for the primary key. (2 M)
o ProjectID+HrsAllocated
o EmpID
o ProjectID
o EmpID+ProjectID
Q.3
Which one of the following characteristics of the database approach is used to display the data stored
in the database in a format that differs from its actual form of storage? (1 M)
o Self-describing nature of a database system
o Support of multiple views of data
o Sharing of data and multiuser transaction processing
o Insulation between programs and data, and data abstraction

Q.4
Which one of the following components is used to display links to relevant information while the users
working in the management studio environment? (1 M)
o Template Explorer
o Dynamic Help
o Solution Explorer
o Query Editor

Q.5
Steve has been assigned the task of creating Web-based reports based on the data that is stored in
the data warehouse.Also these reports should get published in different formats. Which one of the
following SQL Server components will enable Steve implement the desired task? (2 M)
o Integration Services
o Microsoft SQL Server Reporting Services
o Replication Services
o Analysis Services

Q.6
You can embed the .NET code in database objects such as stored procedure, function, or trigger.
What is such a database object know as? (1 M)
o Unmanaged database object
o Server object
o CLR object
o Managed database object

Q.7
Steve is working as a database developer with Global Software. He has been provided some crucial
data files.But these files are in different formats.Steve needs to gather the entire data that is available
in different formats and put in a common database in a consistent format.Which component of SQL
Server will help Steve to implement the desired functionality? (2 M)
o Database Engine
o Reporting
o Integration
o Master Data

Q.8
Which one of the following levels of database architecture describes the database entities and the
relationships among them while hiding the physical storage of data? (1 M)
o Conceptual Level
o External Level
o Physical Level
o Internal Level

Q.9
Consider two tables, A and B . You want to retrieve all the rows from the first table but only the
matching rows from the other table. Which of the following options should you use to perform the
preceding task? ( 2 M)
o Outer join
o Right outer join
o Left outer join
o Full outer join
Q.10
Consider the following Employees tables (3 M)
Emp_ID Emp_Salary
1 2000
2 4000
3 5000
4 5000
5 6000
6 6000
7 9000
8 9000
Write a query that displays the IDs and salaries of those employees who earn their salaries within the
top 3 Salaries among of the employees
o SELECT TOP(3) WITH TIES Emp_ID,Emp_Salary
FROM Employees
ORDER BY Emp_Salary DESC
o SELECT TOP(30) PERCENT WITH TIES Emp_ID,Emp_Salary
FROM Employees
Order by Emp_Salary
o SELECT TOP(3) Emp_ID,Emp_Salary
FROM Employees
Order by Emp_Salary
o SELECT Emp_ID
FROM Employees
Where Emp_ID in (Select TOP 3 Emp_ID From Employees)

Q.11
You are a database developer and you work on SQL Server .Your database architecture requires you
to implement the SPARSE column on the Product_Transaction table .Which one of the following T-
SQL statements execute successfully to create a table with the SPARSE column? ( 4 M )
o Create table Product_Transaction(
ID INT SPARSE NULL IDENTITY(1,1), Transaction_Date datetime, Product_ID INT, Quality
INT, Product_Type varchar(100), Product_Details varchar(max))
o Create table Product_Transaction(
ID INT IDENTITY(1,1), Transaction_Date datetime, Product_ID INT SPARSE NULL, Quality
INT, Product_Type varchar(100), Product_Details varchar(max))
o Create table Product_Transaction(
ID INT IDENTITY(1,1), Transaction_Date datetime, Product_ID INT, Quality INT,
Product_Type varchar(100), Product_Details varchar(max) FILESTREAM SPARSE)
o Create table Product_Transaction(
ID INT IDENTITY(1,1), Transaction_Date datetime, Product_ID INT SPARSE NOT NULL,
Quality INT, Product_Type varchar(100), Product_Details varchar(max))
Q.12
You are a database developer on an instance of SQL Server .You have a table named emp_details
with the following structure. ( 3M)
Create table emp_details ( emp_name varchar(100), emp_dept nvarchar(2) )

Emp_details contains the data as shown in the following table.


Emp_name Emp_dept
Angelica 1
Carolyn 0
Joes 0
Lazle 22
Stephenie 0
You execute the following query on the emp_details table
UPDATE emp_details SET emp_dept =” WHERE emp_dept=’0’
Predict the output when you execute the following query SELECT COUNT (*) FROM emp_details
WHERE emp _dept=0
o 3
o 0
o 5
o Query returns an error

Q.13
Which one of the following hints is used to control the locking mechanism of tables? ( 1 M)
o Hash Join hints
o Table hints
o Merge Join hints
o Query hints
Q.14
Working with indexes, you want to leave extra gaps and reserve a percentage of free space on each
leaf level page of the index to accommodate future expansion. Which one of the followings options
should be used while creating the index to accomplish this requirement? ( 2 M)
o PAD_INDEX
o SORT_IN_TEMPDB
o FILLFACTOR
o ONDEFAULT

Q.15
You are a databe developer on an instance of SQL Server .Your Sales database contains the
following SalesOrderDetail table. ( 3 M)
CREATE TABLE [SalesOrderDetail] ( [SalesOrderID] [int] NOT NULL, [SalesOrderDetailID] [int]
IDENTITY (1,1) NOT NULL,

[CarrierTrackingNumber] [nvarchar](25) NULL, [OrderQty] [smallint] NOT NULL, [ProductID] [int] NOT
NULL, [SpecialOfferID] [int] NOT NULL, [UnitPrice] [Money] NOT NULL, [UnitPriceDiscount] [Money]
NOT NULL, [LineTotal]AS ([(UnitPrice]*((1,0).[UnitPriceDiscount]))*[OrderQty](0,0))),
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL, [ModifiedDate] [datetime] NOT NULL )
The Sales OrderDetail table has a unique non clustered index on the SalesOrderDetailID named
PK_SlaesOrderID (===the following query === of the time and the client==that the query
performs................
SELECT * FROM sales .SalesOrderDetail WHERE UnitPrice > 10 AND UnitPrice < 200 AND
CarrierTrackingNumber = 491-403C-98
What should you do to improve the query performance
o Create a plan guide with FORCE SCAN option
o Use the BETWEEN operator instead of AND for the UnitPrice in the WHERE clause
o Create a nonclustered index on the Carrier Tracking Number
o Create a clustered index on the Carrier Tracking Number and Unit Price column

Q.16
You are a database developer. You plan to design a database solution by using SQL Server.A
database contains a table named Employee.The structure of the table is: (4 M)
Create table Employee (
Emp_ID int primary key,
Emp_Band varchar(2),
First_Name varchar(50),
Last_Name varchar(50) )
The table has the following indexes:
-A unique clustererd index on the PersonID column named PK_Employee_Emp_ID -A nonclustered
index on the First_Name and Last_Name columns named NCI_Employee_FirstName_LastName

-A nonclustered index on the Emp_Band column named NCI_Employee_Emp_Band that has


First_name and Last_Name as included columns. The table contains approximately 70,000,000
records.The approximate number of records for each Emp_Band is 30,000 . You execute the
following query.
Select E.First_Name , E.Last_Name
From Employy E
Where E.Emp_Band=’E5’
You need to ascertain that the indexes are used optimally. For this you plan to analyze the
performance of the query by using an execution plan. Which one of the following operations in the
query execution plan confirms the index is used optimally?
o Verify that a clustered index scan operation is performed on the PK_Employee_Emp_ID index.
o Verify that an index seek operation is performed on the NCI_Employee_Emp_Band index, and
a key lookup operation is performed on the PK_Employee_Emp_ID index.
o Verify that an index seek operation is performed on the NCI_Employee_Band index and an
index scan operation is performed on the NCI_Employee_FirstName_lastName index.
o Verify that an index seek operation is performed on the NCI_Employee_Emp_Band index.
Q.17
You are a database developer on an instance of SQL Server. Your production database is accessed
extensively by application users performing ad hoc queries. You identified that users always go for
products which have their status_id=1 in the product table. What should you do to improve the
performance of the query? ( 3 M)
o Create a non clustered index on product id column of the product table.
o Create a clustered index on product_id column having status_id column as included column
o Create unique clustered index on status_id column of the product table.
o Create a filtered index on status_id=1 with clustered index on product_id column.
Q.18
Which one of the following options is a precompiled object stored in the database? ( 1 M)
o Stored Procedure
o Batch
o Function
o Cursor
Q.19
Which function in SQL Server is used to implement dynamic SQL? ( 2 M)
o The Scalar function
o The EXEC() function
o The Multistatement Table-valued function
o The inline Table-valued function
Q.20
You are a database developer on an instance of SQL Server .Your database contain a table named
Employee_Details defined as shown in the following statement ( 3 M)
CREATE TABLE Employee_Details( Employee_ID int, Employee_Name varchar(100),
Employee_Gender varchar(6), Bonus_Point int, )
You opens a session and execute the following T-SQL statement SET TRANSACTION ISOLATION
LEVEL REPEATABLE READ BEGIN TRANSACTION SELECT * FROM Employee_Details You open
another session .Which one of the following statement in the second will execute successfully?
o DELETE FROM [dbo] [Employee_Details]
WHERE Employee_ID = 1;
o ALTER TABLE [dob][Employee_Details]
ADD Date_Of_Joining Datetime;
o UPDATE [dob][Employee_Details]
SET Employee_ID = 2 WHERE Employee_ID = 1;
o INSERT INTO [dob][Employee_Details]
([Employee_ID],[Employee_Name],[Employee_Gender],[Bonus_Point])
VALUES(3,’James’,’Male’,100)
Q.21
You are a database developer .You maintain the Production database their includes the
Employee_Details table defined as shown in the following statement ( 4 M)
CREATE TABLE Employee_Details( Employee_ID INT, Employee_Name varchar(100),
Employee_Gender varchar(6), Bonus_Point int, ) You want to create a user-defined scalar function to
return the Bonus_Point value for a specific employee . If the EmployeeID value passed to the function
is between 100 and 500, the function should return the actual Bonus_Point value . For other
employees,a Bonus_Point of zero should be returned . Which statement should you use to create
functions?
o CREATE FUNCTION dob ndf_get_bonus_point (@v_empid)
AS BEGIN DECLARE @v_bonuspt int, SELECT @v_bonuspt = Bonus_Point From
Employee_Details Where Employee_ID = @v_empid IF (@v_empid BETWEEN 100 AND 500)
RETURN @v_bonuspt ELSE RETURN 0 END
o CREATE FUNCTION dob ndf_get_bonus_point (@v_empid)
RETURNS int AS BEGIN DECLARE @v_bonuspt int, IF (@v_empid BETWEEN 100 AND
500) SELECT @v_bonuspt = Bonus_Point From Employee_Details Where Employee_ID =
@v_empid ELSESET @v_bonuspt = 0 END
o CREATE FUNCTION dob ndf_get_bonus_point (@v_empid)
RETURNS int AS BEGIN DECLARE @v_bonuspt int, SELECT @v_bonuspt = Bonus_Point
From Employee_Details Where Employee_ID = @v_empid IF (@v_empid BETWEEN 100
AND 500)
RETURN @v_bonus RETURN 0 END
o CREATE FUNCTION dob ndf_get_bonus_point (@v_empid)
RETURNS int AS BEGIN
DECLARE @v_bonuspt int, IF (@v_empid BETWEEN 100 AND 500) BEGIN SELECT
@v_bonuspt = Bonus_Point From Employee_Details Where Employee_ID = @v_empid
RETURN @v_bonus END ELSE RETURN 0 END
Q.22
You are a database developer on an instance of SQL Server . There is a table named Products_Sold
in the database . Your manager wants that he should able to track of modifications does in the ===of
each column of the table and track the number of modifications on that column Product_Sold is the
master table and you cannot perform delete on it.You write the trigger to achieve the same . Which
one of the following codes will you be able to perform this task? ( 3 M)
o CREATE TRIGGER [TRIGGER_GET-COUNT] ON [dob] [Products_Sold]
FOR INSERT,UPDATE AS BEGIN DECLARE @TranID varchar(36) UPDATE [dob]
[Products_Sold] SET AlterCount = AlterCount* 1 ,LastUpdate = GETDATE() WHERE
TransactionID = @ TranID END
o CREATE TRIGGER [TRIGGER_GET-COUNT] ON [dob] [Products_Sold]
FOR INSERT,UPDATE AS BEGIN DECLARE @TranID varchar(36) SELECT @TranID =
TransactionID FROM INSERTED UPDATE [dob] [Products_Sold] SET AlterCount =
AlterCount* 1 ,LastUpdate = GETDATE() WHERE TransactionID = @ TranID END
o CREATE TRIGGER [TRIGGER_GET-COUNT] ON [dob] [Products_Sold]
INSTEAD OF INSERT AS BEGIN DECLARE @TranID varchar(36) SELECT @TranID =
TransactionID FROM INSERTED UPDATE [dob] [Products_Sold] SET AlterCount =
AlterCount* 1 ,LastUpdate = GETDATE() WHERE TransactionID = @ TranID END
o CREATE TRIGGER [TRIGGER_GET-COUNT] ON [dob] [Products_Sold]
FOR INSERT AS BEGIN DECLARE @TranID varchar(36) SELECT @TranID = TransactionID
FROM INSERTED UPDATE [dob] [Products_Sold] SET AlterCount = AlterCount*
1 ,LastUpdate = GETDATE() WHERE TransactionID = @ TranID END
Q.23
Which one of the following statements is used to display information regarding the amount of disk
activity generated by T-SQL statement? ( 1 M)
o DBCC SHOW_STATISTICS
o UPDATE STATISTICS
o AUTO_CREATE_STATISTICS
o SET STATISTICS IO
Q.24
Which one of the following options in SQL Server refers to information that is used by the query
optimizer to determine the execution plan for returning results when you run a query? (2 M)
o Database Engine Tuning Advisor
o Statistics
o DMV’s
o SQL Server Profiler
Q.25
You are the database administrator of a SQL Server instance. One of the application extensively uses
the DML commands to trigger the population of multiple tables in this SQL Server instance. The client
reports you of poor performance . You doubt that this problem has something to do with blocking. You
want to monitor the state of the instance at regular intervals without affecting application performance.
(3M)
Which tool should you use?
o Enable change tracking
o Change data tracker
o SQL Server Profiler
o Dynamic Management Views

You might also like