You are on page 1of 96

1. It is mandatory to define at least one secondary data file for a database.

State True or False. Ans. False( Some databases may not have sec database file,
while others may have many )
2. Consider the following statements with respect to partitioned tables:
Statement 1: Partitioned tables allows data rows to be split horiontally based on !alues in a
"ey column#li"e date$
Statement 2: %&' operations#I(S)*T+ ,P%-T)+ %)')T)$ for partitioned#multiple partition$
tables are different from that of a single partition table. .hich of the following is applicable for
abo!e/ Ans Statement 1 is true, 2 is false
0. .hich of the following are correct with respect to Filegroups/#Choose 2$ Ans.
Filegroups apply only to data files and not log files, Once a data file is added to a
database, it cannot be moved to another filegroup
1. .hen creating a database+ which of the following should be considered when selecting the
location of the database files/#Choose 0$ Ans. 1.atabase files should have sufficient
space for growth, !."hoose a common location or directory to #eep the database files to
#eep things organi$ed,%. &he path specified for locating the database files should e'ist
before creating a database
2. Consider the following statements with respect to 3iews:
Statement 1: Inde4 on a !iew ta"es up physical storage and re5uires maintenance.
Statement 2: 'ocal partitioned !iew utilises base tables that reside on the same ser!er. .hich
of the following is applicable for abo!e/
Ans. (oth Statements 1 and ! are true
6. .hich of the following are features of a local temporay stored procedure/#Choose 2$
Ans. )t is automatically deleted when the connection is closed, )t can be e'ecuted only
by the connection that created it
7. .hich of the following are correct for temporary tables used in Stored procedures/#Choose 2$
Ans. 1.*ocal temporary tables created in a stored procedure are automatically dropped
when the stored procedure e'its.,!. +lobal temporary tables are not available if the user
session in which they were created disconnects from the S,* Server.
8. Consider the following statements with respect to (ested stored procedures:
Statement 1 : There is no limit to the number of le!els to which procedures can be nested.
Statement 2 : The number of stored procedures that can be called from within a single
procedure is limitless.
Statement 0 : - stored procedure can call itself upto a defined ma4imum limit
.hich of the following is applicable for abo!e statements/
Ans. Statement ! and % are true, 1 is false
9. .hich of the following attributes characterise System Stored Procedures/#Choose 0$
Ans. 1.&he stored procedure name begins with sp-., !.&he stored procedure resides in a
.esource database &he procedure is defined in a sys schema
1:. Consider the following statements with respect to C'* procedures:
Statement 1: C'* procedures are typically written in &icrosoft C or 3isual C;;.
Statement 2: C'* procedures are safe and secure because they run within the -ppdomain
boundary and it cannot access random S<' Ser!er memory locations. .hich of the following is
applicable for abo!e statements/
Ans. Statement 1 is false, ! is true
11. .hich of the following cannot be passed as input parameter !alues to a Stored procedure/
#Choose 2$
Ans. Function, /'pression
12.Consider the following statement:
Select title=id+ price+ type from titles where price > dbo.-!erage?oo"Price#@comp=science@$
Ans. Scalar function
.hat "ind of a ,ser %efined Function is used in the abo!e statement/
12. Consider the following statements with respect to ,ser defined functions:
Statement 1: - ,ser %efined Function cannot generate permanent changes to any resource
whose scope e4tends beyond the function.
Statement 2: The only changes that can be made by the S<' statements in a function are to
the obAects that are local to the function+ li"e local cusors or !ariables.
Ans. (oth Statements 1 and ! are true
.hich of the following is applicable for the abo!e/
10. Bou are currently wor"ing with an application with lage processorCintensi!e calculations..hich
of the following stored procedure would you prefer/
Ans. A "*.0integrated stored procedure
11. .hich of the following error type can be handled within a T*B..C-TCD construct of handling
errors in stored procedures/
Ans. Severity !1 or higher errors that do not result in closing of a connection
12. .hich of the following type of statement are allowed to be included in a ,ser %efined Function/
Ans.1. eclare statements to define variables and cursors that are local to the
function,!. /2/"3&/ statements that call an e'tended stored procedure, all the above
16. Bou ha!e to perform operations li"e inserts+ deletes+ updates on the contents of a table !ariable
before returning a result set..hich of the following ,ser %efined Function will be suitable to
define for the abo!e scenario/ans. 4ulti0statement table valued function
17. .hich of the following is not an ad!antage of Stored Procedure/ans Automatic /'ecution
18. .hich of the following stored procedures are ideal candidates to be reCwritten as ,ser %efined
Functions/#Choose 2$ ans. 1.&he stored procedure does not perform update operations
on tables, e'cept against table variables, !.&he stored procedure returns no more than a
single result set
19. Bou ha!e a stored procedure and you need to ma"e some modifications to it.
.hich of the following ways can this be done/#Choose 2$ ans.1. rop the procedure using
.O5 and re0create a new one using "./A&/ command,!. 4odify the procedure using
A*&/. command
21. Consider the following scenario:
The creator of a stored procedure also owns the tables that it references.
Statement 1: -n user can e4ecute the stored procedure but cannot access the referenced table unless
the creator grants access to the table
Statement 2: -n user can e4ecute the stored procedure and inherits the rights on the referenced table
from the owner within the conte4t of the stored procedure
.hich of the following is applicable for the abo!e/
-. Statement 1 is true+ 2 is false
(. Statement 1 is false, ! is true
C. ?oth Statements 1 and 2 are true
%. ?oth Statements 1 and 2 are false
22. .hich of the following option defines a cursor that ma"es a temporary copy of the data to be used by
the cursor/
A. S&A&)"
?. %B(-&IC
C. E)BS)T
%. F-ST=FF*.-*%
20. .hich of the following options is used to retrie!e the second record from a table/
A. F/&"6 S/"O7
?. F)TCD -?SF',T) 2
C. F)TCD *)'-TI3) 2
%. (one of the listed options
21. Consider the following statements with respect to cursors:
Statement 1 :Cursor processing is faster than setCoriented processing and causes loc"s to be held for
shorter period of time.
Statement 2: Cursors can be used to minimie loc"ing contention for updates and deletions of a large
number of rows in a table.
.hich of the following is applicable for abo!e/
-. Statement 1 is true+ 2 is false
(. Statement 1 is false, ! is true
C. ?oth Statements 1 and 2 are true
%. ?oth Statements 1 and 2 are false
22. Consider the following statements with respect to use of cursors in stored procedures:
Statement 1: - stored procedure can pass cursor !ariables as output parameters only.
Statement 2: Bou must use S)')CT statement to assign a cursor to a cursor !ariable.
F)TCD S)CF(%
.hich of the following is applicable for abo!e/
A. Statement 1 is true, ! is false
?. Statement 1 is false+ 2 is true
C. ?oth Statements 1 and 2 are true
%. ?oth Statements 1 and 2 are false
26. Consider the following with respect to types of cursors:
Statement 1: - global cursor defined in a stored procedure is a!ailable e!en after the connection closes.
Statement 2: - local cursor remains in scope e!en after the stored procedure that declared it terminates
which of the following is applicable for abo!e/
-. Statement 1 is true+ 2 is false
?. Statement 1 is false+ 2 is true
C. ?oth Statements 1 and 2 are true
. (oth Statements 1 and ! are false
27. ?elow is a code snippet for cursor:
:1 ,S) -d!enture.or"s
:2 GF
:0 %)C'-*) contact=cursor C,*SF* FF*
:1 S)')CT 'ast(ame F*F& Person.Contact
:2 .D)*) 'ast(ame 'IE) @?H@
:6 F*%)* ?B 'ast(ame
:7 FP)( contact=cursor
:8 F)TCD ()IT F*F& contact=cursor
:9 .DI') JJF)TCD=ST-T,S K :
1: ?)GI(
11 CCCC &issing 'ine
12 )(%
10 CCCC &issing 'ine
11 CCCC &issing 'ine
.hich of the following lines of code can be correctly fitted into the missing lines/#Choose 0$
A. F/&"6 7/2& F.O4 contact-cursor
?. FP)( contact=cursor
". /A**O"A&/ contact-cursor
. "*OS/ contact-cursor
). -''FC-T) contact=cursor
28. .hich of the following cursor creation option specifies that all fetch options
#FI*ST+'-ST+P*IF*+()IT+*)'-TI3)+-?SF',T)$ are a!ailable/
-. 'ocal
(. Scroll
C. Global
%. Scroll=loc"s
29. The I(ST)-% of trigger can be applied to a !iew and triggered based on the modifications to the
!iew.
State True or False.
A. &.3/
?. F-'S)
0:. .hich of the following is limitation of I(ST)-% of trigger/
-. I(ST)-% trigger does not support recursion
?. Fnly one I(ST)-% of trigger can be defined for each action on a gi!en table
C. - table cannot ha!e an I(ST)-% of trigger and FF*)IG( E)B constraint with C-SC-%)
defined for the same action
. All of the listed options
01. In case of defining multiple triggers for an ,P%-T) action on a gi!en table+ which of the following are
correct trigger order !alues/#Choose 0$
-. FI*ST
?. (F()
C. -(B
%. '-ST
). S)CF(%
02. For which of the following it is ideal to define nonCclustered inde4es/
-. <ueries that do not return large result sets
?. Columns that are fre5uently used in the .D)*) clause that return e4act matches
C. Coumns that ha!e many distinct !alues
. All of the listed options
00. *eferential integrity can be enforced by using %&' triggers.
.hich of the following are other methods by which the same enforcement can be achie!ed/#Choose 2$
A. 3sing Stored procedures
?. %efining inde4es
". efining foreign #ey constraints
%. %efining !iews
01. .hich of the following is a perfect match with reference to an Inde4/
-. Smallest unit of data storage
?. -utomatically created at the time of creating a table
". Allows an application program to find specific data without scanning through the entire
table
%. contains information about modifications carried out in the database
02. .here are S<' Ser!er user names and Passwords stored in s5l ser!er/
-. ,nder msdb database in sys4logins tables
?. ,nder tempdb database in sys4logins tables
". 3nder 4aster database in sys'logins tables
. (one of the listed options
06. A table can not have more than one clustered index.
State True or False
A. &.3/.
?. F-'S).
07. -ssume that you ha!e a %atabase )*P in which there is a field called )*P=(,& which is used in
se!eral places. The column has a specific beha!ior which is different from the traditional S<' ser!er data
types.
.hich of the following feature we can use to address the abo!e re5uirement/
-. 3iew
?. temp table
". 3ser efined &ype
%. )4tension
08. S5lser!er uses a wor"space for storing temporary obAects such as tables and stored procedures. This
wor"space is recreated each time the s5lser!er is restarted.
.hich of the followng correctly describes the abo!e wor"space database/
-. msdb
?. model
C.master
.tempdb
09. .hich of the following are correct for inde4ed !iews/#Choose 2$
A. An inde'ed view is any view that has a clustered inde' defined on it
?. The inde4ed !iew is a logical entity and is not materialied in the database
C. Bou can create only one inde4 on a !iew
. )nde'ed views aid in optmi$ing performance
1:. -n user wants to grant all users 5uery pri!ileges on hisLher %)PT table.
.hich of the following S<' statement will help himLher accomplish this/
-. G*-(T select F( dept TF -''= ,S)*S
?. G*-(T <,)*B F( dept TF -''=,S)*S
". +.A7& select O7 dept &O 53(*)"8
%. (one of the listed options
11. .hen of the following sub5uery ta"es parameters from its parent 5uery/
a. (ested sub5uery
b. "orrelated sub9uery
c. Plain Sub5uery
d. Moin Sub5uery
12. .hich of the following is (FT used to combine data from multiple tables/
a. ,nion
b. Sub5uery
c. Moin
d. .ole
10. .hich of the following helps us to create and populate a new table with the data of an e4isting table/
a. S/*/"& )7&O
b. ,(IF(
c. S,?<,)*B
d. MFI(
11. - set of statements is to be e4ecuted 1: times.
.hich of the following constructs can we use for this tas"/
a. IF..)'S)
b. :6)*/
c. C-S)
d. (one of the listed options
12. .hich of the following type of integrity is correct for the statement C
'Ensures that the values in a column are within the Specified Range'?
a. ntegrit!
b. omain )ntegrity
c. "ser #efined ntegrit!
d. )ntity Integrity
16. .hich of the following type of integrity maintains the relationship between tables in a database/
a. .eferential )ntegrity
b. %omain Integrity
c. ,ser %efined Integrity
d. )ntity Integrity
17. .hich of the following type of integrity ensures each record in a table is ,ni5ue/
a. %ata Integrity
b. %omain Integrity
c. ,ser %efined Integrity
d. /ntity )ntegrity
18. Bou wor" as a database de!eloper at -?C.Inc.com.
The -?C sales staff wants to trac" sales by multiple parameters such as age+ country to be able to spot
rele!ant sales patterns.
To produce such information you need to Aoin four tables from the highly normalied database.
.hich of the following suggestion will ma"e the 5uery response time faster/
Create a !iew on the four tables. Create an inde4 on the !iew
a. enormali$e the database design if possible
b. Further normalie the table
c. %efine *eferential Integrity constraints so that data can be referenced faster
19. )4amine the structure of the )&P'FB))S and ().=)&P'FB))S tables
employees
employee=id I(T Primary Eey
first=name 3-*CD-* #22$
last=name 3-*CD-*#22$
hire=date %-T) %-T)TI&)
new=employees
employee=id I(T Primary Eey
name 3-*CD-*#2:$
.hich of the following ,P%-T) statement is !alid for the abo!e/
a. ,P%-T) new=employees S)T name K #Select last=name NN first=name F*F& employees .here
employee=id K18:$
b. ,P%-T) new=employees S)T name K #S)')CT last=name NN first=name F*F& employees .D)*)
employee=id K18:$ .D)*) employee=id K#S)')CT employee=id F*F& new employees$
c. (one of the listed options
d. SubC5uery in this answer will return one row !alue+ concatenated first and last name for the employee
with I% 18:+ so update will be successful. .hen subC5ueries are lin"ed to the parent by e5uality
comparisons+ the parent 5uery e4pects only one row of data
2:. .hich of the following is a !alid statement about sub 5ueries/
a. - sub5uery must be enclosed in parenthesis
b. - sub5uery must be put in the right hand side of the comparison operator
c. - sub5uery cannot contain a F*%)*C?B clause
d. - 5uery should not contain more than one subC5uery
21. %uring the maAor system upgrade+ multiple data changes are going to be made. Bou would li"e to
implement !arious changes without disturbing any of the e4isting data.
.hich of the following operations do not affect any e4isting data !alues/ #Choose 0$
a. )nsert
b. "hanging "olumn 7ame
c. )ncreasing column length
d. &odify datatype
e. %ecreasing column length
f. The purpose of the ,P%-T) command is e4actly what you want to a!oid. Bou should be able to
increase the data storage sie and alter a column name without affecting the internal data. Dowe!er+ a
decrease in the data storage sie results in data truncation or loss. I(S)*T+ used appropriately+ adds
data but does not alter any e4isting !alues
22. Consider the following statements:
C*)-T) P-*TITIF( F,(CTIF( SalesFigures #datetime$
-S *-(G) *IGDT FF* 3-',)S
#@:1L:1L1990@+ @:1L:1L1991@+ @:1L:1L1992@$
GF
.hat does the abo!e partition function achie!e/
a. "reates four partitions
1) for data before 1;;%
!) for data of 1;;%
%) for data of 1;;<
<) for data of 1;;= or later
b. Creates three partitions
1$ for data of 1990
2$ for data of 1991
0$ for data of 1992 or later
c. Creates four partitions
1$ for data before 1990
2$ for data of 1990
0$ for data of 1991
1$ for data of 1992
d. Creates three partitions
1$ for data of 1990 or prior to 1990
2$ for data of 1991
0$ for data of 1992 or later
20. Consider the following statements:
- !iew is created as follows:
C*)-T) 3I). )mployee3iew
as
S)')CT empid+ birthdate+ gender+ hiredate
from Dr.)mployees
where hiredate > @2L1L:7@
The following select statement uses the abo!e !iew:
S)')CT O from )mployee3iew
where birthdate > @0L1L62@
.hat does the abo!e S)')CT statement retrie!e/
a. )t retrieves information of employees born after 4arch 1, 1;>= and who have been hired after
february 1, !11?
b. It retrie!es information of employees born after &arch 1+ 1962
c. It retrie!es information of employees who ha!e been hired after february 1+ 2::7
d. It retrie!es information of employees born on or after &arch 1+ 1962 and who ha!e been hired on or
after after february 1+ 2::7
21. Consider the following statements:
S)')CT name -S !iew=name
+SCD)&-=(-&)#schema=id$ -S schema=name
+F?M)CTP*FP)*TB)I#obAect=id+@IsInde4ed@$ -S IsInde4ed
+F?M)CTP*FP)*TB)I#obAect=id+@IsInde4able@$ -S IsInde4able
+create=date
+modify=date
F*F& sys.!iewsP
.hat does IsInde4able return in the abo!e statement/
a. IsInde4able is a property that returns 1 if the !iew has atleast one inde4+ and : if there is no inde4
created on the !iew
b. )s)nde'able is a property that returns 1 if an inde' can be created on the view, and 1 if it is not
inde'able.
c. IsInde4able is a property that returns : if an inde4 can be created on the !iew+ and 1 if it is not
inde4able.
d. IsInde4able is a property that returns : if an inde4 can be created on the !iew+ and 1 if it is not
inde4able.
22. Consider the following statements for creation of a !iew:
C*)-T) 3I). Title!iew -S
select title+ au=ord+ au=lname+price+ ytd=sales+ pub=id
from authors+ titles+ titleauthor
where authors.au=id K titleauthor.au=id
-(% titles.title=id K titleauthor.title=id
In case the abo!e schema needs to 5ualify for creation for an inde4+ which of the following are missing/
a. S"6/4A()7)7+ clause
b. FF* C*)-TIF( FF I(%)I clause
c. ,(I<,) clause in the C*)-T) SCD)&- line
d. atabase 9ualifier for each table
26. Consider the following statements for creation of a !iew:
C*)-T) 3I). Title!iew -S
select title+ au=ord+ au=lname+price+ ytd=sales+ pub=id
from authors+ titles+ titleauthor
where authors.au=id K titleauthor.au=id
-(% titles.title=id K titleauthor.title=id
In case the abo!e schema needs to 5ualify for creation for an inde4+ which of the following are missing/
a. -dds files with new names
b. -dds files to folders
c. Adds files to filegroups
d. -dds files to database
27. -ssume that there is an inde4ed !iew defined called prod.product=details.
.hich of the following gi!es the right e4ample of using the !iew where S<' ser!er will process the 5uery by
accessing data directly from the base tables and ignore the inde4ed !iews.
a. Select O from prod.product=details
where unit=of=measure K @EG@
FPTIF(#(F)IP-(% 3I).S$
b. Select @ from prod.product-details
where unit-of-measure A BC+B
O5&)O7(/25A7 D)/:S)
c. Select O from prod.product=details
where unit=of=measure K @EG@
d. Select O from prod.product=details
where unit=of=measure K @EG@
FPTIF(#)IP-(% I(%)I)S$
28. Consider the following statements:
-'T)* %-T-?-S) )mployee
&F%IFB FI') #(ame K )mployee=log+
FI')(-&) K @C:Q)mployee=log.ldf@$
.hat does the abo!e statement achie!e/
a. &odifies the name of the )mployee database log file
b. -lters the )mployee database structure
c. 4oves the log file of the /mployee database to the root of the "E drive
d. (one of the listed options
29. Consider the following statements:
C*)-T) T-?') dbo.parameter
#tableid int identity
tabledesc shortdesc$
.hich of the following gi!e the possible interpretations of use of shortdesc as datatype/#Choose 2$
a. )t is an error and invalid data type
b. )t could be an user defined data type
c. It is a !alid basic data type supported
d. (one of the listed options
6:. Consider the following statements:
C*)-T) P-*TITIF( SCD)&) CustPS1
-S P-*TITIF( CustPS1
-'' to #RP*I&-*BS$
GF
C*)-T) T-?') dbo.customers=p1#cust=id+ cust=name+ order=dt$
F( CustPS1#order=dt$
GF
.hat does the abo!e statement achie!e/
a. Creates partitioned !iew CustPS1 on table customers=p1
b. Creates Customers=p1 table in file group custPS1
c. "reates "ustomers-p1 table in partition scheme cust5S1 and column order-dt is used for
partitioning
d. (one of the listed options
61.Consider the following statements:
C*)-T) P-*TITIF( SCD)&) CustPS1
-S P-*TITIF( CustPS1
-'' to #RP*I&-*BS$
GF
C*)-T) T-?') dbo.customers=p1#cust=id+ cust=name+ order=dt$
F( CustPS1#order=dt$
GF
.hat does the abo!e statement achie!e/
- Creates table Table1 in filegroup userdata=FG and creates a clustered inde4 in filegroup userdata=FG
? "reates table &able1 in filegroup userdata-F+ and creates a clustered inde' in default filegroup
C Creates table Table1 in filegroup userdata=FG and creates a clustered inde4 in filegroup userinde4=FG
% (one of the listed options
62 -ssume there is a table emp defined with columns as
emp=id smallint
emp=name !archar#0:$
emp=address te4t
Supposing you want to modify the abo!e table to ma"e the emp=address column as !archar#1:$
which of the following ia a !alid command to ma"e the change/
- -'T)* T-?') emp -'T)* CF',&( emp=address 3-*CD-*#1:$ (,''
? -'T)* T-?') emp -'T)* CF',&( emp=address 3-*CD-*#1:$ (FT (,''
C -'T)* CF',&( emp=address of T-?') emp 3-*CD-*#1:$ (,''
% -'T)* CF',&( emp=address of T-?') emp 3-*CD-*#1:$ (FT (,''
/ 7one of the listed options
te4t column cannot be changed
>% -ssume there is a table emp defined with columns as
emp=id smallint
emp=name char
emp=address char
.hich of the following command can be issued to change the datatype of column emp=address from char
to nchar/
A A*&/. &A(*/ emp A*&/. "O*347 emp-address nchar 73*'
? -'T)* CF',&( emp=address of T-?') emp nchar (,''
C -'T)* CF',&( emp.emp=address nchar (,''
% (one of the listed options
61 -ssume there is a table emp defined with columns as
emp=id smallint
emp=name char
emp=address char
In case you want to add a new column emp=gender after the emp=name column+ which of the following
can be used/
- -'T)* T-?') emp -%% emp=gender char (FT (,''
? -'T)* T-?') -%% emp.emp=gender char (FT (,''
C -'T)* T-?') emp -%% emp.emp=gender char (FT (,'' -FT)* emp=name
7one of the listed options
new column can be added only in the end
62 -ssume there is a table emp defined with columns as
emp=id smallint
emp=name char
emp=address te4t
In case you want to add a new column emp=gender to the abo!e table+ which of the following can be
used/
- -'T)* T-?') -%% emp.emp=gender char (FT (,''
? A*&/. &A(*/ emp A emp-gender char 7O& 73**
C -'T)* T-?') emp -%% -T )(% emp=gender char (FT (,''
% (one of the listed options
66 Consider the following statement:
C*)-T) 3I). sales.sales=sum=!u as
S)')CT datepart#yy+ orderdate$ as @order=year@+
datepart#mm+ orderdate$ as @order=month@+
sum#totaldue$
F*F& sales.sales=order
G*F,P ?B datepart#yy+ orderdate$+ datepart#mm+ orderdate$
.hat is the outcome of the abo!e create statement/
- Creates a simple !iew successfully.
? Create fails because deri!ed columns are not allowed in S)')CT
C "reate fails because derived columns in S/*/"& should have a name or alias associated with it
%Creates an inde4ed !iew successfully.
67 Consider the following statement:
C*)-T) 3I). sales.sales=sum=!u as
S)')CT datepart#yy+ orderdate$ as @FrderBear@+
datepart#mm+ orderdate$ as @Frder&onth@+
sum#totaldue$ as @Total%ue@
F*F& sales.sales=order
G*F,P ?B datepart#yy+ orderdate$+ datepart#mm+ orderdate$
F*%)* ?B FrderBear+ Frder&onth
.hat is the outcome of the abo!e create statement/
- Creates a simple !iew successfully.
? Create fails because deri!ed columns are not allowed in S)')CT
C "reate fails because O./. (F clause is not allowed in this statement
% Creates an inde4ed !iew successfully.
68Consider the following statements:
C*)-T) 3I). sales.sales=sum=!u as
S)')CT datepart#yy+ orderdate$ as @FrderBear@+
datepart#mm+ orderdate$ as @Frder&onth@+
sum#totaldue$ as @Total%ue@
F*F& sales.sales=order
G*F,P ?B datepart#yy+ orderdate$+ datepart#mm+ orderdate$
S)')CT top 2 O
F*F& sales.sales=sum=!u
.D)*) FrderBear >K2::7
F*%)* ?B FrderBear+ Frder&onth
.hich of the following is applicable for abo!e statements/
- "reates a simple view, and retrieves ma'imum of five records based on the given criteria
? Create fails because the C*)-T) statement does not ha!e F*%)* ?B clause
C Creates a simple !iew and retrie!es minimum of fi!e records based on the criteria
% Create fails because G*F,P ?B clause is not allowed in C*)-T) statement
69 Consider the following statements:
C*)-T) 3I). hr.male=emp=!u
-S
S)')CT empid+ empname+ empgender
F*F& hr.employees
.D)*) empgender K @&@
.ITD CD)CE FPTIF(
,P%-T) hr.male=emp=!u
S)T empgender K @F@
.D)*) empid K 1::1
.hat is the outcome of the satements as abo!e/
- The C*)-T) statement fails because CD)CE FPTIF( is in!alid for create !iew
? The C*)-T) and the ,P%-T) statements go through successfully
C &he "./A&/ statement goes through but 35A&/ statement fails
% (one of the listed options
.ith chec" option we cannot update the column that would change the !iew retrie!al contents
7: Consider the following statements:
C*)-T) 3I). credit=card=!u
-S
S)')CT creditcardid+ cardtype+ cardno+ e4pmonth+ e4pyear
F*F& sales.creditcard
,P%-T) credit=card=!u
set e4pyear K e4pyear ; 1
.D)*) e4pyear TK 2::1
.hat is the outcome of the abo!e statements/
- The C*)-T) statement fails
? &he "./A&/ and the 35A&/ statements go through successfully
C The C*)-T) statement goes through but ,P%-T) statement fails
% (one of the listed options
71 Consider the following S)')CT statement:
S)')CT territoryid+ sum#totaldue$
F*F& sales.salesorder
G*F,P ?B territoryid
F*%)* ?B territoryid
In case the same S)')CT statement can be e4actly achie!ed by using a 3I).+ which of the following
3I). definition will be correct/
- C*)-T) 3I). sales=!u -S
S)')CT territoryid+ sum#totaldue$ @Totalsales@
F*F& sales.salesorder
G*F,P ?B territoryid
F*%)* ?B territoryid
? C*)-T) 3I). sales=!u -S
S)')CT territoryid+ sum#totaldue$ @Totalsales@
F*F& sales.salesorder
F*%)* ?B territoryid
C C*)-T) 3I). sales=!u -S
S)')CT territoryid+ sum#totaldue$ @Totalsales@
F*F& sales.salesorder
G*F,P ?B territoryid
% 7one of the listed options
!iew does not support order by+ so the select stmt cannot be e4actly created as a !iew
72 -ssume there is a new table @emp@ created with columns as empid+ empname+ empdob+ empaddress
The following statements are issued for creating inde4es:
C*)-T) RC',ST)*)%S I(%)I id41 F( emp#empname$
C*)-T) RC',ST)*)%S I(%)I id42 F( emp#empdob$
.hat is the outcome of the abo!e statements/
- two clustered inde4es id41 and id42 will be created on emp table
? Only one clustered inde' id'1 will be created on emp table
C Fnly one clustered inde4 id42 will be created on emp table
% (o inde4 will be created on emp table
only one clustered inde4 is allowed+ the second one will fail
70 -ssume there is a new table @emp@ created with columns as empid+ empname+ empdob+ empaddress
The following statements are issued for creating inde4es:
C*)-T) I(%)I id41 F( emp#empname$ I(C',%)
C*)-T) R(F(C',ST)*)%S I(%)I id42 F( emp#empdob$ R-SCS
.hat is the outcome of the abo!e statements/
- Creates nonCclustered inde4es id41 on empname and id42 on empdob+ both in descending order
? Creates clustered inde4 id41 on empname and nonCclustered inde4 id42 on empdob+ both in ascending
order
" "reates non0clustered inde'es id'1 on empname and id'! on empdob, both in ascending
order
% Creates clustered inde4 id41 on empname and nonCclustered inde4 id42 on empdob+ both in
descending order
default is -SC for first one
71 -ssume there is a new table @emp@ created with columns as empid+ empname+ empdob+ empaddress+
emailid
empid is the primary "ey for the abo!e table.
In addition+ a clustered inde4 is created on empdob for the table.
(ow+ users re5uire faster access to employee information based on their uni5ue emailid.
.hich of the following will achie!e the re5uirement/
- Create a uni5ue clustered inde4 on emailed
? "reate a uni9ue non0clustered inde' on emailed
C Create a non uni5ue clustered inde4 on emailed
% This re5uirement cannot be met by creating inde4es
uni5ue clustered cannot be created because already one clustered ind4 e4ists
72 -ssume there is a new table @emp@ created with columns as empid+ empname+ empdob+ empaddress
The following statement is issued for creating inde4:
C*)-T) I(%)I id41 F( emp#empname$ I(C',%) empaddress
.hat is the significance of the I(C',%) clause in the abo!e statement/
- It concatenates empaddress to empname to form the inde4
? It creates inde4 !alues for empname only if address is present#not null$
C )t includes empaddress in the leaf level pages of the inde'
% (one of the listed options
"eeps address data in inde4 for immediate retrie!al
76 -ssume there is an e4isting table @emp@ with columns as empid+ empname+ empdob+ empaddress
In addition+ a nonCclustered inde4 #id41$ e4ists on empdob column.
The following statements are issued :
-'T)* I(%)I id41 F( emp %IS-?')
%*FP I(%)I emp.id41
.hat is the final outcome of issuing the abo!e statements/
- &he inde' id'1 is completely removed
? The inde4 id41 is temporarily disabled
C The inde4 id41 is permanently disabled
% The statements end with e4ecution error
drop finally remo!es the inde4
77-ssume there is an e4isting table @emp@ with columns as empid+ empname+ empdob+ empaddress
In addition+ a nonCclustered inde4 #id41$ e4ists on empdob column.
The following statements are issued :
-'T)* I(%)I id41 F( emp %IS-?')
%*FP I(%)I emp.id41
-'T)* I(%)I id41 F( emp *)?,I'%
.hat is the final outcome of issuing the abo!e statements/
- The inde4 id41 gets recreated
? The inde4 id41 is temporarily disabled
C The inde4 id41 is permanently disabled
&he statements end with e'ecution error
cannot rebuild a dropped inde4+ gi!es error
78?elow is a trigger defined :
:1 ,S) master
:2 GF
:0 C*)-T) T*IGG)* sr!=trg=*estrict(ew'ogins
:1 F( -'' S)*3)*
:2 FF* C*)-T)='FGI(
:6 -S
:7 P*I(T @(o login creations without %?- in!ol!ement.@
:8 *F''?-CE
:9 GF
.hat does the abo!e trigger achie!e
- It is a -FT)* %&' trigger that restricts addition of new users e4cept with %?- pri!ileges
? It is an I(ST)-% FF trigger that restricts addition of new users e4cept with %?- pri!ileges
C )t is a * trigger that restricts creation of new user logins into a server
% (one of the listed options
It is %%' trigger
79 -ssume there is an e4isting table @emp@ with columns as empid+ empname+ empdob+ empaddress
In addition+ a nonCclustered inde4 #id41$ e4ists on empdob column.
Transaction processing and updates happen 21O7 on the @emp@ table.
Inde4 id41 has become fragmented and needs to be rebuilt.
.hich of the following will achie!e the abo!e/
- ,se -'T)* command and disable the inde4 using %IS-?') clause and rebuild using *)?,I'% clause
? ,se -'T)* command and rebuild the inde4 using *)?,I'% clause
C 3se A*&/. command and rebuild using ./(3)* with O7*)7/ A O7 clause
% *ebuild is not possible when the table is updated 21O7
Fnline inde4ing operation ispossible with F('I() K F(
8: The following trigger is created an a table called @authors@ that has columns au=id+ au=name+city
C*)-T) T*IGG)* tr=au=upd F( authors
FF* I(S)*T+ ,P%-T) -S
IF ,P%-T)#city$
?)GI(
*F''?-CE T*-(
)(%
GF
The following statement is e4ecuted on the authors table:
,P%-T) authors
S)T city K @&,&?-I@
.D)*) au=id K @1::1@
.hat will be the outcome of the abo!e statement/
- The city for au=id K 1::1 is changed to &,&?-I in authors table
? The city for au=id K 1::1 is set to (,'' in authors table
C &he city for au-id A 1111 is not changed in the authors table
% (one of the listed options
,P%-T) function restricts changes to city and trigger rolls bac" update
81$ The following trigger is created an a table called @authors@ that has columns au=id+ au=name+city
C*)-T) T*IGG)* tr=au=upd F( authors
FF* I(S)*T+ ,P%-T) -S
IF ,P%-T)#city$
?)GI(
*F''?-CE T*-(
)(%
GF
The following statement is e4ecuted on the authors table:
I(S)*T authors#au=id+ au=name+city$
3-',)S #1::1+ @P*-E-SD@+ @&,&?-I@@$
.hat will be the outcome of the abo!e statement/
- - new row for au=id K 1::1 is inserted with name K P*-E-SD and city K &,&?-I
? No row is added for au_id = 1001
C - new row for au=id K 1::1 is inserted with name K P*-E-SD and city K (,''
% (one of the listed options
82$ The following trigger is created an a table called @authors@ that has columns au=id+ au=name+city
C*)-T) T*IGG)* tr=au=upd F( authors
FF* I(S)*T+ ,P%-T) -S
IF ,P%-T)#city$
?)GI(
*F''?-CE T*-(
)(%
GF
The following statement is e4ecuted on the authors table:
I(S)*T authors#au=id+ au=name$
3-',)S #1::1+ @P*-E-SD@$
.hat will be the outcome of the abo!e statement/
- - new row for au=id K 1::1 is inserted with name K P*-E-SD and city K (,''
( 7o row is added for au-id A 1111
C - new row for au=id K 1::1 is inserted with name K P*-E-SD and city K blan"
% (one of the listed options
80$ The following trigger is created an a table called @authors@ that has columns au=id+ au=name+city
C*)-T) T*IGG)* tr=au=upd F( authors
FF* ,P%-T) -S
IF ,P%-T)#city$
?)GI(
*F''?-CE T*-(
)(%
GF
The following statement is e4ecuted on the authors table:
I(S)*T authors#au=id+ au=name$
3-',)S #1::1+ @P*-E-SD@$
.hat will be the outcome of the abo!e statement/
A A new row for au-id A 1111 is inserted with name A 5.ACAS6 and city A 73**
? (o row is added for au=id K 1::1
C - new row for au=id K 1::1 is inserted with name K P*-E-SD and city K blan"
% (one of the listed options
81$ The following trigger is created an a table called @authors@ that has columns au=id+ au=name+city
C*)-T) T*IGG)* tr=au=upd F( authors
I(ST)-% FF ,P%-T) -S
P*I(T @Trigger output row updated@
GF
The following statements are e4ecuted on the authors table:
I(S)*T authors#au=id+ au=name$
3-',)S #1::1+ @*aAee!@$
,P%-T) authors S)T au=name K @*agha!@ .D)*) au=id K 1::1
GF
S)')CT au=id+ au=name .D)*) au=id K1::1
GF
.hat will be the outcome of the abo!e S)')CT statement/
A Select shows au-id A 1111 and au-name A B.aGeevB
? Select shows au=id K 1::1 and au=name K @*agha!@
C Select shows au=id K 1::1 and au=name as (,''
% (one of the listed options
82$ The following trigger is created an a table called @authors@ that has columns au=id+ au=name+city
C*)-T) T*IGG)* tr=au=upd F( authors
I(ST)-% FF ,P%-T) -S
IF JJ*F.CF,(T K : *)T,*(
,P%-T) authors S)T au=name K @*aman@ .D)*) au=id K 1::1
GF
The following statements are e4ecuted on the authors table:
I(S)*T authors#au=id+ au=name$
3-',)S #1::1+ @*aAee!@$
,P%-T) authors S)T au=name K @*agha!@ .D)*) au=id K 1::1
GF
S)')CT au=id+ au=name .D)*) au=id K1::1
GF
.hat will be the outcome of the abo!e S)')CT statement/
- Select shows au=id K 1::1 and au=name K @*aAee!@
? Select shows au=id K 1::1 and au=name K @*agha!@
C Select shows au=id K 1::1 and au=name as (,''
Select shows au-id A 1111 and au-name A B.amanB
86$ The following trigger is scoped at database le!el:
C*)-T) T*IGG)* tr=table=audit
F( %-T-?-S)
FF* C*)-T)=T-?')+ -'T)*=T-?')+ %*FP=T-?')
-S
*F''?-CE
GF
The following statement is isused on table @titles@ in the database
-'T)* T-?') titles -%% new=col I(T (,''
-'T)* T-?') titles %*FP CF',&( new=col
.hat is the final outcome of issuing the -'T)* statements/
- The new column new=col is created and dropped on table titles
? The new column new=col is created on table titles but drop fails
" "reation of new column new-col on table titles itself fails
% (one of the listed options
87$ The following trigger is created C
C*)-T) T*IGG)* tr=inde4=audit
F( %-T-?-S)
FF* C*)-T)=I(%)I+ -'T)*=T-?')+ %*FP=I(%)I
-S
%)C'-*) J)!ent%ata I&'
S)T J)!ent%ata K )3)(T%-T-#$
S)')CT J)!ent%ata.<uery #@@ data#L)3)(T=I(ST-(C)LPostTime $@@ $
GF
The following statement is issued on table @titles@ in the database#titles table has columns titleid+ titlename$
C*)-T) C',ST)*)% I(%)I id41 on titles#titlename$
.hat is the final outcome of issuing the C*)-T) statement/
- The clustered inde4 id41 fails to create
B Te !lustered inde" id"1 is !reated on titles ta#le !olum titlename and te e$ent%spe!ifi!
information appears in te results pane
C The clustered inde4 id41 is created on titles table colum titlename without any notification
% (one of the listed options
88$ Consider the following scenario:
There are two base tables created in a database. - !iew is created that Aoins columns from the two base
tables.
It is re5uired to update specific columns pic"ed from both the tables using the !iew created.
.hich of the following will achie!e the abo!e tas" successfully/
- %irectly use the ,P%-T) statement on the !iew to update columns from both the base tables
? There is no solution to update the columns from both tables using the !iew
" "reate an )7S&/A of 35A&/ &rigger on the view and update tables as part of trigger code
% Create an -FT)* Trigger on the !iew and update tables as part of trigger code
89$ Consider the following scenario:
Table @dept@ holds information about departments li"e deptid+ deptname+ location
deptid is the primary "ey
Table @emp@ holds information about employees li"e empid+ name+ deptid+ dateofbirth
deptid is the foreign "ey referencing the primary "ey deptid of table dept.
In case a department is closed+ the department row needs to be deleted from @dept@ table. Since foreign
"ey constraint e4ists+ the department row cannot be deleted if there are any employees in that
department.
To o!ercome the abo!e+ an -FT)* T*IGG)* was created on the @dept@ table with code to delete the
indi!idual employee rows based on the deptid.
.hich of the following is the final outcome of issuing a %)')T) statement for a deptid in the @dept@ table/
- The employee rows in table empgets deleted and the department row in dept table is then deleted
? The employee rows in emp table alone get deleted
C The department row in dept table alone gets deleted
&he delete on dept table fails due to foreign #ey constraint and no further deletions ta#e place
on dept or emp table
9:$ Consider the following scenario:
Four triggers are defined for some operations on a table.
The order of firing are defined as under:
sp=settriggerorder tr=1+ FI*ST+ @,P%-T)@
sp=settriggerorder tr=2+ (F()+ @,P%-T)@
sp=settriggerorder tr=0+ '-ST+ @,P%-T)@
sp=settriggerorder tr=1+ (F()+ @,P%-T)@
sp=settriggerorder tr=2+ (F()+ @I(S)*T@
.hich of the following are !alid combination of firing order for abo!e triggers in case an update operation
ta"es place on the table/#Choose 2$
A tr-1 , tr-<, tr-!, tr-%
? tr=1+ tr=2+ tr=1+ tr=0
C tr=1+ tr=1+ tr=2+ tr=0
% tr=1+ tr=2+ tr=2+ tr=0
91$ There are two tables C @Aobs@ table and @employees@ table. ?oth ha!e an -FT)* trigger defined on
them.
There is an ,P%-T) trigger on @employees@ table.
The ,P%-T) trigger on @Aobs@ table updates the @employees@ table.
The following statement is issued:
)I)C sp=configure @nested triggers@ + :
.hat will be the outcome in case an ,P%-T) statement is issued on the @Aobs@ table/
- ?oth the employees and Aobs tables are updated
( Only Gobs table gets updated
C Fnly employees table gets updated
% ?oth the Aobs and employees tables are not updated
92$ .e identify a transaction ==========.
- by its name
? by its parameters
C by its performance
by its A") property
90$ .hich of the following applies to S<' Ser!er transaction/
- It must be isolated
? It must be durable
" )t must be sealed
% (one of the listed options
91$ .hich of the following denotes Transaction Control command in S<'/
- *F''?-CE
? CF&&IT
C S-3)PFI(T
All of the listed options
92$ .hich of the following command is used to undo the current transaction in S<' Ser!er/
- CF&&IT
( .O**(A"C
C -'T)*
% S-3)PFI(T
96$ .hich of the following is the Dighest isolation le!el in S<' Ser!er 2::2/
- *ead uncommitted
? *ead Committed
C *epeatable *ead
Seriali$able
97$ .hich of the following we can use to identify the number of acti!e transactions for current
connection/
A HH&.A7"O37&
? JJT*-(S
C JJT*-S-CTIF(CF,(T
% JJT*-(S-CTIF(S
98$ .hich of the following is used to locate specific content and elements within an I&' document/
- IP-TD
( 24*
C IT)&P')TS
% IS%
99$ I&' columns can only ha!e one primary I&' inde4 defined.
Dow many ma4imum secondary indices can be defined/
- 2
? 1
" %
% 7
1::$ .hich of the following is (FT a !alid *eplication type/
- Transactional *eplications
? Snapshot *eplications
" &raditional .eplications
% &erge *eplications
1:1. .hich of the following command is used to !iew the I&' inde4es used in the database/
1. sys.&'(_inde"es
2. sys.I&'=inde4
0. sys.I&'=inde4es=-''
1. sys.I&'=inde4es=catalog
1:2. .hich of the following fi4ed ser!er roles can manage lin"ed ser!ers/
1. processadmin
2. setupadmin
0. securityadmin
1. ser!eradmin
1:0. Bou need to perform these tas"s:
:1 Create and assign a &-(-G)* role to ?la"e and Clar"
:2 Grant C*)-T) T-?') and C*)-T) 3I). pri!ileges to ?la"e and Clar"
.hich of the following set of S<' statements achie!es the desired results/
1. )*+AT+ *,(+ manager
-*ANT !reate ta#le, !reate $iew
T, manager.
-*ANT manager T, B(A)/, )(A*/P
2. C*)-T) *F') manager
G*-(T create table+ create !oew
TF managerP
G*-(T manager *F') TF ?'-CE+ C'-*EP
0. G*-(T manager *F') TF ?'-CE+ C'-*EP
G*-(T create table+ create !oew
TF ?'-CE C'-*EP
1. (one of the listed options
1:1. .hich of the following S<' statement create a se5uence S) with starting !alue as 0: and in
increments of 2:/
1. G)()*-T) S)<,)(C) S) ST-*T .ITD 0: -%% ?B 2:
2. C*)-T) S)<,)(C) S) ST-*T .ITD 0: -%% ?B 2:
0. )*+AT+ S+01+N)+ S+ STA*T 23T4 50 3N)*+'+NT B6 20
1. G)()*-T) S)<,)(C) S) I(ITI-T) .ITD 0: I(C*)&)(T ?B 2:
1:2. There is a proAect allocation table which has the following structure:
)mp(um int+ ProA(um int+ -lloc%ate %ateTime+ *elease%ate %ateTime
)mp(um and ProA(um form the composite primary "ey and we want to define aPrimary Eey constraint
with those columns.
Choose a !alid statement for the abo!e scenario.
1. )mp(um column or ProA(um column can not ha!e duplicate !alues
2. +mpNum and 7ro8Num !olumns !an not #e nulla#le
0. &ore than one column is not allowed for a primary "ey constraint
1. It is better to define two primary "ey constraints with )mp(um and ProA(um separately
1:6. The D* database in a company has )&P'FB)) and %)P-*T&)(T tables.
%ept=id+ the primary "ey of %)P-*T&)(T table+ is defined as a foreign "ey in the )&P'FB)) table
with F( %)')T) C-SC-%) option
.hat happens when a department is deleted in the %)P-*T&)(T table/
1. All re!ords in +'7(,6++ ta#le #elonging to tat department are deleted
2. The %ept=id column in )&P'FB)) table belonging to that department is updated to spaces
0. The %ept=id in )&P'FB)) table belonging to that department is set to (,''
1. ,pdate fails if there are any records in )&P'FB)) table for that %ept=id
1:7. The D* database in a company has )&P'FB)) and %)P-*T&)(T tables.
%ept=id+ the primary "ey of %)P-*T&)(T table+ is defined as a foreign "ey in the )&P'FB)) table
.hat happens when a department+ with no associated )&P'FB)) records+ is deleted in the
%)P-*T&)(T table/
1. Te 9+7A*T'+NT re!ord is deleted #ut tere is no update done on +'7(,6++ ta#le
2. (o update occurs and no error is gi!en
0. -n error is returned as data integrity is !iolated
1.It leads to unpredictable results
1:8. The D* database in a company has )&P'FB)) and %)P-*T&)(T tables.
%ept=id+ the primary "ey of %)P-*T&)(T table+ is defined as a (,'' column and a foreign "ey in
)&P'FB)) table.
.hat happens when a department is deleted in the %)P-*T&)(T table/
1. The %)P-*T&)(T record is deleted but there is no update done on )&P'FB)) table
2. Te 9+7A*T'+NT re!ord is deleted and te 9ept_id !olumn in +'7(,6++ ta#el is set to null
$alues
0. The %)P-*T&)(T record is deleted and the %ept=id column in )&P'FB)) tabel is set to spaces
1. -n error is returned as data integrity is !iolated
1:9. Consider the following table #F*%)*S$
Frder(um -mount F%-T) Cust(um
0::1 22: :0CoctC91 1::7
0::0 2:: :0CoctC91 1::1
0::2 0:: :0CoctC91 1::1
0::2 2:: :1CoctC91 1::1
0::1 2:: :1CoctC91 1::0
.hat will be the *ow=(umber for Cust(um of 1::7 in the following 5uery/
select Cust(um+ sum#-mount$+
*F.=(,&?)* #$ F3)* #order by sum#-mount$ %)SC$ as *ow=(umber
from F*%)*S group by Cust(um
order by sum#-mount$ desc
1.1
2.1
0.0
1.1
11:. Consider the following table #F*%)*S$
Frder(um -mount F%-T) Cust(um
0::1 0:: :0CoctC91 1::7
0::0 2:: :0CoctC91 1::1
0::2 0:: :0CoctC91 1::1
0::2 2:: :1CoctC91 1::1
0::1 2:: :1CoctC91 1::0
.hat will be the *an" for Cust(um of 1::0 in the following 5uery/
select Cust(um+ sum#-mount$+
*-(E #$ F3)* #order by sum#-mount$ %)SC$ as *an"
from F*%)*S group by Cust(um
order by sum#-mount$ desc
1.1
2.2
0.0
1.1
111. Consider the following table #F*%)*S$
Frder(um -mount F%-T) Cust(um
0::1 0:: :0CoctC91 1::7
0::0 2:: :0CoctC91 1::1
0::2 0:: :0CoctC91 1::1
0::2 2:: :1CoctC91 1::1
0::1 2:: :1CoctC91 1::0
.hat will be the %ense=*an" for Cust(um of 1::0 in the following 5uery/
select Cust(um+ sum#-mount$+
%)(S)=*-(E #$ F3)* #order by sum#-mount$ %)SC$ as %ense=*an"
from F*%)*S group by Cust(um
order by sum#-mount$ desc
1.1
2.2
0.0
1.1
112. Consider a table @employees@ and a stored procedure @sp=process@
The following statements are e4ecuted:
sp=process
S)')CT O from employees
.hat is the outcome of abo!e e4ecution/
1. The S)')CT statement does not e4ecute but stored procedure sp=process e4ecutes
2. The S)')CT statement e4ecutes but stored procedure sp=process does not e4ecute
0. ?oth S)')CT and stored procedure sp=process fail to e4ecute
1. Bot S+(+)T and stored pro!edure sp_pro!ess e"e!ute su!!essfully
110. Consider the following statements:
C*)-T) P*FC myproc
Jparm1 int+ Jparm2 int+ Jparm0 int
-S
CCCCprocessing done here
*)T,*(
The abo!e P*FC is e4ecuted twice as below:
1$ )I)C myproc Jparm1 K 1+ 2+ 6
2$ )I)C myproc 1+ Jparm2 K 2+ Jparm0 K 6
.hat is the outcome of e4ecuting as abo!e/
1. .ith 1$ The P*FC runs successfully using the parameter !alues supplied
.ith 2$ The P*FC runs successfully using the parameter !alues supplied
2. 2it 1: Te 7*,) gi$e error as te parameters are not supplied properly
2it 2: Te 7*,) runs su!!essfully using te parameter $alues supplied
0. .ith 1$ The P*FC runs successfully using the parameter !alues supplied
.ith 2$ The P*FC gi!es error as the parameters are not supplied properly
1. .ith 1$ The P*FC gi!es error as the parameters are not supplied properly
.ith 2$ The P*FC gi!es error as the parameters are not supplied properly
111. To run stored procedures using C'* in S<' Ser!er 2::2+ you will ha!e to run a script against your
database.
.hich of the following gi!es the correct script to be run/
1. A(T+* 9ATABAS+ ;data#ase< S+T T*1ST2,*T46 ,N
go
sp_!onfigure =!lr ena#led=, 1
go
re!onfigure
go
2. -'T)* %-T-?-S) Tdatabase> S)T T*,ST.F*TDB F(
go
sp=configure @clr enabled@+ 1
go
0. -'T)* %-T-?-S) Tdatabase> S)T T*,ST.F*TDB F(
go
sp=configure @clr@
go
reconfigure
go
1. -'T)* %-T-?-S) Tdatabase> S)T T*,ST.F*TDB F(
sp=configure @clr@
reconfigures
112. Consider the following scenario:
- company -?C has many stored procedures each one 5uerying customer database using multiple
conditions.
The %?- thin"s that ha!ing too many stored procedures is bad for maintenance and recommends to
reduce the number of procs.
.hich of the following will be a solution to the abo!e recommendation/
1. 1se 9ynami! S0( in stored pro!edures
2. ,se (ested stored procedures
0. ,se e4tended stored procedures
1. %rop the stored procedures that are not in use
116. Consider the following stored procedures:
C*)-T) proc main=proc
-S
e4ec sub=proc1
e4ec sub=proc2
return
go
C*)-T) proc sub=proc1
-S
e4ec sub=proc2
go
C*)-T) proc sub=proc2
-S
return
Dow many times will the proc sub=proc2 get e4ecuted upon in!o"ing )I)C main=proc/
1. 2 times
2. 16 times
0. 02 times
1. 01 times
2. (one of the listed options
117. Consider the following stored procedure:
C*)-T) P*FC)%,*) Duman*esources.usp=%eleteCandidate
#
JCandidateI% I(T
$
-S
CC )4ecute the %)')T) statement.
%)')T) F*F& Duman*esources.MobCandidate
.D)*) MobCandidateI% K JCandidateI%P
CCCCCCCCmissing lineCCCCCCCCC
?)GI(
CC *eturn 99 to the calling program to indicate failure.
P*I(T (@-n error occurred deleting the candidate information.@P
*)T,*( 99P
)(%
)'S)
?)GI(
CC *eturn : to the calling program to indicate success.
P*I(T (@The Aob candidate has been deleted.@P
*)T,*( :P
)(%P
GF
.hich of the following is the correct statement that can be fitted in the CCCmissing line CCCCC/
1. 3F >>+**,* ;< 0
2. IF JJ)**F* K :
0. IF )**F* K :
1. IF )**F* T> :
118. Consider the following statement:
C*)-T) P*FC create=other=proc as
)I)C#@C*)-T) P*FC get=au=name as
Select au=name from authors
*)T,*(@$
.hat is the outcome of the abo!e when create=other=proc is e4ecuted/
1. Creates a new proc get=au=name and deletes the proc create=other=proc
2. Gi!es e4ecution error
0. Creates a new proc get=au=name
1. None of te listed options
119. Consider a table @employees@ and a stored procedure @sp=process@
The following statements are e4ecuted:
S)')CT O from employees
sp=process
.hat is the outcome of the abo!e e4ecution/
1. The S)')CT statement does not e4ecute but stored procedure sp=process e4ecutes
2. Te S+(+)T statement e"e!utes #ut stored pro!edure sp_pro!ess does not e"e!ute
0. ?oth S)')CT and stored procedure sp=process fail to e4ecute
1. ?oth S)')CT and stored procedure sp=process e4ecute successfully
12:. Consider a table @employees@ and a stored procedure @sp=process@
The following statements are e4ecuted:
S)')CT O from employees
)I)C sp=process
.hat is the outcome of the abo!e e4ecution/
1. The S)')CT statement does not e4ecute but stored procedure sp=process e4ecutes
2. The S)')CT statement e4ecutes but stored procedure sp=process does not e4ecute
0. ?oth S)')CT and stored procedure sp=process fail to e4ecute
1. Bot S+(+)T and stored pro!edure sp_pro!ess e"e!ute su!!essfully
121. Consider the following stored procedure creation:
CREATE proc sp_create_staff
AS
EXEC sp_use_jos
!t so happens that the user "issed creating the stored procedure sp_use_jos in the dataase.
#hat will e the outco"e of the create procedure sp_create_staff as ao$e%
a. The sp_create_staff procedure is not created due to se$ere error
. The sp_create_staff procedure is created with a warning error
c. The sp_create_staff procedure is created without an& 'ind of errors
d. The sp_use_jos procedure is auto"aticall& created efore sp_create_staff procedure is created
e. onl& warning error if another stored procedure oject is "ising
Ans :
122. Consider the following state"ents:
CREATE (R)C "&proc *par"1 int + 1,,- *par"2 int + 2,,- *par". int + .,,
AS
////processing done here
RET0R1
The ao$e (R)C is e2ecuted twice as elow:
13 EXEC "&proc
23 EXEC "&proc *par"1 + 4E5A06T- *par"2 + 7- *par". + 8
#hat are the $alue of para"eters passed to "&proc in oth the cases%
a. #ith 13 par"1 + ,- par"2 + ,- par". + ,
#ith 23 par"1 + 1,,- par"2 + 7- par". + 8
. #ith 13 9i$es error due to incorrect para"eter passing
#ith 23 par"1 + 1,,- par"2 + 7- par". + 8
c. #ith 13 par"1 + 1,,- par"2 + 2,,- par". + .,,
#ith 23 par"1 + 1,,- par"2 + 7- par". + 8
d. #ith 13 par"1 + 1,,- par"2 + 2,,- par". + .,,
#ith 23 par"1 + ,- par"2 + 7- par". + 8
e. #ith 13 par"1 + 1,,- par"2 + 2,,- par". + .,,
#ith 23 9i$es error due to in$alid para"eter passing
f. default para"eters in first case and second case onl& par"1 is default
Ans : c
12..
Consider the following :
CREATE proc ad$ance_range
:*low "one&- *high "one&3
#!T; REC)<(!6E
AS
SE6ECT = 5R)< do.titles
where ad$ance etween *low and *high
RET0R1
#hich of the following are $alid wa&s of e2ecuting the ao$e proc in case reco"pilation of >uer& plan is re>uired efore e2ecuting%
:Choose 23
12?.Consider the following :
4EC6ARE *a$g1 "one&-
4EC6ARE *a$g2 "one&-
4EC6ARE *a$g. "one&
SE6ECT *a$g1 + do.a$erageoo'price:@co"puters@3
SET *a$g2 + do.a$erageoo'price:@co"puters@3
EXEC *a$g2 + do.a$erageoo'price @co"puters@
SE6ECT *a$g1 as a$g1- *a$g2 as a$g2- *a$g. as a$g.
9)
Assu"e that a$erageoo'price is a user defined scalar function that returns a $alue of 1,,.,A for @co"puters@
which of the following is a correct state"ent%
a. a$g1 will e 1,,.,A- a$g2 will e 1,, and a$g. will e 1,,.1,
. a$g1 will e 1,,.,A- a$g2 will e 1,,.,A and a$g. will e 1,,.,A
c. a$g1 will e 1,,- a$g2 will e 1,,.,A and a$g. will e 1,,.1,
d. a$g1 will e 1,,.1,- a$g2 will e 1,, and a$g. will e 1,,.,A
e. a$g1 will e 1,,- a$g2 will e 1,, and a$g. will e 1,,
f. All the three are e>ui$alent and perfor" sa"e function
Ans :
127. Consider the following :
4EC6ARE *a$g1 "one&-
SET *a$g1 + a$erageoo'price:@co"puters@3
SE6ECT *a$g1 as a$g1
9)
Assu"e that a$erageoo'price is a user defined scalar function that returns a $alue of 1,,.,A for @co"puters@
which of the following is a correct state"ent%
a. a$g1 will e displa&ed as 1,,
. a$g1 will e displa&ed as 1,,.,A
c. There will e e2ecution error in the state"ents
d. a$g1 will e displa&ed as 1,,.1,
e. since the sche"a na"e is "issing- there will e e2ecution error
f. since the sche"a na"e is "issing- there will e e2ecution error
Ans : c
128. Consider the following e2a"ple of a "ulti/state"ent tale $alued function in which so"e i"portant state"ents are "issing:
CREATE 501CT!)1 a$erageprice&t&pe:* price "one& + ,.,
RET0R1S *tale
AS
!nsert *tale
SE6ECT t&pe- a$g:isnull:price- ,33 as a$g_price
5R)< titles
9R)0( BC t&pe
;AD!19 a$g:isnull:price- ,3 E *price
RET0R1
#hich of the following e2plains the "issing state"ents to e included in ao$e%:Choose 23
a. !nclude BE9!1F.E14 as wrappers around the state"ents the function contains.
. !nclude the clause @<06T!/STATE<E1T TAB6E@ in the CREATE state"ent
c. !nclude 4)F.E14 as wrappers around the state"ents the function contains.
d. 4efine the structure of the tale rowset that &ou are returning
e. egin end is a "ust for "ulti st"t tale function- also tale structure definition
Ans : a
12G.Consider the following e2a"ple of a "ulti/state"ent tale $alued function:

