Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

The benefit of using user-defined functions in SQL Server are ____________(a) They allow modular programming(b) They can increase network traffic(c) They allow slower execution(d) All of the mentionedThis question was posed to me during a job interview.This intriguing question originated from User Defined Functions topic in portion Developing with SQL Server of SQL Server

Answer»

The CORRECT choice is (a) They allow MODULAR programming

Explanation: User-defined functions can be modified independently of the program SOURCE CODE.

52.

Function cannot be used for __________ statement.(a) Create(b) Drop(c) Select(d) InsertI have been asked this question in class test.This interesting question is from User Defined Functions in division Developing with SQL Server of SQL Server

Answer»

The correct OPTION is (d) INSERT

Easiest explanation: We can’t use function to Insert, UPDATE, DELETE records in the database table(s).

53.

User defined function in SQL Server can return ____________(a) Scalar value(b) Set of values(c) Result set(d) All of the mentionedThis question was posed to me by my college director while I was bunking the class.My question is based upon User Defined Functions topic in section Developing with SQL Server of SQL Server

Answer»

Correct option is (d) All of the mentioned

The BEST explanation: SQL Server user-defined functions are routines that accept parameters, PERFORM an action, such as a complex calculation, and RETURN the result of that action as a value.

54.

Type of procedure that are based on the CLR (Common Language Runtime) is ____________(a) User Defined Stored Procedure(b) Extended Procedure(c) CLR Stored Procedure(d) System defined ProcedureThe question was asked in homework.My enquiry is from Built in Stored Procedures topic in section Developing with SQL Server of SQL Server

Answer»

The correct CHOICE is (c) CLR Stored Procedure

The BEST explanation: CLR integration of procedure was introduced with SQL Server 2008 and allow for procedure to be coded in one of .NET languages like C#, VISUAL Basic and F#.

55.

Extended procedures starts with the __________ prefix.(a) sp_(b) xp_(c) clr_(d) all of the mentionedThis question was addressed to me in final exam.I want to ask this question from Built in Stored Procedures topic in division Developing with SQL Server of SQL Server

Answer»

The correct ANSWER is (a) sp_

For EXPLANATION: Extended procedures PROVIDE an interface to EXTERNAL programs for various maintenance ACTIVITIES.

56.

Nesting limit OF stored procedure is up to ________level.(a) 30(b) 32(c) 34(d) 36This question was addressed to me in exam.Enquiry is from Built in Stored Procedures topic in section Developing with SQL Server of SQL Server

Answer» RIGHT ANSWER is (b) 32

The explanation is: In Sql Server stored PROCEDURE nesting limit is up to 32 LEVELS, but there is no limit on the number of stored procedures that can be invoked with in a store.
57.

System defined Procedure logically appear in ____________(a) sys schema(b) stor schema(c) proc schema(d) all of the mentionedThe question was posed to me in an interview for job.This interesting question is from Built in Stored Procedures topic in portion Developing with SQL Server of SQL Server

Answer» RIGHT choice is (a) sys schema

To elaborate: System defined PROCEDURE are physically stored in hidden SQL SERVER Resource Database and logically appear in the sys schema of each user defined and system defined database.
58.

Which of the following stored procedure is already defined in Sql Server?(a) User Defined Stored Procedure(b) Extended Procedure(c) CLR Stored Procedure(d) System defined ProcedureThis question was posed to me in unit test.Query is from Built in Stored Procedures topic in division Developing with SQL Server of SQL Server

Answer»

The correct ANSWER is (d) SYSTEM defined PROCEDURE

Explanation: System defined Procedure procedure STARTS with the sp_ prefix.

59.

Point out the wrong statement.(a) A stored procedure is nothing more than prepared SQL code(b) We can create a Stored Procedure using the Create proc statement(c) We can create a Stored Procedure using the Create stor_proc statement(d) All of the mentionedThe question was posed to me in examination.Query is from Built in Stored Procedures in section Developing with SQL Server of SQL Server

Answer»

Correct ANSWER is (C) We can create a Stored PROCEDURE using the Create stor_proc statement

Explanation: Benefit of Stored Procedures is that they are executed on the server side and perform a set of actions, before RETURNING the RESULTS to the client side.

60.

Which of the following procedures are created by user for own actions?(a) User Defined Stored Procedure(b) Extended Procedure(c) CLR Stored Procedure(d) All of the mentionedI got this question during an interview for a job.This question is from Built in Stored Procedures topic in portion Developing with SQL Server of SQL Server

Answer»

Right OPTION is (a) User Defined Stored Procedure

To explain I would SAY: User Defined Stored Procedure can be created in all system DATABASES except the Resource DATABASE or in a user-defined database.

61.

How many types of stored procedures are present in SQL Server?(a) 3(b) 4(c) 5(d) 8This question was addressed to me in class test.This intriguing question comes from Built in Stored Procedures in chapter Developing with SQL Server of SQL Server

Answer»

The CORRECT answer is (B) 4

The explanation is: SQL Server is packed full of useful system stored procedures there for its own USE that you can use as well.

62.

Point out the wrong statement.(a) Stored procedure can accepts input and output parameters(b) Stored procedure can returns multiple values using input parameters(c) Using stored procedure, we can Select,Insert,Update,Delete data in database(d) None of the mentionedI got this question in a national level competition.My question comes from Built in Stored Procedures in portion Developing with SQL Server of SQL Server

Answer»

Right choice is (b) Stored PROCEDURE can returns multiple values using input PARAMETERS

To EXPLAIN: Stored procedure can returns multiple values using output parameters.

63.

Stored procedure is a __________ set of one or more SQL statements.(a) interpreted(b) compiled(c) pre compiled(d) none of the mentionedI got this question during an online exam.My question comes from Built in Stored Procedures in division Developing with SQL Server of SQL Server

Answer»

The correct option is (C) PRE compiled

Explanation: Stored procedure is a precompiled set of one or more SQL STATEMENTS that is stored on Sql SERVER.

64.

Stored procedure used to remember the exact number of bytes is _____________(a) sp_datatype(b) sp_datatype_info(c) sp_info(d) none of the mentionedI have been asked this question in an international level competition.Question is taken from Stored Procedure in portion Developing with SQL Server of SQL Server

Answer»

The CORRECT CHOICE is (b) sp_datatype_info

The EXPLANATION: sp_datatype_info returns just about EVERYTHING you need to know about the datatypes available in any SQL SERVER database.

65.

__________ is used to build the code dynamically and execute it.(a) sp_addmessage(b) sp_dropmessage(c) sp_altermessage(d) sp_executesqlThe question was asked in unit test.I need to ask this question from Stored Procedure topic in section Developing with SQL Server of SQL Server

Answer»

Right CHOICE is (d) sp_executesql

To explain I would say: You can execute SQL dynamically using either the EXECUTE T-SQL statement or the sp_executesql STORED PROCEDURE. sp_executesql is the more flexible of the TWO THOUGH because it supports using parameters.

66.

Which of the following stored procedure is used for error messages?(a) sp_addmessage(b) sp_dropmessage(c) sp_altermessage(d) all of the mentionedI had been asked this question in an interview.Enquiry is from Stored Procedure topic in chapter Developing with SQL Server of SQL Server

Answer» RIGHT OPTION is (a) sp_addmessage

Explanation: Calling sp_addmessage is easy for RAISING errors.
67.

_____________ sets procedure options in SQL Server.(a) sp_procoption(b) sp_dropmessage(c) sp_altermessage(d) sp_executesqlI had been asked this question in class test.This key question is from Stored Procedure in division Developing with SQL Server of SQL Server

Answer»

Right CHOICE is (a) sp_procoption

Best explanation: sp_procoption sets exactly one OPTION to CONFIGURE a stored procedure for auto execution when SQL SERVER STARTS up.

68.