CREATE 501CT!)1 a$erageprice&t&pe:* price "one& + ,.,
RET0R1S *tale tale:t&pe $archar:123 null- a$g_price "one& null3
AS
BE9!1
!insert *tale
SE6ECT t&pe- a$g:isnull:price- ,33 as a$g_price
5R)< titles
9R)0( BC t&pe
;AD!19 a$g:isnull:price- ,3 E *price
RET0R1
E14
#hich of the following e2a"ple is correct to in$o'e the ao$e function%
a. Select = fro" "ulti/state"ent tale function a$erageprice&t&pe:173
. Select = fro" a$erageprice&t&pe:173
c. Select = fro" a$erageprice&t&pe:173 using "ulti/state"ent tale function
d. Select = fro" function a$erageprice&t&pe:173
e. si"ple reference to function is enough to use it
Ans :
12H. Consider the following e2a"ple of a "ulti/state"ent tale $alued function:

CREATE 501CT!)1 a$erageprice&t&pe:* price "one& + ,.,
RET0R1S *tale tale:t&pe $archar:123 null- a$g_price "one& null3
with sche"ainding
AS
BE9!1
!insert *tale
SE6ECT t&pe- a$g:isnull:price- ,33 as a$g_price
5R)< titles
9R)0( BC t&pe
;AD!19 a$g:isnull:price- ,3 E *price
RET0R1
E14
The following co""and is issued on the tale @titles@ that is used in the function ao$e:
A6TER tale titles alter colu"n price s"all"one& null
#hich of the following happens upon e2ecuting the A6TER co""and%
a. The A6TER co""and fails
. The price colu"n is changed
c. The price colu"n is changed onl& if no user is using the a$erageprice&t&pe function when the A6TER co""and is issued
e. 1one of the listed options
d. cannot alter when the colu"n is used in a function

Ans : a
12A.Consider the following 5unction:
CREATE 501CT!)1 stripti"e:*dateti"e$al dateti"e3
RET0R1S dateti"e
#!T; RET0R1S 1066 )1 1066 !1(0T
AS
BE9!1
4EC6ARE *date$al dateti"e
SE6ECT *date$al + con$ert:char:1,3- isnull*dateti"e$al3- getdate:33- 11,3
RET0R1 *date$al
E14
#hich of the following happens when the ao$e function is in$o'ed with 1066 input%
a. The 501CT!)1 od& gets e2ecuted and 1066 is returned as result
. The 501CT!)1 od& does not get e2ecuted and the $alue of 1066 is returned
c. The 501CT!)1 returns error if input is 1066
e. 1one of the listed options
Ans :
1.,.Consider the following function creation:
CREATE 501CT!)1 do.getonl&date:3
RET0R1S dateti"e
as
BE9!1
4EC6ARE *date dateti"e
SET *date + do.stripti"e:getdate:33
RET0R1 *date
E14
Assu"e @stripti"e@ is another function alread& created.
#hich of the following state"ent is correct for the ao$e create function%
a. The CREATE function is not $alid and gi$es error
. The CREATE function is $alid ut will gi$e e2ecution error that stripti"e is not found
c. The CREATE function is $alid and will not gi$e an& e2ecution error on e2istence of stripti"e function.
d. 1one of the listed options
e. one function can call another / nesting
ans : c
1.1.Consider the following function creation:
CREATE 501CT!)1 do.getonl&date:3
RET0R1S dateti"e
as
BE9!1
4EC6ARE *date dateti"e
SET *date + getdate:3
RET0R1 *date
E14
#hich of the following happens due to the use of non/deter"inistic function getdate:3 in the ao$e 045%
a. The CREATE function is not $alid and gi$es error
.The CREATE function is $alid ut will gi$e e2ecution error ecause of use of non/deter"inistic function getdate:3
c. The CREATE function is $alid and will not gi$e an& e2ecution error on use of getdate:3
d. 1one of the listed options
e. getdate:3 $alid uilt in non/deter"inistic function to e used
Ans : c
1.2. Consider the following function creation:
CREATE 501CT!)1 do.getonl&date:3
RET0R1S dateti"e
as
BE9!1
4EC6ARE *date dateti"e- *rando"data int
SET *date + getdate:3
SET *rando"data + rand:3
RET0R1 *date
E14
#hich of the following happens due to the use of non/deter"inistic functions getdate:3 and rand:3 in the ao$e 045%
a. The CREATE function is not $alid and gi$es error
. The CREATE function is $alid ut gi$es e2ecution error on use of rand:3
c. The CREATE function is $alid ut gi$es e2ecution error on use of getdate:3
d. 1one of the listed options
e.rand:3 is not a $alid uiltin non/deter"inistic function that can e used
Ans : a
1... Consider the following function:
CREATE 501CT!)1 a$erageprice&t&pe:*price "one& + ,.,3
RET0R1S TAB6E
AS
RET0R1 :SE6ECT t&pe- a$g:isnull:price- ,33 as a$g_price
5R)< titles
9R)0( BC t&pe
;AD!19 a$g:isnull:price- ,33 E *price3
#hich of the following state"ent is correct for the function ao$e%
a. !t creates a $alid in/line tale $alued function
. Create fails ecause it is an in$alid t&pe of tale $alued function
c. Create fails ecause it is an in$alid t&pe of scalar function
d. 1one of the listed options
e. inline tale function $alid t&pe
Ans : a
1.?.Consider the following se>uence of co""ands for functions:
CREATE 501CT!)1 a$erageprice&t&pe:*price "one& + ,.,3
RET0R1S TAB6E
AS
RET0R1 :SE6ECT t&pe- a$g:isnull:price- ,33 as a$g_price
5R)< titles
9R)0( BC t&pe
;AD!19 a$g:isnull:price- ,33 E *price3
A6TER 501CT!)1 a$erageprice&t&pe:*price "one& + ,.,3
RET0R1S *tale tale:t&pe $archar:123 null- a$g_price "one& null3
AS
BE9!1
!insert *tale
SE6ECT t&pe- a$g:isnull:price- ,33 as a$g_price
5R)< titles
9R)0( BC t&pe
;AD!19 a$g:isnull:price- ,33 E *price
RET0R1
E14
#hich of the following state"ent is correct for the ao$e state"ents%
a.The CREATE fails ut A6TER succeeds
.The CREATE succeeds ut A6TER fails
c. Both CREATE and A6TER fails
d. CREATE and A6TER go through successfull&
e.cannot "odif& function fro" inline to "ulti tale
Ans :
1.7. Consider the following se>uence of co""ands for functions:
CREATE 501CT!)1 a$erageprice&t&pe:*price "one& + ,.,3
RET0R1S TAB6E
AS
RET0R1 :SE6ECT t&pe- a$g:isnull:price- ,33 as a$g_price
5R)< titles
9R)0( BC t&pe
;AD!19 a$g:isnull:price- ,33 E *price3
A6TER 501CT!)1 a$erageprice&t&pe:*price "one& + ,.,3
RET0R1S TAB6E
AS
RET0R1 :SE6ECT t&pe- a$g:isnull:price- ,33 as a$g_price
5R)< titles
9R)0( BC t&pe
;AD!19 a$g:isnull:price- ,33 I *price3
#hich of the following state"ent is correct for the ao$e state"ents%
a.The CREATE fails ut A6TER succeeds
.CREATE and A6TER go through successfull&
c. can "odif& inline function st"ts
d. Both CREATE and A6TER fails
e.CREATE and A6TER go through successfull&
Ans :
1.8. Consider the creation of following stored procedure:
CREATE proc chec'_user_who
#!T; EXEC0TE AS @Sunil@
AS
SE6ECT user_na"e:3 as @0ser na"e applicale@
9)
The following state"ents are e2ecuted:
SE6ECT user_na"e:3 as @0ser na"e applicale@
EXEC chec'_user_who
#hat is the result of SE6ECT in se>uence when the ao$e state"ents are e2ecuted%
a.0ser na"e applicale / do
0ser na"e applicale / Sunil
. 0ser na"e applicale / do
0ser na"e applicale / do
c. 0ser na"e applicale / Sunil
0ser na"e applicale / do
d.0ser na"e applicale / Sunil
0ser na"e applicale / Sunil
e. e2ecte as o$errides the user na"e to sunil
1.G.Consider the following stored procedure creation:
CREATE proc sp_chec'_authors
AS
SE6ECT au_id- au_na"e- au_last_title 5R)< authors
#;ERE au_id E 1,,1
9)
!t so happens that the authors tale is dropped and no longer e2ists in the dataase.
#hat will e the outco"e of the create procedure sp_chec'_authors as ao$e%
a. The sp_chec'_authors procedure is not created due to se$ere error
. The sp_chec'_authors procedure is created with a warning error
c. The sp_chec'_authors procedure is created without an& 'ind of errors
d. The authors tale is auto"aticall& created efore sp_chec'_authors procedure is created
e. dela&ed resolution is per"itted- no error during create for tale ojects
Ans : c
1.H. Consider the following stored procedure creation:
CREATE proc sp_chec'_authors
AS
SE6ECT au_id- au_na"e- au_last_title 5R)< authors
#;ERE au_id E 1,,1
9)
!t so happens that the authors tale is dropped and no longer e2ists in the dataase.
1ow the following state"ent is issued
EXEC sp_chec'_authors
9)
#hat will e the outco"e of the ao$e create and e2ecution state"ents%
a. Both Create and e2ecution fails
. Create fails ut e2ecution goes through without errors
c. Both Create and e2ecution goes through without errors
d. Create is successful ut e2ecution gi$es error
e. since dela&ed resolution is possile create goes through- ut e2ecution gi$es error on "issing tale authors
Ans : d
1.A.Consider the following stored procedure creation:
CREATE proc sp_chec'_authors
AS
BE9!1
SE6ECT au_id- au_na"e- au_last_title 5R)< authors
#;ERE au_id E 1,,1
RET0R1
9)
1ow the following state"ents are issued :
EXEC sp_helpte2t sp_chec'_authors
9)
SE6ECT definition 5R)< s&s.s>l_"odules
#;ERE oject_id + oject_id:@sp_chec'_authors@3
9)
SE6ECT oject_definition :oject_id:@do.sp_chec'_authors@33
9)
#hat will e the outco"e of the ao$e state"ents issued%
a. The source code of the stored procedure sp_chec'_authors is displa&ed 2 ti"es
. The source code of the stored procedure sp_chec'_authors is displa&ed once
c. The source code of the stored procedure sp_chec'_authors is displa&ed once
d. The source code of the stored procedure sp_check_authors is displayed 3 times
e. All three st"ts can e used to displa& source code- so . ti"es
Ans : d
1?,. Consider the following state"ents:
A6TER (R)C insert_ite"s *ite"_id char:?3-
*ite"_na"e $archar:?,3
as
BE9!1 TRC
!1SERT !1T) co"p1.do.ite""aster
:ite"_id- ite"_na"e3
DA60ES:*ite"_id- *ite"_na"e3
print J1ew !te" addedK
E14 TRC
BE9!1 CATC;
e2ec error_handler
RET0R1 /1,1
E14 CATC;
RET0R1 ,
#hat is the return code if the following state"ent is e2ecuted%
EXEC insert_ite"s JABC4E59;K- J9ear Asse"l&K
a. ,
b.-101
c. 1066
d. /1
e. 1one of the listed options
Ans :
111. Consider the following statements:
C*)-T) P*FC sales=till=date
Jtitle !archar#1::$+ Jytd=sales int F,TP,T
-S
S)')CT Jytd=sales K ytd=sales
F*F& titles
where title K Jtitle
*)T,*(
The abo!e proc is e4ecuted as follows:
%)C'-*) Jsales=upto=today int
)I)C sales=till=date @&y e4periments with truth@+ Jsales=upto=today
Print @Sales this year until today :@ ; CF(3)*T#!archar#1:$+ Jsales=upto=today
.hat is the outcome of e4ecuting as abo!e/
-ns:
a) 1
b$ C1:1
c$ null
d$ C1
e$ (one of the abo!e
112. Consider the following statements:
C*)-T) P*FC sales=till=date
Jtitle !archar#1::$+ Jytd=sales int F,TP,T
-S
S)')CT Jytd=sales K ytd=sales
F*F& titles
where title K Jtitle
*)T,*(
The abo!e proc is e4ecuted as follows:
%)C'-*) Jsales=upto=today int
)I)C sales=till=date @&y e4periments with truth@+ Jsales=upto=today
Print @Sales this year until today :@ ; CF(3)*T#!archar#1:$+ Jsales=upto=today
.hat is the outcome of e4ecuting as abo!e/
a$ The year to date sales as pic"ed up from the titles table will be correctly displayed for the boo" @&y
e4periments with truth@
b) &he year to date sales as pic#ed up from the titles table will not be correctly displayed for the
boo# B4y e'periments with truthB (not sure with this answer I it was not mar#ed yellow but the
field was mar#ed JFK)
c$ The P*FC will gi!e error while e4ecuting
d$ (one of the listed options
110. Consider the following statements:
-ssume table @titles@ e4ists with following boo"s only:
'ife without fear
&y e4periments with truth
Gone with the wind
C*)-T) P*FC ytd=sales2 Jtitle !archar#8:$
-S
IF (FT )IISTS #S)')CT O F*F& titles .D)*) title K Jtitle$
*)T,*( C111
S)')CT ytd=sales
from titles where title K Jtitle
*)T,*(
GF
The abo!e P*FC is e4ecuted as follows:
%)C'-*) Jstatus I(T
)I)C Jstatus K ytd=sales2 @'ife without fear@
IF Jstatus K C111
P*I(T @(o boo" with that name found@
GF
)I)C Jstatus K ytd=sales2 @,ndefeated@
GF
)I)C Jstatus K ytd=sales2 @Gone with the wind@
IF Jstatus K C111
P*I(T @(o boo" with that name found@
GF
Dow many times the message @(o boo" with that name found@@ will be displayed for the abo!e scenario/
a$ once
b$ twice
c) none
d$ thrice
111. Consider the following statements:
C*)-T) P*FC pub=test
-S
S)')CT pub=id+ pub=name+ city+ statecd
into UUtemp
from publishers
where statecd in #@&D@+ @-P@+ @T(@$
S)')CT pub=id+ pub=name+ city+ statecd
into Utemp
from publishers
where statecd in #@&D@+ @-P@+ @T(@$
GF
The following se5uence of e4ecution statements are made:
)I)C pub=test
GF
S)')CT O from UUtemp CCCCC1
S)')CT O from Utemp CCCCC2
)I)C pub=test
GF
S)')CT O from UUtemp CCCCCC0
.hat is the correct se5uence of outcome on e4ecuting the S)')CT statements mar"ed 1+2 0 as abo!e/
a$ 1$ The contents of temp table are correctly displayed
2$ The contents of temp table are correctly displayed
0$ )rror message displayed
b$ 1$ )rror message displayed
2$ The contents of temp table are correctly displayed
0$ )rror message displayed
c) 1) &he contents of temp table are correctly displayed
!) /rror message displayed
%) /rror message displayed
d$ 1$ The contents of temp table are correctly displayed
2$ )rror message displayed
0$ The contents of temp table are correctly displayed
112. Consider the following statements:
C*)-T) P*FC pub=test
-S
S)')CT pub=id+ pub=name+ city+ statecd
into UUtemp
from publishers
where statecd in #@&D@+ @-P@+ @T(@$
S)')CT pub=id+ pub=name+ city+ statecd
into Utemp
from publishers
where statecd in #@&D@+ @-P@+ @T(@$
GF
The following se5uence of e4ecution statements are made:
)I)C pub=test
GF
S)')CT O from UUtemp CCCCCCC 1
S)')CT O from Utemp CCCCCCC 2
%*FP table UUtemp
)I)C pub=test
GF
S)')CT O from UUtemp CCCCCCCC 0
.hat is the correct se5uence of outcome on e4ecuting the S)')CT statements mar"ed 1+2+0 as abo!e/
a$ 1$ The contents of temp table are correctly displayed
2$ The contents of temp table are correctly displayed
0$ )rror message displayed
b$ 1$ )rror message displayed
2$ The contents of temp table are correctly displayed
0$ )rror message displayed
c$ 1$ The contents of temp table are correctly displayed
2$ )rror message displayed
0$ )rror message displayed
d) 1) &he contents of temp table are correctly displayed
!) &he contents of temp table are correctly displayed
%) &he contents of temp table are correctly displayed
116. Consider the following scenario e4ample:
C*)-T) P*FC find=boo"s=by=type Jtypelist !archar#8:::$
-S
)I)C#@select title=id+ title K substring#title+ 1+ 1:$+ type+ price
F*F& titles where type in #@; Jtypelist ; @$ order by type+ title=id@$
GF
set 5uoted=identifier off
The stored procedure is e4ecuted as below:
)I)C find=boo"s=by=type V@business@+ @mod=coo"@+ @trad=coo"@V
GF
.hich of the following are correct statements for the abo!e scenario/#Choose 2$
a$ The nested stored procedure concept is used
b) Dariable list of values can be passed into the stored procedure
c) )t uses dynamic s9l 9uery within a stored procedure
d$ Fnly three !alues can be passed into the stored procedure
117. Consider the following Stored procedures created:
C*)-T) P*FC get=titles=data=by=price#Jflag tinyint+ J!alue money$
-S
select O from titles where price K J!alue
GF
C*)-T) P*FC get=titles=data=by=ad!ance#Jflag tinyint+ J!alue money$
-S
select O from titles where ad!ance K J!alue
GF
C*)-T) P*FC get=titles=data#Jflag tinyint+ J!alue money$
-S
if Jflag K 1
e4ec get=titles=data=by=price J!alue
else
e4ec get=titles=data=by=ad!ance J!alue
.hich of the following stored procedure is functionally e5ui!alent to the abo!e set of stored procedures/
a$ C*)-T) P*FC get=titles=data=by=price#Jflag tinyint+ J!alue money$
-S
e4ec get=titles=data J!alue
GF
C*)-T) P*FC get=titles=data=by=ad!ance#Jflag tinyint+ J!alue money$
-S
e4ec get=titles=data J!alue
GF
C*)-T) P*FC get=titles=data#Jflag tinyint+ J!alue money$
-S
if Jflag K 1
e4ec get=titles=data=by=price J!alue
else
e4ec get=titles=data=by=ad!ance J!alue
b$ C*)-T) P*FC get=titles=data#Jflag tinyint+ J!alue money$
-S
Select O from titles where price K J!alue or ad!ance K J!alue
c) "./A&/ 5.O" get-titles-data(Hflag tinyint, Hvalue money)
AS
if Hflag A 1
select @ from titles where price A Hvalue
else
select @ from titles where advance A Hvalue
d$ (one of the listed options
118. Consider the following statements:
C*)-T) P*FC myproc Jparm1 int1+ Jparm2 int+ Jparm0 int
-S
CCCCprocessing done here
*)T,*(
The abo!e P*FC is e4ecuted twice as below:
1$ )I)C myproc
2$ )I)C myproc Jparm1 K 6
.hat is the outcome of e4ecuting the abo!e /
a$ .ith 1$ Gi!es error C Procedure @myproc@ e4pects parameter @Jparm1@+ @Jparm2@+ @Jparm0@ which was
not supplied
.ith 2$ parameters passed: parm1 K 6+ parm2 K :+ parm0 K :
b) :ith 1) +ives error 0 5rocedure BmyprocB e'pects parameter BHparm1B which was not supplied
:ith !) +ives error 0 5rocedure BmyprocB e'pects parameter BHparm!B which was not supplied
c$ .ith 1$ parameters passed: parm1 K :+ parm2 K :+ parm0 K :
.ith 2$ Gi!es error C Procedure @myproc@ e4pects parameter @Jparm2@ which was not supplied
d$ .ith 1$ parameters passed: parm1 K :+ parm2 K :+ parm0 K :
.ith 2$ parameters passed: parm1 K 6+ parm2 K :+ parm0 K :
119. Consider the following stored procedures:
C*)-T) proc main=proc
-S
e4ec sub=proc1
e4ec sub=proc0
e4ec sub=proc2
return
go
C*)-T) proc sub=proc1
-S
e4ec sub=proc2
go
C*)-T) proc sub=proc2
-S
e4ec proc sub=proc0
return
C*)-T) proc sub=proc0
-S
e4ec sub=proc1
return
.hat will be the outcome upon in!o"ing )I)C main=proc/
a$ sub=proc1 will be e4ecuted only once
b$ sub=proc2 will be e4ecuted 0 times
c$ sub=proc0 will be e4ecuted 2 times
d$ sub=proc1+ sub=proc2+ sub=proc0 will be e4ecuted 02 times each
e) 7one of the listed options
12:. Consider the following stored procedure:
C*)-T) P*FC)%,*) Select?yId'ist
#JproductIds 4ml
$
-S
%)C'-*) JProducts T-?') #I% int$
I(S)*T I(TF JProducts #I%$ S)')CT Param3alues.I%.!alue#@.@+@3-*CD-*#2:$@$
F*F& JproductIds.nodes#@LProductsLid@$
as Param3alues#I%$
S)')CT O F*F& ProductsI(()* MFI( JProducts pF( Products.ProductI% K p.I%
.hich of the following is the correct way to call the abo!e stored procedure and pass !alues/
a) /2/" Select(y)d*ist Hproduct)dsABL5roductsMLidM%LNidMLidM>LNidMLidM1=LNidMLN5roductsMB
b$ )I)C Select?yId'ist JproductIdsK@P::1@
c$ )I)C Select?yId'ist JproductIdsK@P::1@ and productIdsK@P::2@
d$ )I)C Select?yId'ist
121. .hich of the following is the Dighest isolation le!el in S<' Ser!er 2::2/
a$ *ead uncommitted
b$ *ead Committed
c$ *epeatable *ead
d) Seriali$able
122. %istributed 5ueries allow you to collect and manipulate data from ==========================
a$ more than one table in a database
b$ multiple S<' Ser!er databases on a ser!er
c) multiple O*/ ( datasources
d$ (one of the listed options
120. Bou are writing a distributed 5uery to 5uery data from another S<' Ser!er database.
.hat is the fully 5ualified naming con!ention/
a) lin#ed-server-name.database.owner.table
b$ lin"ed=ser!er=name.database.table
c$ lin"ed=ser!er=nameWtable
d$ database.table
121. Bou are writing a distributed 5uery to 5uery data from an -ccess database.
.hat is the fully 5ualified naming con!ention/
a$ -ccess=ser!er=name.database.owner.table
b$ -ccess=ser!er=name.owner.table
c) Access-server-name...table
d$ (one of the listed options
122. - distributed transaction is encompassing three different database ser!ers. -t the end of prepare
phase in a twoCphase commit+ two ser!ers reported successful prepare while one reported failure to
prepare.
Dow would the transaction manager respond/
a) )t sends a .ollbac# command to all three resource managers
b$ It sends a rollbac" command to the ser!er that reported a failure to prepare
c$ Commit is issued as maAority of ser!ers reported successful prepare
d$ (ame of the ser!er which failed to prepare+ is logged for repair wor" by %?-
126. Consider the following scenario.
Bour S<' ser!er has a lin" to an Fracle database Fra=db running on Fra=lin"ed=ser!er. The schema
definition of Fra=db has undergone a change.
.hat will be the impact/
a$ Fra=db is delin"ed from the S<' ser!er
b) &he changes of Ora-db are notified to the S,* server
c$ The databases become semiClin"ed
d$ (one of the listed options
127. .hich of the following the datasource must conform to in order to be a lin"edser!er/
a$ It must be a S<' Ser!er 2::2
b$ It must be a database supplied by &icrosoft #eg.+ -ccess+ )4cel$
c) )t must be a O*/ ( compliant data source
d$ It must be a *elational %atabase
128. .hich of the following is the use of sp=lin"edser!ers command/
a$ It allows you to define a lin"ed ser!er on the local ser!er
b) )t allows you to display the list of lin#ed servers defined on the local server
c$ It allows you to specify a login id that lin"s the ser!ers
d$ It acti!ates the lin" between the ser!ers
129. For which of the following is a twoCphase commit+ consisting of prepare and commit used/
a$ Transactions that might re5uire a rollbac"
b$ Transactions updating multiple tables
c) istributed transactions
d$ Transactions re5uiring user confirmation of update
16:. .hich of the following is correct for a shared loc"/
a$ It is a loc" ac5uired by a process on the resources that it intends to modify
b$ It is a loc" ac5uired by a process on a resource prior to modifying it
c) )t is loc# ac9uired by a process on a resource for the duration of read
d$ (one of the listed options
1?1. - transaction attempting to modify data on a row or page on which a shared loc" is placed can
ac5uire an e4clusi!e loc" on the resource. State True or False.
T*,)
FA*S/
1?2. .hen a S)')CT O command is e4ecuted on a table+ when is the shared loc" on the first row
released/
-fter all the rows are read
After the first row is read
-fter the second row is read
Fnly when the transaction is committed or rolled bac"
1?5. - transaction attempting to modify data on a row or page on which a shared loc" is placed can
ac5uire an update loc" on the resource. State True or False.
&.3/
F-'S)
1?@. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
S)')CT title F*F& boo" where id K 2P
,ser2 has now issued the following commands
S)')CT title F*F& boo" where id K 2P
.hat will be the outcome/
,ser2 will be bloc"ed
3ser! will not be bloc#ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
1?A. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
S)')CT title F*F& boo" .ITD #,P%'FCE$ where id K 2P
,ser2 has now issued the following commands
S)')CT title F*F& boo" where id K 2P
.hat will be the outcome/
,ser2 will be bloc"ed
3ser! will not be bloc#ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
(o bloc" because ,pdate loc" is compatible with Shared loc"
1??. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
S)')CT title F*F& boo" .ITD #,P%'FCE$ where id K 2P
,ser2 has now issued the following commands
S)')CT title F*F& boo" .ITD #,P%'FCE$ where id K 2P
.hat will be the outcome/
3ser! will be bloc#ed
,ser2 will not be bloc"ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
Fnly one transaction can ha!e the update loc" on row 2.
1?B. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
S)')CT title F*F& boo" .ITD #,P%'FCE$ where id K 2P
,ser2 has now issued the following commands
S)')CT title F*F& boo" .ITD #,P%'FCE$ where id K 0P
.hat will be the outcome/
,ser2 will be bloc"ed
3ser! will not be bloc#ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
(o bloc" as the loc"s are on separate records
1?C. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
S)')CT title F*F& boo" where id K 2P
,ser2 has now issued the following commands
,P%-T) boo" S)T title K @*oses in %ecember+ Second edition@ .D)*) id K 2
.hat will be the outcome/
,ser2 will be bloc"ed
3ser! will not be bloc#ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
*ead Committed isolation le!el drops the shared loc" in Transaction - after the read.
1?D. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
,P%-T) boo" S)T title K @*oses in %ecember+ Second edition@ .D)*) id K 2
,ser2 has now issued the following commands
S)')CT title F*F& boo" .D)*) id K 2
.hat will be the outcome/
3ser! will be bloc#ed
,ser2 will not be bloc"ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
,ser2 cannot get the shared loc" on the "ey until ,ser1 gi!es up its e4clusi!e loc".
1B0. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
S)')CT title F*F& boo" .ITD #,P%'FCE+ DF'%'FCE$ .D)*) id K 2
,ser2 has now issued the following commands
S)')CT title F*F& boo" .D)*) id K 2
.hat will be the outcome/
,ser2 will be bloc"ed
3ser! will not be bloc#ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
,ser2 cannot get the shared loc" on the "ey until ,ser1 gi!es up its e4clusi!e loc".
1B1. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
S)')CT title F*F& boo" .ITD #,P%'FCE+ DF'%'FCE$
,ser2 has now issued the following commands
I(S)*T I(TF boo" 3-',)S#2+ @Darry Potter and the DalfCblood Prince@$
.hat will be the outcome/
3ser! will be bloc#ed
,ser2 will not be bloc"ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
1B2. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
S)')CT title F*F& boo" .ITD #,P%'FCE+ DF'%'FCE$ .D)*) title li"e @He4perimentsH@
,ser2 has now issued the following commands
I(S)*T I(TF boo" 3-',)S#6+ @Darry Potter and the DalfCblood Prince@$
.hat will be the outcome/
3ser! will be bloc#ed
,ser2 will not be bloc"ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
1B5. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a default isolation le!el of @*)-% CF&&ITT)%@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
%)')T) F*F& boo" .D)*) title li"e @He4perimentsH@
,ser2 has now issued the following commands
I(S)*T I(TF boo" 3-',)S#6+ @Darry Potter and the DalfCblood Prince@$
.hat will be the outcome/
,ser2 will be bloc"ed
3ser! will not be bloc#ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
1B@. Consider the following scenario:
- Table @boo"@ has the following records
id title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
1 &y e4periments with Truth
-ssume a Isolation le!el of @*)-%=CF&&ITT)%=S(-PSDFT@ for the following commands.
,ser1 has issued the following commands
?)GI( T*-(
,P%-T) boo" S)T title K @*oses in %ecember+ Second edition@ .D)*) id K 2
,ser2 has now issued the following commands
S)')CT title F*F& boo" .D)*) id K 2
.hat will be the outcome/
,ser2 will be bloc"ed
3ser! will not be bloc#ed and both will proceed
,ser1@s transaction is bloc"ed and user2 will proceed
There will be a deadloc"
1BA. Consider the following code:
?)GI( T*-(
%)')T) F*F& T-?')1
?)GI( T*-(
I(S)*T I(TF T-?')2
CF&&IT
,P%-T) T-?')0
CF&&IT
If the update to table0 failed+ what will be the outcome/
%)')T) from T-?')1 and I(S)*T into T-?')2 are committed
I(S)*T into T-?')2 alone is committed
7one of the changes to database are committed
(one of the listed options
1B?. The P'-B)* table contains these columns :
id int#9$
name !archar#2$
manager=id int#9$
In this instance+ managers are also players whom you need to display as a list.
)!aluate these T.F S<' statements:
Statement 1:
S)')CT p.name+m.name
F*F& player p+player m
.D)*) m.manager=idKp.idP
Statement 2:
S)')CT p.name+m.name
F*F& player p+player m
.D)*) m.manager=idKp.idP
.hich of the following is applicable for the abo!e statements/
Statement 1 will not e4ecute+ Statement 2 will e4ecute.
Statement 1 will e4ecute+ Statement 2 will not e4ecute.
Statement 1 is self Aoin+ Statement 2 is not a self Aoin.
&he results will be same but the display will be different.
The results of these 5ueries will be same+ Aust will loo" different. In first statement dri!ing column
is I%+ in second C&-(-G)*=I%.
1BB. The new Isolation le!el in S<' Ser!er 2::2 wherein the !alues that are accessed remain the same
till the transaction is Committed or *olled bac" is called ============.
*ead,ncommitted
Committed
SnapShot
Consistency
1BC. Consider the following construct:
.DI') #1K1$
?)GI(
P*I(T @I am here in one@
IF 1 K 1
?)GI(
P*I(T @I am here in two@
?*)-E
)(%
)'S)
?)GI(
CF(TI(,)
)(%
)(%
.hat is the outcome of e4ecuting the abo!e/
5rints B) am here in oneB
5rints B) am here in twoB
Prints @I am here in one@
Prints @I am here in two@
Prints @I am here in one@
Prints @I am here in two@
Prints @I am here in one@
Prints nothing
?*)-E will brea" the loop since 1 K 1
1BD. Consider the following construct:
.DI') #1K1$
?)GI(
P*I(T @I am here in one@
IF 1 K 1
?)GI(
P*I(T @I am here in two@
)(%
)'S)
?)GI(
CF(TI(,)
)(%
)(%
Dow many times the message @I am here in one@ will be printed on e4ecuting abo!e/
Fnce
2 times
ero times
0 times
7one of the listed options
)nd less loop
1C0. Consider the following statements as part of a stored procedure:
.-ITFF* %)'-B @:2::::22@
?)GI(
)I)C sp=process=total=one
.-ITFF* TI&) @:2::::22@
?)GI(
)I)C sp=process=total=two
)(%
Supposing the abo!e procedure is is run e4actly at midnight+ what is the e4pected outcome/
Procedure sp=process=total=two e4ecutes before sp=process=total=one
Procedure sp=process=total=one e4ecutes before sp=process=total=two
(oth procedures sp-process-total-one and sp0process-total-two get e'ecuted at same
time
Procedure sp=process=two will not get e4ecuted at all
Procedure sp=process=one will not get e4ecuted at all
wait for delay delays by 2 hrs 22 seconds + time fires at 22 seconds after 2 a.m+ so both fire at
same time
181 VConsider the following cursor processing:
%)C'-*) authors=cursor FF*.-*%=F('B FF*
S)')CT au=lname+ au=fname F*F& authors
F*%)* ?B au=lname+ au=fname
FP)( authors=cursor
F)TCD FI*ST F*F& authors=cursor
F)TCD *)'-TI3) 0 F*F& authors=cursor
F)TCD *)'-TI3) C2 F*F& authors=cursor
C'FS) authors=cursor
%)-''FC-T) authors=cursor
#-ssume that authors table has 2:: author profiles$
.hat is the outcome of e4ecuting the abo!e cursor statements/V
1 Three author profiles are retrie!ed from authors
2 Fne author profile is retrie!ed from authors
0 (o author profiles are retrie!ed from authors
< +ives e'ecution error cannot use relative, with forward-only cursor
182 Consider the following cursor processing:
%)C'-*) authors=cursor SC*F'' FF*
S)')CT au=lname+ au=fname F*F& authors
F*%)* ?B au=lname+ au=fname
FP)( authors=cursor
F)TCD ()IT F*F& authors=cursor
F)TCD -?SF',T) 2: F*F& authors=cursor
F)TCD *)'-TI3) 0 F*F& authors=cursor
F)TCD *)'-TI3) C7 F*F& authors=cursor
F)TCD FI*ST F*F& authors=cursor
C'FS) authors=cursor
%)-''FC-T) authors=cursor
#-ssume that authors table has 2:: author profiles$
Dow many uni5ue rows are retrie!ed upon e4ecuting the abo!e cursor statements/V
1 Fi!e
2 Four
0 Three
1 Si4
2 (one of the listed options
6 (e4t and first retri!e same rows
180Consider the following cursor processing statements:
%)C'-*) )mployee=Cursor C,*SF* *)-%=F('B FF*
S)')CT 'ast(ame+ First(ame+ status
F*F& dbo.)mployees
.D)*) 'ast(ame li"e @?H@
FP)( )mployee=Cursor
F)TCD ()IT F*F& )mployee=Cursor
P*I(T JJF)TCD=ST-T,S
.DI') JJF)TCD=ST-T,S K :
?)GI(
F)TCD ()IT F*F& )mployee=Cursor
P*I(T JJF)TCD=ST-T,S
)(%
C'FS) )mployee=Cursor
%)-''FC-T) )mployee=Cursor
#-ssume that the )mployees table has 2:: rows of employee data$
.hat is the !alue of JJF)TCD=ST-T,S printed in the last print statement as per abo!e/
1 :
2 1
% 01
1 2
181 VConsider the following cursor processing statements:
%)C'-*) Jcba C,*SF*
%)C'-*) abc C,*SF* G'F?-' SC*F'' FF*
S)')CT O F*F& authors
S)T Jcba K abc
FP)( abc
F)TCD ()IT F*F& Jcba
F)TCD ()IT F*F& abc
F)TCD ()IT F*F& Jcba
C'FS) Jcba
%)-''FC-T) abc
In case the authors table had 1:: author profiles+ how many authors will get retrie!ed as per abo!e
processing/V
1 Two
2 &hree
0 Fne
1 (one
2 Gi!es error message both cursor and cursor !ariable used interchangeably
182 Consider the following cursor processing statements:
%)C'-*) )mployee=Cursor C,*SF* F-ST=FF*.-*% FF*
S)')CT 'ast(ame+ First(ame+ status
F*F& dbo.)mployees
.D)*) 'ast(ame li"e @?H@
FF* ,P%-T)
FP)( )mployee=Cursor
F)TCD ()IT F*F& )mployee=Cursor
.DI') JJF)TCD=ST-T,S K :
?)GI(
%)')T) )mployees .D)*) current of )mployee=Cursor
F)TCD ()IT F*F& )mployee=Cursor
)(%
C'FS) )mployee=Cursor
%)-''FC-T) )mployee=Cursor
#-ssume that the )mployees table has 2:: rows of employee data$
.hat is the outcome of the abo!e cursor processing/V
1 -ll employees whose lastname starts with @?@ are deleted
2 The last employee with lastname starting with @?@ alone is deleted
0 The first employee with lastname starting with @?@ alone is deleted
< +ives error message "annot updateNdelete with
fast-forward option
186 Consider the following statements:
.DI') #1K1$
?)GI(
.-ITFF* TI&) @:1:::@
)I)C sp=update=stats
*-IS)**F*#@Statistics updated for database@+1+1$ .ITD 'FG
)(%
.hat is the outcome of the abo!e/V
1 O1) 3pdates the statistics for every table in the database every night at 1 A.4
!) :rite a log entry to both S,* Server log and :indows 7& application logO
2 1$ ,
pdates the statistics for e!ery table in the database only once at 1 -.&
2$ .rite a log entry to both S<' Ser!er log and .indows (T application logV
0 1$ ,pdates the statistics for e!ery table in the database only once at 1 -.&
1 Gi!es error message while loop "eeps it running+ and waitfor time will
ma"e sure at 1 am the update is done
187 Consider the following cursor processing statements:
%)C'-*) authors=cursor C,*SF* FF*
S)')CT au=id+ au=fname+ au=lname
F*F& authors
.D)*) state K @,T@
F*%)* ?B au=id
FP)( authors=cursor
IF JJC,*SF*=*F.S K :
)(%
F)TCD ()IT F*F& authors=cursor
IF JJF)TCD=ST-T,S K C1
P*I(T @(F *F.S FF,(%@
)(%
.DI') JJF)TCD=ST-T,S K :
?)GI(
P*I(T @-T')-ST F() *F. FF,(% @
F)TCD ()IT F*F& authors=cursor
)(%
)(%
C'FS) authors=cursor
%)-''FC-T) authors=cursor
.hat is the message that gets printed in case the authors table does not ha!e any rows satisfying the
gi!en condition/V
1 Prints message @(F *F.S FF,(%@ B
2 Prints message @-T')-ST F() *F. FF,(%@
0 Prints no message B
1 +ives error message since cursor chec" does not do anything+
message dispalyed for fetch status chec"
188 Consider the following cursor processing statements:
%)C'-*) Jcba C,*SF*
%)C'-*) abc C,*SF* G'F?-' SC*F'' FF*
S)')CT O F*F& authors
FP)( abc
F)TCD ()IT F*F& Jcba
F)TCD ()IT F*F& abc
F)TCD ()IT F*F& Jcba
C'FS) Jcba
%)-''FC-T) abc
In case the authors table had 1:: author profiles+ how many authors will get retrie!ed as per abo!e
processing/V
1 Two
2 Three
0 Fne
1 (one
= +ives error message F Since cursor variable is not set to cursor , error
occurs
189 Consider the following statements:
S)')CT deptid+
name+
groupname+
C-S)
.D)( groupname K @&ar"eting@ TD)( @*oom 1@
.D)( groupname K @Duman *esources@ TD)( @*oom 2@
.D)( groupname K @Production@ TD)( @*oom 0@
)'S) @*oom 1@
)(%
F*F& hr.department
.hich of the following is correct e5ui!alent to the abo!e/V
1 OS/*/"& deptid,
name,
groupname,
"AS/ groupname
:6/7 B4ar#etingB &6/7 B.oom 1B
:6/7 B6uman .esourcesB &6/7 B.oom !B
:6/7 B5roductionB &6/7 B.oom %B
/*S/ B.oom <B
/7
F.O4 hr.departmentO B
2 S)')CT deptid+
name+
groupname+
C-S)
.D)( groupname @&ar"eting@ TD)( @*oom 1@
.D)( groupname @Duman *esources@ TD)( @*oom 2@
.D)( groupname @Production@ TD)( @*oom 0@
)'S) @*oom 1@
)(%
F*F& hr.departmentV
0 S)')CT deptid+
name+
groupname+
C-S) groupname
.D)( groupname @&ar"eting@ TD)( @*oom 1@
.D)( groupname @Duman *esources@ TD)( @*oom 2@
.D)( groupname @Production@ TD)( @*oom 0@
)'S) @*oom 1@
)(%
F*F& hr.departmentV
1 (one of the listed options
19: Consider the following scenario:
- proc is created as follows:
C*)-T) P*FC cursor=proc Jcursor C,*SF* 3-*BI(G F,TP,T
-S
%)C'-*) curs1 C,*SF* G'F?-'
FF* S)')CT cast#title as !archar#0:$$ as title+ pubdate from titles
set Jcursor K curs1
open curs1
return
go
(ow the following statements are e4ecuted:
%)C'-*) Jcurs C,*SF*
)I)C cursor=proc Jcursor K Jcurs output
fetch curs1
fetch Jcurs
close curs1
deallocate curs1
fetch Jcurs
open Jcurs
go
.hat is the outcome of the last fetch and open statements in abo!e/V
1 Fetch and Fpen both fail
2 Fetch fails but open succeeds B
0 Fetch succeeds but open fails
1 Fetch and open both succeed open succeeds since not fully
dealocated
191 Consider the following scenario:
- proc is created as follows:
C*)-T) P*FC cursor=proc Jcursor C,*SF* 3-*BI(G F,TP,T
-S
%)C'-*) curs1 C,*SF* G'F?-'
FF* S)')CT cast#title as !archar#0:$$ as title+ pubdate from titles
set Jcursor K curs1
open curs1
return
go
(ow the following statements are e4ecuted:
%)C'-*) Jcurs C,*SF*
)I)C cursor=proc Jcursor K Jcurs output
fetch curs1
fetch Jcurs
close curs1
deallocate curs1
fetch Jcurs
open Jcurs
fetch Jcurs
close Jcurs
deallocate Jcurs
open Jcurs
go
.hat is the outcome of the last fetch and open statements in the abo!e statements/V
1 Fetch and Fpen both fail
2 Fetch fails but open succeeds
0 Fetch succeeds but open fails B
1 Fetch and open both succeed since fully deallocated at the
end+ cannot open after that
192 Consider the following scenario:
- proc is created as follows:
C*)-T) P*FC cursor=proc Jcursor C,*SF* 3-*BI(G F,TP,T
-S
%)C'-*) curs1 C,*SF* G'F?-'
FF* S)')CT cast#title as !archar#0:$$ as title+ pubdate from titles
set Jcursor K curs1
open curs1
return
go
(ow the following statements are e4ecuted:
%)C'-*) Jcurs C,*SF*
)I)C cursor=proc Jcursor K Jcurs output
fetch curs1
fetch Jcurs
close curs1
deallocate curs1
deallocate curs
fetch Jcurs
open Jcurs
go
.hat is the outcome of the last fetch and open statements in the abo!e statements/V
1 Fetch and Open both fail B
2 Fetch fails but open succeeds
0 Fetch succeeds but open fails
1 Fetch and open both succeed since both references are deallocated+
cannot fetch or open
190 Consider the following scenario:
- proc is created as follows:
C*)-T) P*FC cursor=proc Jcursor C,*SF* 3-*BI(G F,TP,T
-S
%)C'-*) curs1 C,*SF* G'F?-'
FF* S)')CT cast#title as !archar#0:$$ as title+ pubdate from titles
set Jcursor K curs1
open curs1
return
go
(ow the following statements are e4ecuted:
%)C'-*) Jcurs C,*SF*
)I)C cursor=proc Jcursor K Jcurs output
fetch curs1
fetch Jcurs
close curs1
deallocate curs1
fetch Jcurs
open Jcurs
fetch Jcurs
close Jcurs
open Jcurs
go
.hat is the outcome of the last fetch and open statements in the abo!e statements/V
1 Fetch and Fpen both fail
2 Fetch fails but open succeeds
0 Fetch succeeds but open fails
1 Fetch and open both succeed B since not deallocated+ open
wor"s
191 Consider the following cursor processing:
%)C'-*) authors=cursor F-ST=FF*.-*% FF*
S)')CT au=lname+ au=fname F*F& authors
F*%)* ?B au=lname+ au=fname
FP)( authors=cursor
F)TCD ()IT F*F& authors=cursor
F)TCD ()IT F*F& authors=cursor
F)TCD ()IT F*F& authors=cursor
F)TCD ()IT F*F& authors=cursor
C'FS) authors=cursor
%)-''FC-T) authors=cursor
#-ssume that authors table has 2:: author profiles$
.hat is the outcome of e4ecuting the abo!e cursor statements/V
1 Three author profiles are retrie!ed from authors
2 Fne author profile is retrie!ed from authors
0 (o author profiles are retrie!ed from authors
1 Four author profiles are retrieved B
2 Gi!es error message fast forward allows ne4t
192 Consider the following cursor processing:
%)C'-*) authors=cursor F-ST=FF*.-*% FF*
S)')CT au=lname+ au=fname F*F& authors
F*%)* ?B au=lname+ au=fname
FP)( authors=cursor
F)TCD ()IT F*F& authors=cursor
F)TCD *)'-TI3) 7 F*F& authors=cursor
F)TCD -?SF',T) 2 F*F& authors=cursor
F)TCD '-ST F*F& authors=cursor
C'FS) authors=cursor
%)-''FC-T) authors=cursor
#-ssume that authors table has 2:: author profiles$
.hat is the outcome of e4ecuting the abo!e cursor statements/V
1 Three author profiles are retrie!ed from authors
2 Fne author profile is retrie!ed from authors
0 (o author profiles are retrie!ed from authors
1 Four author profiles are retrie!ed
= +ives error message F with fast forward ne't only is allowed
196 Consider the following temporary stored procedure:
C*)-T) P*FC)%,*) Uuse=temp
-S
S)')CT 1L:
*)T,*( JJ)**F*
GF
The following statements are e4ecuted in a procedure:
IF (FT )IISTS#S)')CT productid F*F& production.product .D)*) color K @yellow@ $
?)GI(
*)T,*(
)(%
S)')CT productid F*F& production.product .D)*) color K @yellow@
%)C'-*) J)rrorCode I(T
)I)C J)rrorCode I(T K Uuse=temp
P*I(T J)rrorCode
-ssuming that there is no product with yellow color+ what is the final outcome of e4ecuting as abo!e/V
1 Prints error message and error code
2 /'ecutes with no message B
0 Se!ere database error
1 (one of the listed options since not e4ists is satisfied+Aust returns
no message
197 Consider the following temporary stored procedure:
C*)-T) P*FC)%,*) Uuse=temp
-S
S)')CT 1L:
*)T,*( JJ)**F*
GF
The following statements are e4ecuted in a procedure:
IF (FT )IISTS#S)')CT productid F*F& production.product .D)*) color K @yellow@ $
?)GI(
*)T,*(
)(%
S)')CT productid F*F& production.product .D)*) color K @red@
%)C'-*) J)rrorCode I(T
)I)C J)rrorCode I(T K Uuse=temp
P*I(T J)rrorCode
-ssuming that the database has products with red+ yellow and blue colors+ what is the final outcome of
e4ecuting as abo!e/V
1 5rints error message and error code B
2 )4ecutes with no message
0 Se!ere database error
1 (one of the listed options since temp proc is in!o"ed+ it gi!es
di!ide by : error and error message is printed
198 Consider the following statements:
S)')CT deptid+
name+
groupname+
C-S) groupname
.D)( @&ar"eting@ TD)( @*oom 1@
.D)( @Duman *esources@ TD)( @*oom 2@
.D)( @Production@ TD)( @*oom 0@
)'S) @*oom 1@
)(%
F*F& hr.department
.hich of the following is correct e5ui!alent to the abo!e/V
1 VS)')CT deptid+
name+
groupname+
C-S) groupname
.D)( groupname K @&ar"eting@ TD)( @*oom 1@
.D)( groupname K @Duman *esources@ TD)( @*oom 2@
.D)( groupname K @Production@ TD)( @*oom 0@
)'S) @*oom 1@
)(%
F*F& hr.departmentV
2 S)')CT deptid+
name+
groupname+
C-S) groupname
.D)( groupname I( @&ar"eting@ TD)( @*oom 1@
.D)( groupname I( @Duman *esources@ TD)( @*oom 2@
.D)( groupname I( @Production@ TD)( @*oom 0@
)'S) @*oom 1@
)(%
F*F& hr.departmentV
0 S)')CT deptid+
name+
groupname+
C-S)
.D)( groupname I( @&ar"eting@ TD)( @*oom 1@
.D)( groupname I( @Duman *esources@ TD)( @*oom 2@
.D)( groupname I( @Production@ TD)( @*oom 0@
)'S) @*oom 1@
)(%
F*F& hr.departmentV
1 S/*/"& deptid,
name,
groupname,
"AS/
:6/7 groupname A B4ar#etingB &6/7 B.oom 1B
:6/7 groupname A B6uman .esourcesB &6/7 B.oom !B
:6/7 groupname A B5roductionB &6/7 B.oom %B
/*S/ B.oom <B
/7
F.O4 hr.departmentO B
2 (one of the listed options regular case is con!erted to boolean case as in 1
199 Consider the following cursor processing:
The following procedures are created:
C*)-T) P*FC sp=two
-S
S)T (F CF,(T F(
F)TCD C1
*)T,*(
GF
C*)-T) P*FC sp=one
-S
S)T (F CF,(T F(
%)C'-*) C,*SF* C1 G'F?-' FF*
S)')CT titleid+ type from titles
FP)( C1
F)TCD C1
)I)C sp=two
C'FS) C1
%)-''FC-T) C1
GF
#-ssume that titles table has 1:: boo" titles$
Dow many boo" titles are retrie!ed when proc sp=one is e4ecuted/V
1 Fne boo" title
2 &wo boo# titles B
0 (one
1 Gi!es e4ecution error since global cursor is declared+ fetch in
sp=two wor"s
2:: Consider the following cursor processing:
The following procedures are created:
C*)-T) P*FC sp=two
-S
S)T (F CF,(T F(
F)TCD C1
*)T,*(
GF
C*)-T) P*FC sp=one
-S
S)T (F CF,(T F(
%)C'-*) C,*SF* C1 'FC-' FF*
S)')CT titleid+ type from titles
FP)( C1
F)TCD C1
)I)C sp=two
C'FS) C1
%)-''FC-T) C1
GF
#-ssume that titles table has 1:: boo" titles$
.hat are the possible outcomes when proc sp=one is e4ecuted/#Choose 2$V
1 One row is fetched from titles B
2 Two rows are fetched from titles
0 (o rows are fetched from titles
1 +ives error message B since local cursor used+ only one row+ and
sp=two gi!es error that c1 is in!alid
2:1. Consider the following cursor processing:
The following procedures are created:
C*)-T) P*FC sp=two -S S)T (F CF,(T F(
%)C'-*) C,*SF* C1 'FC-' FF* S)')CT au=id+ au=name form authors
FP)( C1
F)TCD C1
C'FS) C1
%)-''FC-T) C1
*)T,*(
GF
C*)-T) P*FC sp=one -S S)T (F CF,(T F(
%)C'-*) C,*SF* C1 'FC-' FF* S)')CT titleid+ type from titles
FP)( C1
F)TCD C1
)I)C sp=two
C'FS) C1
%)-''FC-T) C1
GF
.hat is the possible outcome when proc sp=one is e4ecuted/
(o rows are fetched from either titles or authors
Fne row fetched from titles and no rows from authors
,ne row ea! is fet!ed from titles and autors
B
Gi!es e4ecution error message
'ocal cursors can be with same name+ hence !alid and one row fetched from authors and titles each
2:2.
Consider the following cursor processing:
The following procedures are created:
C*)-T) P*FC sp=two -S S)T (F CF,(T F(
%)C'-*) C,*SF* C2 GF?-' FF* S)')CT au=id+ au=name form authors
FP)( C2
*)T,*(
GF
C*)-T) P*FC sp=one -S S)T (F CF,(T F(
%)C'-*) C,*SF* C1 'FC-' FF* S)')CT titleid+ type from titles
FP)( C1
F)TCD C1
)I)C sp=two
F)TCD C2
C'FS) C1
%)-''FC-T) C1
C'FS) C2
%)-''FC-T) C2
*)T,*(
GF
#-ssume that titles table has 1:: boo" titles and authors table has 2:: author profiles$
.hat is the possible outcome when proc sp=one is e4ecuted///
,ne #ooE title is fet!ed from titles and one autor profile is fet!ed from autors
Fne boo" title is fetched from titles
Fne author profile is fetched from authors
Gi!es e4ecution error message
Since cursor is open+ fetch of c2 from sp=one should wor"
2:0.
Consider the following cursor processing:
The following procedures are created:
C*)-T) P*FC sp=two -S S)T (F CF,(T F( %)C'-*) C,*SF* C2 GF?-' FF* S)')CT au=id+
au=name form authors
FP)( C2
*)T,*(
GF
C*)-T) P*FC sp=one -S S)T (F CF,(T F( %)C'-*) C,*SF* C1 'FC-' FF* S)')CT titleid+
type from titles
FP)( C1
F)TCD C1
)I)C sp=two
F)TCD C2
C'FS) C1
%)-''FC-T) C1
*)T,*(
GF
#-ssume that titles table has 1:: boo" titles and authors table has 2:: author profiles$
The abo!e is e4ecuted as follows:
)I)C sp=one
GF
F)TCD C2
GF
.hat is the possible outcome of the abo!e e4ecution/
Fne boo" title is fetched from titles and one author profile is fetched from authors
,ne #ooE title is fet!ed from titles and two autor profiles are fet!ed from autors
Fne boo" title is fetched from titles
Gi!es e4ecution error message
since cursor is not deallocated+ it is a!ailable e!en after sp=one finishes e4ecution and hence c2 is
a!ailable for fetch
2:1.
Consider the following cursor processing statements:
%)C'-*) Jau=lname !archar#1:$+ Jau=fname !archar#2:$
%)C'-*) authors=cursor C,*SF* RF-ST=FF*.-*%S FF*
S)')CT au=lname+ au=fname F*F& authors
.D)*) au=lname 'IE) @?H@ FP)( authors=cursor
F)TCD ()IT F*F& authors=cursor
I(TF Jau=lname+ Jau=fname
.DI') JJF)TCD=ST-T,S K :
?)GI(
P*I(T @-uthor: @ ; Jau=fname ; @ @ ; Jau=lname
F)TCD ()IT F*F& authors=cursor
I(TF Jau=lname+ Jau=fname
)(%
C'FS) authors=cursor
%)-''FC-T) authors=cursor
GF
In case the authors table has authors with following entries
au=lname au=fname
?D-*-T IB)*
-SDISD &-'DFT*-
?I%B,T TD-E,*
-(ISD &-T*)
?-'- S,?*-&-(I-(
Dow many author names would ha!e got printed at the end as per the cursor processing abo!e/
Fi!e authors
Tree autors
(o authors
Gi!es error message
2:2.
Consider the following cursor processing statements:
%)C'-*) authors=cursor C,*SF* FF* S)')CT au=id+ au=fname+ au=lname
F*F& authors .D)*) state K @,T@ F*%)* ?B au=id
FP)( authors=cursor
IF JJC,*SF*=*F.S K :
?)GI(
C'FS) authors=cursor
%)-''FC-T) authors=cursor
*)T,*(
)(%
F)TCD ()IT F*F& authors=cursor
IF JJF)TCD=ST-T,S K C 1
P*I(T @ (F *F.S FF,(% @
)'S)
.DI') JJF)TCD=ST-T,S K :
?)GI(
P*I(T @-T')-ST F() *F. FF,(% @
F)TCD ()IT F*F& authors=cursor
)(%
)(%
C'FS) authors=cursor
%)-''FC-T) authors=cursor
.hat is the message that gets printed in case the authors table does not ha!e any rows satisfying the
gi!en condition/
7rints message =N, *,2S F,1N9=
Prints message @-T')-ST F() *F. FF,(%@
Prints no message
Gi!es error message
Since cursor rows is chec"ed and returned+ no message is printed
2:6.
Sham has to con!ert the rows of the @)mployee@ table to a 4ml file+ adhering to the following rules :
1.The !alues in each row should be the property of the @row@ tag
2.Create another file in which the column name must be the tag name for each !alue
0.*oot tag must ha!e the name as @*FFT@ and each and e!ery row must start with the tag name @*F.@
1.*oot tag must ha!e a property specifying the 4ml (amespace
Per *ule 1+ which of the following Centric method should Sham use to create the file/
)lement Centric
Attri#ute )entri!
Iml Centric
(one of the listed options
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
2:7.
Sham has to con!ert the rows of the @)mployee@ table to a 4ml file+ adhering to the following rules :
1.The !alues in each row should be the property of the @row@ tag
2.Create another file in which the column name must be the tag name for each !alue
0.*oot tag must ha!e the name as @*FFT@ and each and e!ery row must start with the tag name @*F.@
1.*oot tag must ha!e a property specifying the 4ml (amespace
Per the *ule 2+ which of the following <uery should he use to create a file/
S)')CT O F*F& )&P'FB))
F*%)* ?B )&P(-&)
FF* I&' *-.
S)')CT O F*F& )&P'FB))
F*%)* ?B )&P(-&)
FF* I&' *-. +ISI(I'
S+(+)T F F*,' +'7(,6++
,*9+* B6 +'7NA'+
F,* &'( *A2 ,+(+'+NTS
S)')CT O F*F& )&P'FB))
F*%)* ?B )&P(-&)
FF* I&' )')&)(TS

2:8.
Sham has to con!ert the rows of the @)mployee@ table to a 4ml file+ adhering to the following rules :
1.The !alues in each row should be the property of the @row@ tag
2.Create another file in which the column name must be the tag name for each !alue
0.*oot tag must ha!e the name as @*FFT@ and each and e!ery row must start with the tag name @*F.@
1.*oot tag must ha!e a property specifying the 4ml (amespace
.hich of the following 5uery is the correct one for the rule 0/
S)')CT O F*F& )&P'FB))
F*%)* ?B )&P(-&)
FF* I&' )')&)(TS *FFT#@*FFT@$
S)')CT O F*F& )&P'FB))
F*%)* ?B )&P(-&)
FF* I&' *-.#@*F.X@$+)')&)(TS *FFT#@*FFT@$

S)')CT O F*F& )&P'FB))
F*%)* ?B )&P(-&)
FF* I&' *-.+)')&)(TS *FFT#@*F.@$
S+(+)T F F*,' +'7(,6++
,*9+* B6 +'7NA'+
F,* &'( *A2,+(+'+NTS *,,TG=*,,T=:
20D.
Sham has to con!ert the rows of the @)mployee@ table to a 4ml file+ adhering to the following rules :
1.The !alues in each row should be the property of the @row@ tag
2.Create another file in which the column name must be the tag name for each !alue
0.*oot tag must ha!e the name as @*FFT@ and each and e!ery row must start with the tag name @*F.@
1.*oot tag must ha!e a property specifying the 4ml (amespace
.hich clause helps in attaining the Iml namespace in the *oot tag/
&S3N3(
I&'%-T-
I&'SCD)&-
I&'-,TF
21:.
-run is retrie!ing )mployee photos and storing them in a binary format. De then wants to con!ert that
?inary format into a string format as a !alue inside a Iml File.
.hich of the following )ncoding methods will you suggest/
?I(-*B ?-S)16
?I(-*B?-S)02
B3NA*6 BAS+?@
?I(-*B ?-S)128
?I(-*B ?-S)61 is the only a!ailable encoding techni5ue
211.
Consider the following two statements:
Staement 1: FF* I&' *-. C does not support con!erting to I&' file from a Moin <uery
Statement 2: FF* I&' -,TF C supports con!erting to I&' file from a Aoin <uery
.hich of the following is applicable for the abo!e statements/
Statement 1 is True+ and Statement 2 is False
Statement 1 is False+ and Statement 2 is True
Bot te Statements are True
?oth the Statements are False
212.
.hich of the folllowng FF* I&' clause helps in controling the hierarchy of the 4ml result set generated/
1
*-.
-,TF
+&7(3)3T
B
(one of the listed options
210.
Consider the following statement:
.ith 4mlnamespaces
#
@http:LLschemas.microsoft.com as act
$
S)')CT (-&)+-%%*)SS.5uery#@LLact:email@$ F*F& P)*SF(-'=%)T-I'S
FF* I&' *-.#@contactaddress@$+*FFT#@contact%etails$
<uery#$ method e4pects the proClong part and body part when it is used along with @.ITD@ statement .
State T*,) or F-'S).
T*,)
FA(S+
ProClong part is an optional one when used along with @.ITD@ Statement.
211.
.hich of the following methods#$ decompose the 4ml into a logical table similar to FP)(I&'/
<,)*B#$
3-',)#$
)IISTS#$
N,9+SG:
21A.
3inay is wor"ing on a module where he has to insert the )mployee details into a table named
@)&P%)T-I'S@.
.hile wor"ing on the module+ he inserted the )mployee name @ram@ first time and V*-&@ as Second
time.
*aAi! is con!erting the data inserted by 3inay into a I&' file and finds that there are two different tags
with the same name.
.hile searching the name in the 4ml file using the <uery#$ method+ he was not able to get both the tags.
.hat could be the reason for *aAi! not being able to get it/
<uery#$ method does not support searching in I&' file.
0ueryG: metod is )ase Sensiti$e
<uery#$ method is not supported against the I&' Column
(one of the listed options
216.
Consider the following scenario:
Mothi is wor"ing on a Iml File+ which contains a tag named )mail and its !alue is
@%,&&BJ%,&&B.CF&@.
She needs to find out the tag which contains the !alue as @%,&&BJ%,&&B.CF&@ and replace it with
another !alue.
.hich of the following clause helps her in replacing the 3alue/
<uery#$
)4ists#$
3alues#$
(odes#$
None of te listed options
21B.
Consider the following statement:
S)')CT O F*F& S-')S S
MFI(
P*F%,CT P F( P.P*F%,CT=I%KS.P*F%,CT=I%
MFI(
P,*CD-S) P, F( P,.P*F%,CT=I%KP.P*F%,CT=I%
FF* I&' *-.#@Child@$+)')&)(TS
.hat is the outcome of the abo!e statement/
Compliation fails as )')&)(TS is not supported with *aw method
Compliation fails as *aw method does not support Aoins
Te Huery gets e"e!uted and returns a &'( result set
(one of the listed options
218.
Consider the following statement:
S)')CT O F*F& S-')S
MFI(
P,*CD-S) on P,*CD-S).I%KS-')S.I%
FF* I&' -,TF#@*F.@$+)')&)(TS
.hat will be the outcome of the abo!e statement/
Compliation fails as -,TF method does not support Aoins
Compliation fails as -,TF method does not support )')&)(TS
Compliation fails as -,TF method does not support S)')CT
)ompliation fails as A1T, metod does not support *ow naming
21D.
Consider the following statement:
S)')CT O F*F& S-')S
F*%)* ?B P*F%,CT
FF* I&' *-.#@*F.@$+)lements ISI(I'+ *FFT#@*FFT@$+4mldata
.hich of the following gi!es the error in the abo!e statement/
*aw does not support *FFT and *ow naming
)')&)(TS does not support *FFT and *ow naming
ISI(I' does not support *FFT and *ow naming
&'(9ATA does not support *,,T and *ow naming
220.
Consider the following table:
S-')S I% Contents
1 table
2 Chair
Dere is the I&' result from a <uery.
T*FFT 4mlns:4siKVhttp:LLwww.w0.orgL2::1LI&'SchemaCinstanceV>
TCDI'%>
Tid>1TLid>
Tcontents>tableTLcontents>
TLCDI'%>
TCDI'%>
Tid>2TLid>
Tcontents>chairTLcontents>
TLCDI'%>
TL*FFT>
Identify the <uery which ga!e the abo!e *esult/
S+(+)T F F*,' SA(+S
,*9+* B6 39
F,* &'( *A2G=)43(9=:,+lements &S3N3(, *,,TG=*,,T=:
S)')CT O F*F& S-')S
F*%)* ?B I%
FF* I&' *-.#@CDI'%@$+)lements+ *FFT#@*FFT@$
S)')CT O F*F& S-')S
F*%)* ?B I%
FF* I&' *-.#@CDI'%@$+ ISI(I'+ *FFT#@*FFT@$

S)')CT O F*F& S-')S
F*%)* ?B I%
FF* I&' *-.#@CDI'%@$+)lements ISI(I'
CCCCCCCCCCCCCCCCCCCCCCC
221. Consider the following statement:
S)')CT O F*F& S-')S
MFI( P,*CD-S) on P,*CD-S).I%KS-')S.I%
FF* I&' *-.#@CDI'%@$+)lements ISI(I'+ *FFT#@*FFT@$+I&'SCD)&-
.hich of the following is applicable for the abo!e 5uery/
a. The 5uery returns a I&' result set with the 4ml namespace as the property of the *oot node
only
b. &he 9uery returns a 'ml result set in a 'ml schematic way
c. The 5uery gets e4ecuted and returns a result set which is not a I&' format
d. )rror in the abo!e statement
222. Consider the following statement:
1.S)')CT TFP 1 I%+CF(T)(TS F*F& S-')S
2.MFI(
0.P,*CD-S) on P,*CD-S).I%KS-')S.I%
1.FF* I&' *-.#@CDI'%@$+)lements ISI(I'+ *FFT#@*FFT@$+I&'SCD)&-
2.?I(-*B
.hich of the following can be added in the 2th line from the following which helps in )ncoding the ?inary
data that is Supported in S<' Ser!er 2::2/
a. ?-S)02
b. (AS/><
c. )(CF%)02
d. )(CF%)61
225. Consider the following item table and the statement:
IT)& I% CF(T)(TS
1 Table
2 Chair
Select 120 as Tag+ : as Parent+
Contents asRcontentsTableX120XcontentsS
from item
for 4ml )IP'ICIT
.hat is the result of the abo!e statement/
a. Lcontents&able contentsAOtableO NM
Lcontents&able contentsAOchairO NM
b. Tcontents contentstableKVtableV L>
Tcontents contentstableKVchairV L>
c. TcontentTable contentsKVtableV L>
TcontentTable contentsKVchairV L>
d. TcontentsTable contentKVtableV L>
TcontentsTable contentKVchairV L>
22@. Compare the following two statements:
1.S)')CT O F*F& IT)&
FF* I&' 7AT4#@P*F%,CT@$+*FFT#@P*F%,CTIT)&@$
2.S)')CT O F*F& IT)&
FF* I&' *A2#@P*F%,CT@$+)')&)(TS+*FFT#@P*F%,CTIT)&@$
Choose the correct option based on the output from the abo!e two statements.
a. (oth the ,ueries will return the same result because B5A&6B clause is /lement centric by
default
b. ?oth the <ueries will return the same result because @P-TD@ clause is attribute centric by default
c. ?oth the <ueries will (FT return the same result because @P-TD@ clause is )lement centric by default
d. ?oth the <ueries will (FT return the same result because @P-TD@ clause is attribute centric by default
22A. Consider the following statement:
S)')CT O F*F& IT)&
FF* I&' P-TD#@P*F%,CT@$+ISI(I'+*FFT#@P*F%,CTIT)&@$
.hat is the outcome of the abo!e statement/
a. *eturns a 4ml result set with *F. tag name as P*F%,CTIT)&
b. *eturns a 4ml result set with *FFT tag name as P*F%,CTIT)&
c. *eturns a 4ml result set with *F. tag name as P*F%,CT and *FFT tag name as P*F%,CTIT)&
d. )rror in the abo!e statement
e. ISI(I' will not support if no )')&)(TS is used
22?. .hich of the following helps in ta"ing a Column @CF(T)(TS@ !alue as a inner string in between the
P*F%,CTIT)&S tag in FF* I&' /
a. S)')CT I%+ CF(T)(TS @string#$@ F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
b. S)')CT I%+CF(T)(TS @innerstring#$@ F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
c. S)')CT I%+CF(T)(TS @te4t#$@ F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
d. )rror in the abo!e statement
22B. Consider the following IT)& table and the statement:
I% CF(T)(TS
1 Table
2 Chair
S)')CT CF(T)(TS @processingCinstruction#CF(T$@+
#select I% @data#$@from item for 4ml path#@@$$ @wor"Lwor"erLJid@
F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
.hat is the result of the abo!e statement/
a. TP*F%,CT>
TP*F%,CTIT)&S>
T/CF(T table/>
Twor">
Twor"er idKV1 2 :V L>
TLwor">
TLP*F%,CTIT)&S>
TP*F%,CTIT)&S>
T/CF(T chair/>
Twor">
Twor"er idKV1 2 :V L>
TLwor">
TLP*F%,CTIT)&S>
TLP*F%,CT>
b. TP*F%,CT>
TP*F%,CTIT)&S>
T/CF(T table/>
Twor">
Twor"er idKV1 2 :V L>
TLwor">
T/CF(T chair/>
Twor">
Twor"er idKV1 2 :V L>
TLwor">
TLP*F%,CTIT)&S>
TLP*F%,CT>
c. TP*F%,CT>
TP*F%,CTIT)&S>

Twor">
Twor"er idKV1 2 :V L>
TLwor">
TLP*F%,CTIT)&S>
TP*F%,CTIT)&S>
Twor">
Twor"er idKV1 2 :V L>
TLwor">
TLP*F%,CTIT)&S>
TLP*F%,CT>
d. TP*F%,CT>
TP*F%,CTIT)&S>
T/CF(T table/>
Twor"er idKV1 2 :V L>
TLP*F%,CTIT)&S>
TP*F%,CTIT)&S>
T/CF(T chair/>
Twor"er idKV1 2 :V L>
TLP*F%,CTIT)&S>
TLP*F%,CT>
22C. .hich of the following statement helps in ta"ing a Column @CF(T)(TS@ !alue as a Comment which
is prefi4ed with @Comments:@ in FF* I&' /
a. S)')CT I%+ @Comments: @ ; contents @te4t#$@ F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
b. S/*/"& ), B"ommentsE B P contents Bcomment()B F.O4 )&/4
FO. 24* 5A&6(B5.O3"&)&/4SB),.OO&(B5.O3"&B)
c. S)')CT I%+ contents @comment#$@ ; @ Comments :@ F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
d. S)')CT I%+ contents as @comment#$@ F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
22D. Consider the following output :
TP*F%,CT>
TP*F%,CTIT)&S>
T/CF(T table/>
Twor">
Twor"er idKV1 2 0 1V L>
TLwor">
TLP*F%,CTIT)&S>
Dere+ the !alue for I% attribute are ta"en from I% column of the Item table.
.hich of the following node helps us in obtaining it/
a. te4t#$
b. comment#$
c. processingCinstruction#$
d. ata()
250. Consider the following table and the F,TP,T:
IT)&
I% CF(T)(TS
1 Table
2 Chair
F,TP,T:
TP*F%,CT>
TP*F%,CTIT)&S>
TI%>1TLI%>
Ttagname contentsKVtableV L>
TLP*F%,CTIT)&S>
TP*F%,CTIT)&S>
TI%>2TLI%>
Ttagname contentsKVchairV L>
TLP*F%,CTIT)&S>
TLP*F%,CT>
.hich of the following helps in placing the CF(T)(TS column !alue as the !alue of contents attribute of
the Tag @Tagname@/
a. S/*/"& ), contents BtagnameNHcontentsB F.O4 )&/4
FO. 24* 5A&6(B5.O3"&)&/4SB),.OO&(B5.O3"&B)
b. S)')CT I%+ contents as @tagnameLJcontents@ F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
c. S)')CT I%+ contents @tagnameLcontents@ F*F& IT)&
FF* I&' P-TD#@P*F%,CTIT)&S@$+*FFT#@P*F%,CT@$
d. (one of the listed options
251. Consider the following statement:
S)')CT address.5uery#@http:LLschemas.microsoft.com@P
1.')T YpinK6::22:
2.FF* Ypin I(LLPI(
0..D)*) CF,(T#@L-%%*)SSLPI(@$>6::::
1.F*%)* ?B IS:(-&)#ST*I(G#Y-%%*)SSL(-&)$$ %)SC
*)T,*(
TPI(>820126
TLPI(>
$-S *)S,'T
F*F& CF(T-CT=%)T-I'S .D)*) emp=idK1:
.hich of the following iterator or clause is not supported in S<' Ser!er of the abo!e numbered
statement/
a. */&
b. FF*
c. .D)*)
d. F*%)* ?B
252. .hich of the following is (FT supported in &F%IFB#$ method/
a. ,P%-T) ?FFES S)T -,TDF*I&'.&F%IFB#@ I(S)*T Tboo"s>S5l ser!er by &r.SD-&TLboo"s>
-FT)* #subAectLdatabaseLJboo"s$R1S@$
b. ,P%-T) ?FFES S)T -,TDF*I&'.&F%IFB#@ I(S)*T Tboo"s>S5l ser!er by &r.SD-&TLboo"s>
?)FF*) #subAectLdatabaseLJboo"s$R1S@$
c. 35A&/ (OOCS S/& A3&6O.24*.4O)FF(B )7S/.& Lboo#sMS9l server by 4r.S6A4LNboo#sM
7/2& (subGectNdatabaseNHboo#s)Q1RB)
d. ,P%-T) ?FFES S)T -,TDF*I&'.&F%IFB#@ I(S)*T Tboo"s>S5l ser!er by &r.SD-&TLboo"s>
I(TF #subAectLdatabaseLJboo"s$R1S@$
255. Consider the following two statements regarding <uery compilation and optimiation:
Statement 1: -ll the TCS<' statements that come under the %%' are Compiled and optimied.
Statement 2: -ll the TCS<' statements that come under the %&' are Compiled and optimied.
.hich of the following is applicable for the abo!e statements/
a. Statement 1 is True+ and Statement 2 is False
b. Statement 1 is False+ and Statement 2 is True
c. (oth the Statements are &rue
d. ?oth the Statements are False
25@. Consider the following two statements regarding <uery compilation and optimiation:
Statement 1: .hile Identifying the Moin clause+ 5uery optimier treats I(()* MFI( as two different tables
Statement 2: .hile Identifying the Moin clause+ 5uery optimier treats S)'F MFI( as a single table
.hich of the following is applicable for the abo!e statements/
a. Statement 1 is &rue, and Statement ! is False
b. Statement 1 is False+ and Statement 2 is True
c. ?oth the Statements are True
d. ?oth the Statements are False
25A. .hile searching the arguments for optimiation+ if the 5uery optimier does not find any statistics of
inde4 or column in case of an Ine5uality operator #T> or XK$+ the S<' ser!er ta"es the following step#s$.
Step1: S5l Ser!er automatically generates and updates the statistics for Inde4 or Column.
Step2: Ta"es the difference between the total number of rows and the number of rows for the e5uality
operator.
.hich of the following is applicable for abo!e/
a. Step1 is !alid+ and Step2 is in!alid
b. Step1 is valid, and Step! is invalid
c. ?oth the Steps are !alid
d. ?oth the Steps are in!alid
25?. *aAu is wor"ing on a payroll proAect and he needs to find the (et pay of each employee wor"ing in
the company for more than 1 year.
De can implement an inde4 on the employee tenure in the company #i.e. current date minus date of
Aoining$ and speed up the 5uery processing.
State True or False.
a. &.3/
b. F-'S)
25B. Dow does Snapshot isolation differ from *ead committed snapshot isolation/
a. )t maintains a snapshot of the data for the duration of the transaction
b. It maintains statement le!el snapshot of the data
c. It ta"es an e4clusi!e loc" on the entire table
d. It isolates the database from access to other users
e. (one of the listed options
25C. Dow many isolation le!els can be acti!e for a user at any point of time/
a. 1
b. 2
c. ,nlimited
d. 1:21
e. (one of the listed options
25D. If the same 5uery or stored procedure is e4ecuted repeatedly+ S<' ser!er may not generate
e4ecution plan each time.
State True or False.
a. &.3/
b. F-'S)

If the same 5uery or stored procedure is e4ecuted again and the plan is still a!ailable in the procedure
cache+ the steps to optimie and generate the e4ecution plan are s"ipped+ and the stored 5uery e4ecution
plan is reused to e4ecute the 5uery or stored procedure.
2@0. For which of the following situation S<' ser!er may determine that an e4ecution plan needs to be
recompiled/
a. &odifications to table or !iew referenced by 5uery
b. 'ot of changes to "ey data
c. ,pdates made to statistics used by the e4ecution plan
d. All of the listed options
2@1. .hich of the following S)')CT statement will e4ecute the fastest/
a. S/*/"& column1 from table1 :6/./ column1 A 1!%8
b. S)')CT column1 from table1 .D)*) column1 T> 120P
c. S)')CT column1 from table1 .D)*) column1 K J!alue1
d. S)')CT column1 from table1
2@2. Consider the following se5uence of operations from two users :
,ser 1 C
S)T T*-(S-CTIF( ISF'-TIF( ')3)' S(-PSDFT
go
begin tran
select O from boo"
go
Id Title
CCC CCCCCC
2 CatchC22
0 *oses in %ecember
,ser 2 C
?)GI( T*-(
update boo" set Title K Z*oses in %ecember )dition 2[
where id K 0
go
,ser 1 C
update boo" set Title K Z&y )4periments with Truth[
where id K 0
go
.hat will be the outcome/
a. ,ser2@s update will be o!erwritten by user1@s update
b. 3ser 1 will get an update error due to Snapshot isolation
c. ,ser 2 will get an update error due to snapshot isolation
d. ?oth the updates will be successful
2@5. Consider the following TCS<' statement :
S)')CT O F*F& )&P=%)T-I'S
I(()* MFI(
)&P=S-'-*B%)T-I'S
F(
)&P=%)T-I'S.)&P=I%K)&P=S-'-*B%)T-I'S.)&PI%
.D)*) )&PI%K1::1 F* )&PI% K1::2
Identify the order of optimiation of the following clauses
a.I(()* MFI(
b..D)*)
c.F*
a. a+b+c
b. a+c+b
c. b,c,a
d. b+a+c
2@@. Bou are creating a procedure that will update two tables within a transaction. The code loo"s similar
to the following:

1 ?)GI( T*-(S-CTIF(
2
0 ?)GI( T*B
1 ,P%-T) . . .
2
6 )(% T*B
7
8 ?)GI( C-TCD
9 IF . . .
1:
11 )(% C-TCD
12
Gi!e the line number+ where the *F''?-CE statement would normally be placed/
a. 2
b. 2
c. 7
d. 11
2@A. Bou are creating a procedure that will update two tables within a transaction. The code loo"s similar
to the following:

1 ?)GI( T*-(S-CTIF(
2
0 ?)GI( T*B
1 ,P%-T) . . .
2
6 )(% T*B
7
8 ?)GI( C-TCD
9 IF . . .
1:
11 )(% C-TCD
12
Gi!e the line number+ where the CF&&IT statement would normally be placed/
a. 2
b. 7
c. 1:
d. 1!
216.Consider the following stored procedure:
1 begin tran
2 update account set balance K balance C 1::: where account=number K 120
0 if JJerror XK :
1 begin
2 rollbac" tran
6 return
7 end
8 update account set balance K balance ; 1::: where account=number K 126
9 if JJerror XK :
1: begin
11 rollbac" tran
12 return
10 end
11 commit tran
If error code in line 9 is 12+ what will be the outcome/
a. &he entire transaction is rolled bac#
b. ,pdate to 126 is rolled bac" but update to 120 is committed
c. ?oth the updates are comitted
d. ,pdate to 120 is rolled bac" but update to 126 is committed
217. Consider the following stored procedure C
1 begin tran add=boo"
2 insert boo" #id+ name$ !alues #2+ ZS<' for dummies[$
0 if JJerror K 2::::
1 begin
2 rollbac" tran add=boo"
6 return
7 end
8 sa!e tran "eep=the=first
:9 insert boo" #id+ name$ !alues #0+ Z2: immutable laws of leadership[$
1: if JJerror K 2::::
11 begin
12 rollbac" tran "eep=the=first
10 end
11 commit tran
If the error code returned by line 1: is 2::::+ what will be the outcome/
a. ?oo" id@s 2 and 0 are inserted successfully
b. (oo# id ! is inserted but % is not inserted
c. ?oo" id 0 is inserted but 2 is not inserted
d. (either of the boo"s are inserted
218. Consider the following stored procedure C
1 begin tran add=boo"
2 insert boo" #id+ name$ !alues #2+ ZS<' for dummies[$
0 if JJerror K 2::::
1 begin
2 rollbac" tran add=boo"
6 return
7 end
8 sa!e tran "eep=the=first
:9 insert boo" #id+ name$ !alues #0+ Z2: immutable laws of leadership[$
1: if JJerror K 2::::
11 begin
12 rollbac" tran "eep=the=first
10 end
11 commit tran
If the error code returned by line 0 is 2::::+ what will be the outcome/
a. ?oo" id@s 2 and 0 are inserted successfully
b. ?oo" id 2 is inserted but 0 is not inserted
c. ?oo" id 0 is inserted but 2 is not inserted
d. 7either of the boo#s are inserted
219. Consider the following statement:
C*)-T) P*FC)%,*) SP=G)TST-T)
#
JC(F I(T+
JC(-&) 3-*CD-*#2:$
$
-S
?)GI(
?)GI(
S)')CT JC(-&)KC(-&) F*F& CF,(T*B .D)*) C(FKJC(F
)(%
S)')CT S.S(-&) F*F&
ST-T) S
I(()* MFI(
CF,(T*B C
F( C.C(FKS.C(F .D)*) S.C(FKJC(F
FF* I&' *-.#@ST-T)@$+)')&)(TS ISI(I'+*FFT#JC(-&)$
)(%
If you pass the JC(F !alue as C(F of @I(%I-@ +
what will be the output of the abo!e stored procedure while creatingLe4ecuting the procedure/
a. The procedure creation is successful and while e4ecuting+ it will return a 4ml file with I(%I- as root
node and ST-T) as row node
b. The procedure creation is successful and while e4ecuting+ it will return a 4ml file with ST-T) as root
node and I(%I- as row node
c. The procedure creation is successful and while e4ecuting+ it will not return a 4ml file due to runCtime
error
d. &he procedure creation fails due to compilation error
e. Compilation fails because passing a !ariable is not possible in *FFT clause
22:. Consider the following statement:
%)C'-*) JI&'3-* I&'
S)T JI&'3-*K@
TI(%I->
TST-T)S>
TST-T) S(FKV1V S(-&)KVT(V L>
TLST-T)S>
TST-T)S>
TST-T) S(FKV2V S(-&)KV-PV L>
TLST-T)S>
TST-T)S>
TST-T) S(FKV0V S(-&)KV,PV L>
TLST-T)S>
TLI(%I->@
S)')CT
I&'T-?').I&'CF',&(.5uery#@S(-&)@$ -S node+
I&'T-?').I&'CF',&(.3-',)#@ST-T)R1SLJS(F@+@CD-*#1$@$ -S ST-T)=CF%)
F*F& JI&'3-*.nodes#@LI(%I-LST-T)S@$ -S I&'T-?')#4mlcolumn$
.hat is the result of the abo!e statement/
a. <uery will return a result set with S(F as ST-T)=CF%) and S(-&) as node
b. <uery will return a result set with S(F as node and S(-&) as ST-T)=CF%)
c. Select statement is not valid
d. (one of the listed options
e. 3alue function is not supported in dynamic table

You might also like