__________create the removable database.(a) sp_certify_removable(b) sp_certify(c) sp_removable(d) all of the mentionedI got this question in final exam.My query is from Stored Procedure in chapter Developing with SQL Server of SQL Server

Answer»

Right answer is (a) sp_certify_removable

To elaborate: You can’t use CREATE DATABASE or Enterprise MANAGER to create the removable database. You’ll NEED to run sp_create_removable with sysadmin PRIVILEGES.

69.

Point out the wrong statement.(a) Support for transactions is one of the most important reasons to use database engines such as SQL Server(b) BASE support(c) ACID support(d) All of the mentionedI got this question in final exam.I'm obligated to ask this question of Stored Procedure in chapter Developing with SQL Server of SQL Server

Answer» CORRECT choice is (B) BASE support

To EXPLAIN I would say: Stored PROCEDURES don’t have support for BASE.
70.

Which of the following has support for transaction?(a) sp_monitor(b) sp_bindsession(c) sp_status(d) all of the mentionedThis question was addressed to me in an interview for job.I'm obligated to ask this question of Stored Procedure in portion Developing with SQL Server of SQL Server

Answer»

The correct answer is (B) sp_bindsession

Easiest EXPLANATION: sp_getbindtoken ALSO can be used for TRANSACTIONS.

71.

__________ takes no parameters and returns all kinds of interesting information.(a) sp_monitor(b) sp_on(c) sp_status(d) none of the mentionedI have been asked this question in final exam.I'd like to ask this question from Stored Procedure topic in section Developing with SQL Server of SQL Server

Answer»

Correct choice is (a) sp_monitor

The BEST I can explain: sp_monitor DISPLAYS statistics about the INSTANCE of SQL Server in which it RUNS.

72.

Point out the correct statement.(a) Conditional logic applied to the results of the first SQL statements determines which subsequent SQL statements are executed(b) A stored procedure is a group of Transact-SQL statements pre compiled into a single execution plan(c) Stored procedures cannot improve performance(d) All of the mentionedI got this question in unit test.This interesting question is from Stored Procedure topic in portion Developing with SQL Server of SQL Server

Answer»

The correct answer is (a) Conditional logic applied to the RESULTS of the first SQL STATEMENTS determines which subsequent SQL statements are executed

Easy EXPLANATION: Stored procedures assist in achieving consistent IMPLEMENTATION of logic across applications.

73.

Reasons for consideration of the stored procedure can be?(a) With which tables will you have to work? Does it make sense to create a VIEW first?(b) How often will this procedure actually be used?(c) Do you want to view data in the database (SELECT), insert new records (INSERT INTO), or do I want to change an existing record (UPDATE)?(d) All of the mentionedI got this question in an internship interview.Question is taken from Stored Procedure in portion Developing with SQL Server of SQL Server

Answer» RIGHT CHOICE is (d) All of the mentioned

Easiest EXPLANATION: A STORED procedure is an already written SQL statement that is saved in the database.
74.

Nesting level of a stored procedure’s execution is stored in the _________ function.(a) NEST(b) NESTLEVEL(c) LEVEL(d) None of the mentionedI had been asked this question in homework.My doubt stems from Stored Procedure in chapter Developing with SQL Server of SQL Server

Answer»

Correct answer is (B) @@NESTLEVEL

Explanation: When @@NESTLEVEL is EXECUTED WITHIN a Transact-SQL string, the VALUE returned is 1 + the current nesting LEVEL.

75.

_____________ procedure cannot be created in Resource database.(a) System(b) User defined(c) Extended(d) All of the mentionedI had been asked this question in examination.Enquiry is from Stored Procedure in chapter Developing with SQL Server of SQL Server

Answer»

Correct CHOICE is (b) User DEFINED

The EXPLANATION is: User defined PROCEDURE can be created in all system databases except the RESOURCE database or in a user-defined database.

76.

Nesting level of stored procedure is applicable for ____________(a) Triggers(b) Views(c) Functions(d) All of the mentionedThis question was addressed to me in quiz.This intriguing question originated from Stored Procedure topic in chapter Developing with SQL Server of SQL Server

Answer»

Right ANSWER is (d) All of the mentioned

To explain: We can nest STORED PROCEDURES and managed code REFERENCES in Sql Server up to 32 levels only.

77.

Which of the following is an extended procedure?(a) xp_change(b) sp_owner(c) sp_change(d) xp_logininfoI have been asked this question by my school teacher while I was bunking the class.Question is from Stored Procedure in section Developing with SQL Server of SQL Server

Answer» CORRECT choice is (d) xp_logininfo

For EXPLANATION: xp_logininfo procedure will display details about the BUILTIN\Administrators WINDOWS group.
78.

__________ provides details on any database object.(a) sp_changeowner(b) sp_owner(c) sp_change(d) none of the mentionedThis question was posed to me in an interview.My question is taken from Stored Procedure topic in section Developing with SQL Server of SQL Server

Answer» CORRECT answer is (d) NONE of the mentioned

Easy explanation: sp_help provides details on any DATABASE OBJECT such as tables,views and so on.
79.

Point out the wrong statement.(a) sp_depends provide the details of all database objects that depend on the specific database object(b) sp_helpdb provides the text of a stored procedure reside in Sql Server(c) Extended procedures provide an interface to external programs for various maintenance activities(d) All of the mentionedThis question was posed to me in final exam.This interesting question is from Stored Procedure topic in chapter Developing with SQL Server of SQL Server

Answer»

The CORRECT ANSWER is (b) sp_helpdb provides the text of a STORED procedure reside in SQL SERVER

Easy explanation: sp_helptext provides the text of a stored procedure reside in SQL Server.

80.

Which of the following is a system procedure?(a) sp_changeowner(b) sp_owner(c) sp_change(d) all of the mentionedThe question was asked in a national level competition.I need to ask this question from Stored Procedure topic in chapter Developing with SQL Server of SQL Server

Answer» RIGHT option is (a) sp_changeowner

The explanation is: sp_changeowner is used to CHANGE the OWNER of an database object.
81.

Data return using output parameter is ____________(a) Return codes, which are always an integer value(b) A global cursor that can be referenced outside the stored procedure(c) A single cursor that can be referenced inside the stored procedure(d) None of the mentionedThis question was addressed to me during an interview.Question is taken from Stored Procedure in section Developing with SQL Server of SQL Server

Answer»

Correct option is (d) None of the mentioned

The best explanation: OUTPUT parameters, which can RETURN either data (such as an integer or character value) or a cursor variable (cursors are result sets that can be retrieved one row at a TIME).

82.

Point out the correct statement.(a) Stored procedures assist in achieving consistent implementation of logic across applications(b) A stored procedure is a group of Transact-SQL statements compiled into a single execution plan(c) Stored procedures can also improve performance(d) All of the mentionedThe question was posed to me during an interview.The above asked question is from Stored Procedure in division Developing with SQL Server of SQL Server

Answer»

Right choice is (d) All of the mentioned

The best I can explain: The SQL STATEMENTS and logic needed to perform a commonly performed TASK can be designed, coded, and TESTED once in a STORED procedure.

83.

How many ways of returning data is present in SQL Server 2000?(a) 3(b) 4(c) 5(d) 6This question was addressed to me in a job interview.My question is from Stored Procedure in portion Developing with SQL Server of SQL Server

Answer»

The correct choice is (b) 4

Easiest EXPLANATION: Microsoft® SQL Server™ 2000 STORED PROCEDURES return data in FOUR WAYS.

84.

ERROR_SEVERITY() returns the ________level of the error.(a) State number(b) Full text(c) Severity(d) None of the mentionedThis question was posed to me in quiz.This question is from Error Handling topic in division Developing with SQL Server of SQL Server

Answer» CORRECT OPTION is (C) SEVERITY

To explain: ERROR_SEVERITY() returns the severity level of the error.
85.

Which of the following is a global variable for error handling?(a) ERRORS(b) ERROR(c) ERR(d) None of the mentionedI had been asked this question by my college professor while I was bunking the class.Enquiry is from Error Handling in chapter Developing with SQL Server of SQL Server

Answer» RIGHT option is (b) @@ERROR

For EXPLANATION: @@ERROR is one of the basic error handling MECHANISMS in SQL Server.
86.

Which of the following is an Error function used within CATCH block?(a) ERROR_STATE()(b) ERROR_STATUS()(c) ERROR_MSG()(d) All of the mentionedThis question was addressed to me in an interview.Origin of the question is Error Handling topic in chapter Developing with SQL Server of SQL Server

Answer»

The CORRECT OPTION is (a) ERROR_STATE()

Easy explanation: ERROR_STATE() RETURNS the state number of the ERROR.

87.

Exception handling is possible in SQL Server using _____________(a) THROW(b) FINAL(c) FINALLY(d) All of the mentionedThis question was addressed to me in my homework.Asked question is from Error Handling topic in chapter Developing with SQL Server of SQL Server

Answer»

Right answer is (a) THROW

The EXPLANATION is: Generates an ERROR MESSAGE and initiates error processing for the SESSION.

88.

Which of the following benefit does Exception handling with the TRY and CATCH blocks provide?(a) Exceptions provide a mechanism to signal errors directly rather than using some side effects(b) Exceptions can be seen by the programmer and checked during the compilation process(c) Exceptions provide a clean way to check for errors without cluttering code(d) All of the mentionedI have been asked this question in an online interview.I need to ask this question from Error Handling topic in division Developing with SQL Server of SQL Server

Answer»

Right choice is (d) All of the mentioned

The best explanation: Exception HANDLING USING the TRY and CATCH statements is the common way that modern programming languages LIKE C# and JAVA treat ERRORS.

89.

Point out the wrong statement.(a) If an error occurs in the TRY block, control is not passed to another group of statements that is enclosed in a CATCH block(b) If an error occurs in the TRY block, control is passed to another group of statements that is enclosed in a CATCH block(c) If an error does not occur in the TRY block, control is passed to another group of statements that is enclosed in a CATCH block(d) None of the mentionedThis question was posed to me in unit test.I want to ask this question from Error Handling topic in chapter Developing with SQL Server of SQL Server

Answer»

The correct OPTION is (b) If an error occurs in the TRY block, control is passed to ANOTHER group of STATEMENTS that is enclosed in a CATCH block

Easiest explanation: A TRY…CATCH construct CATCHES all EXECUTION errors that have a severity higher than 10 that do not close the database connection.

90.

Purpose of TRY…CATCH block in SQL Server is ___________(a) Error handling(b) Stored Procedure handling(c) Message handling(d) None of the mentionedI have been asked this question in a job interview.This key question is from Error Handling in portion Developing with SQL Server of SQL Server

Answer»

Right answer is (a) Error handling

The BEST I can explain: TRY… CATCH IMPLEMENTS error handling for Transact-SQL that is SIMILAR to the exception handling in the MICROSOFT Visual C#.

91.

Point out the correct statement.(a) While executing some DML Statement like INSERT, DELETE, UPDATE we can handle the error for checking proper output(b) If transaction fails, then we need to commit – This can be done by error handling(c) If transaction succeeds, then we need to rollback – This can be done by error handling(d) None of the mentionedI got this question in an online interview.I'd like to ask this question from Error Handling in division Developing with SQL Server of SQL Server

Answer»

The correct choice is (a) While EXECUTING some DML Statement like INSERT, DELETE, UPDATE we can handle the error for checking PROPER output

To elaborate: SQL Server also has an exception model to handle exceptions and errors that occurs in T-SQL statements.

92.

Which of the following statements can be checked for Errors?(a) CREATE(b) DROP(c) DELETE(d) INSERTThis question was addressed to me by my school teacher while I was bunking the class.I need to ask this question from Error Handling topic in division Developing with SQL Server of SQL Server

Answer»

Correct OPTION is (d) INSERT

Easy EXPLANATION: DML STATEMENTS can be checked for HANDLING ERRORS.

93.

SQL Server static cursors are always ___________(a) Read-only(b) Write-only(c) Read, Write(d) None of the mentionedThis question was addressed to me during a job interview.The doubt is from Cursor in chapter Developing with SQL Server of SQL Server

Answer»

The CORRECT option is (a) Read-only

Best EXPLANATION: A static CURSOR populates the RESULT set at the time of cursor creation and query result is CACHED for the lifetime of the cursor.

94.

Which of the following blocks are used for error handling in SQL Server?(a) TRY…CATCH(b) TRY…FINAL(c) TRY…END(d) CATCH…TRYI had been asked this question in an online quiz.I'm obligated to ask this question of Error Handling topic in portion Developing with SQL Server of SQL Server

Answer» RIGHT answer is (a) TRY…CATCH

Explanation: SQL Server 2005 introduced TRY…CATCH statement which helps US to handle the ERRORS effectively in the BACK end.
95.

Which of the following FORWARD ONLY Cursor is populated at the time of creation?(a) KEYSET(b) FORWARD_ONLY STATIC(c) FAST_FORWARD(d) All of the mentionedI had been asked this question in semester exam.I'm obligated to ask this question of Cursor in section Developing with SQL Server of SQL Server

Answer»

Correct answer is (B) FORWARD_ONLY STATIC

The EXPLANATION: A FORWARD_ONLY STATIC Cursor is populated at the TIME of creation and cached the data to the cursor lifetime. It is not SENSITIVE to any changes to the data source.

96.

____________ cursor is sensitive to any changes to the data source.(a) Static Cursors(b) Dynamic Cursors(c) Keyset Driven Cursors(d) None of the mentionedThe question was asked during an online interview.My question is based upon Cursor topic in division Developing with SQL Server of SQL Server

Answer»

Right choice is (c) Keyset DRIVEN Cursors

The best EXPLANATION: A keyset driven cursor is sensitive to any CHANGES to the data source and supports update, delete OPERATIONS.

97.

Which of the cursors further have their subtypes?(a) Static Cursors(b) Dynamic Cursors(c) Keyset Driven Cursors(d) None of the mentionedI have been asked this question during an online interview.I'm obligated to ask this question of Cursor topic in portion Developing with SQL Server of SQL Server

Answer»

Correct ANSWER is (d) None of the mentioned

Best EXPLANATION: There are three more types of Forward Only Cursors in SQL Server.

98.

A dynamic cursor in SQL Server allows you to see __________ data.(a) Updated(b) Inserted(c) Deleted(d) All of the mentionedI got this question during an interview for a job.I need to ask this question from Cursor in portion Developing with SQL Server of SQL Server

Answer»

The CORRECT choice is (d) All of the mentioned

Easy explanation: A dynamic CURSOR allows you to see the DATA updation, deletion and INSERTION in the data source while the cursor is OPEN.

99.

Point out the wrong statement.(a) We should use cursor in all cases(b) A static cursor can move forward and backward direction(c) A forward only cursor is the fastest cursor(d) All of the mentionedI have been asked this question during an internship interview.I would like to ask this question from Cursor topic in portion Developing with SQL Server of SQL Server

Answer»

Correct option is (a) We should use CURSOR in all cases

The EXPLANATION: We should use cursor in that case when there is no option EXCEPT cursor.

100.

Various alternatives to cursor in SQL Server are ___________(a) FOR(b) IF..ELSE(c) WHILE(d) All of the mentionedI had been asked this question in a national level competition.Question is from Cursor in portion Developing with SQL Server of SQL Server

Answer» CORRECT answer is (c) WHILE

The best explanation: CURSOR ALTERNATIVES are WHILE loop, SUBQUERIES, Temporary TABLES and Table variables.