MCQOPTIONS
Saved Bookmarks
This section includes 99 Mcqs, each offering curated multiple-choice questions to sharpen your Structured Query Language (SQL) knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How many types of triggers are present in SQL Server? |
| A. | 4 |
| B. | 5 |
| C. | 8 |
| D. | 9 |
| Answer» B. 5 | |
| 2. |
DML triggers in SQL Server is applicable to _____________ |
| A. | Insert |
| B. | Update |
| C. | Delete |
| D. | All of the mentioned |
| Answer» E. | |
| 3. |
Below Code is procedure for dynamic SQL using ___________ parameter. |
| A. | input and output |
| B. | input |
| C. | output |
| D. | all of the mentioned |
| Answer» C. output | |
| 4. |
Which of the following code snippet is valid control flow statement? |
| A. | IF (@@Error 0) |
| B. | IF (@@Error 0) |
| C. | IF (@@Error 0) |
| D. | All of the mentioned |
| Answer» B. IF (@@Error 0) | |
| 5. |
Purpose of DDL Trigger is to _____________ |
| A. | Perform administrative tasks |
| B. | Audit |
| C. | Regulating database operations |
| D. | All of the mentioned |
| Answer» E. | |
| 6. |
Which of the following has support for transaction? |
| A. | sp_monitor |
| B. | sp_bindsession |
| C. | sp_status |
| D. | all of the mentioned |
| Answer» C. sp_status | |
| 7. |
Nesting level of stored procedure is applicable for ____________ |
| A. | Triggers |
| B. | Views |
| C. | Functions |
| D. | All of the mentioned |
| Answer» E. | |
| 8. |
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 mentioned |
| Answer» B. ERROR_STATUS() | |
| 9. |
Which of the cursors further have their subtypes? |
| A. | Static Cursors |
| B. | Dynamic Cursors |
| C. | Keyset Driven Cursors |
| D. | None of the mentioned |
| Answer» E. | |
| 10. |
Exception handling is possible in SQL Server using _____________ |
| A. | THROW |
| B. | FINAL |
| C. | FINALLY |
| D. | All of the mentioned |
| Answer» B. FINAL | |
| 11. |
Which of the following is a way to build dynamic sql statements? |
| A. | Writing a query with parameters |
| B. | Using sp_executesql |
| C. | Using EXEC |
| D. | All of the mentioned |
| Answer» E. | |
| 12. |
Syntax for creation of user defined function is ____________ |
| A. | CREATE FUNCTIONS |
| B. | CREATE FUNCTION |
| C. | CREATE FUNC |
| D. | All of the mentioned |
| Answer» C. CREATE FUNC | |
| 13. |
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 Procedure |
| Answer» E. | |
| 14. |
_______________ is time based SQL injection attack. |
| A. | Quick detection |
| B. | Initial Exploitation |
| C. | Blind SQL Injection |
| D. | Inline Comments |
| Answer» D. Inline Comments | |
| 15. |
Scope of DDL triggers in SQL Server can be _____________ |
| A. | Server |
| B. | Client |
| C. | Views |
| D. | None of the mentioned |
| Answer» B. Client | |
| 16. |
Which of the following is not a limitation of user defined function? |
| A. | User-defined functions cannot call a stored procedure, but can call an extended stored procedure |
| B. | User-defined functions cannot make use of dynamic SQL or temp tables. Table variables are allowed |
| C. | SET statements are allowed in a user-defined function |
| D. | The FOR XML clause is not allowed |
| Answer» D. The FOR XML clause is not allowed | |
| 17. |
Which of the following statements cannot be included in the definition of a Transact-SQL user-defined function? |
| A. | GET CONVERSATION GROUP |
| B. | MOVE CONVERSATION |
| C. | RECEIVE |
| D. | All of the mentioned |
| Answer» E. | |
| 18. |
Which of the user defined function will be preferred for adding two numbers? |
| A. | Scalar |
| B. | Inline table valued |
| C. | Max() |
| D. | Min() |
| Answer» B. Inline table valued | |
| 19. |
The ability to create a user-defined function (UDF) is a new feature added to ________________ |
| A. | SQL Server 6.5 |
| B. | SQL Server 7.0 |
| C. | SQL Server 2000 |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 20. |
When to choose scalar function over inline table valued function? |
| A. | You want a single value as the result |
| B. | One or more row’s worth of data is expected |
| C. | You want multiple values as result |
| D. | All of the mentioned |
| Answer» B. One or more row’s worth of data is expected | |
| 21. |
Which of the following is the most visible benefit of user-defined function? |
| A. | Slow performance |
| B. | Bad optimized queries |
| C. | Faster performance |
| D. | All of the mentioned |
| Answer» D. All of the mentioned | |
| 22. |
User defined function in SQL Server can return ____________ |
| A. | Scalar value |
| B. | Set of values |
| C. | Result set |
| D. | All of the mentioned |
| Answer» E. | |
| 23. |
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 mentioned |
| Answer» B. They can increase network traffic | |
| 24. |
Which of the following is not a User defined function? |
| A. | Max() |
| B. | Scalar Function |
| C. | Inline Table-Valued Function |
| D. | Multi-Statement Table-Valued Function |
| Answer» B. Scalar Function | |
| 25. |
How many types of stored procedures are present in SQL Server? |
| A. | 3 |
| B. | 4 |
| C. | 5 |
| D. | 8 |
| Answer» C. 5 | |
| 26. |
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 mentioned |
| Answer» B. Extended Procedure | |
| 27. |
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 Procedure |
| Answer» D. System defined Procedure | |
| 28. |
System defined Procedure logically appear in ____________ |
| A. | sys schema |
| B. | stor schema |
| C. | proc schema |
| D. | all of the mentioned |
| Answer» B. stor schema | |
| 29. |
If xp_cmdshell has been disabled with sp_dropextendedproc, we can simply inject the following code? |
| A. | sp_addextendedproc ‘xp_cmdshell’,’xp_log70.dll’ |
| B. | sp_addproc ‘xp_cmdshell’,’xp_log70.dll’ |
| C. | sp_addextendedproc ‘xp_cmdshell’,’log70.dll’ |
| D. | none of the mentioned |
| Answer» B. sp_addproc ‘xp_cmdshell’,’xp_log70.dll’ | |
| 30. |
How many type of cursor is present in SQL Server? |
| A. | 3 |
| B. | 4 |
| C. | 5 |
| D. | 6 |
| Answer» C. 5 | |
| 31. |
Which of the following components constitutes use CASE expression? |
| A. | The primary key name to transform |
| B. | The BEGIN keyword |
| C. | The CASE keyword |
| D. | Where clause defining an alias for the CASE expression |
| Answer» D. Where clause defining an alias for the CASE expression | |
| 32. |
The BEGIN and END statements are used when ____________ |
| A. | A WHILE loop needs to include a block of statements |
| B. | An element of a CASE expression needs to include a block of statements |
| C. | An IF or ELSE clause needs to include a block of statements |
| D. | All of the mentioned |
| Answer» E. | |
| 33. |
Which of the following is a calling syntax for sp_executesql? |
| A. | sp_execute <@stmt> [<@param1 data_type>,<@param2 data_type>, …] |
| B. | sp_sql <@stmt> [<@param1 data_type>,<@param2 data_type>, …] |
| C. | sp_executesql <@stmt> [<@param1 data_type>,<@param2 data_type>, …] |
| D. | sp_executesql [<@param1 data_type>,<@param2 data_type>, …] |
| Answer» D. sp_executesql [<@param1 data_type>,<@param2 data_type>, …] | |
| 34. |
Point out the right statement. |
| A. | The server always maintain the values of local variable |
| B. | Local variable names begin with a @@ prefix |
| C. | T-SQL restricts the use of variables in ways that aren’t common in other development environments |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 35. |
Triggers created with FOR or AFTER keywords is _____________ |
| A. | AFTER |
| B. | INSTEAD OF |
| C. | CLR |
| D. | All of the mentioned |
| Answer» B. INSTEAD OF | |
| 36. |
Which of the following is a system procedure? |
| A. | sp_changeowner |
| B. | sp_owner |
| C. | sp_change |
| D. | all of the mentioned |
| Answer» B. sp_owner | |
| 37. |
Which of the following language is used for procedural flow in SQL Server? |
| A. | Flow language |
| B. | Control language |
| C. | Control-of-flow language |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 38. |
SQL Server static cursors are always ___________ |
| A. | Read-only |
| B. | Write-only |
| C. | Read, Write |
| D. | None of the mentioned |
| Answer» B. Write-only | |
| 39. |
How many types of DML triggers are present in SQL Server? |
| A. | 1 |
| B. | 3 |
| C. | 5 |
| D. | None of the mentioned |
| Answer» E. | |
| 40. |
Which of the following is an extended procedure? |
| A. | xp_change |
| B. | sp_owner |
| C. | sp_change |
| D. | xp_logininfo |
| Answer» E. | |
| 41. |
Dynamic SQL Statements in SQL Server can be easily built using ________________ |
| A. | Cursor |
| B. | Stored procedure |
| C. | Function |
| D. | All of the mentioned |
| Answer» C. Function | |
| 42. |
Which of the following stored procedure is used for error messages? |
| A. | sp_addmessage |
| B. | sp_dropmessage |
| C. | sp_altermessage |
| D. | all of the mentioned |
| Answer» B. sp_dropmessage | |
| 43. |
Which of the following is a disadvantage of dynamic SQL? |
| A. | Stored procedure can not cache the execution plan for this dynamic query |
| B. | Stored procedure can cache the execution plan for this dynamic query |
| C. | Flexibility in your code that you can not get with standard SQL |
| D. | All of the mentioned |
| Answer» B. Stored procedure can cache the execution plan for this dynamic query | |
| 44. |
Which of the following is a global variable? |
| A. | @@CPU_BUSY |
| B. | @@CPU_IO |
| C. | @@CPU |
| D. | @@I_BUSY |
| Answer» B. @@CPU_IO | |
| 45. |
Which of the following code can enable xp_cmdshell? |
| A. | master..sp_configure 'show advanced options',1 |
| B. | master..sp_configure 'show advanced options',1 |
| C. | master..sp_reconfigure 'show advanced options',1 |
| D. | All of the mentioned |
| Answer» B. master..sp_configure 'show advanced options',1 | |
| 46. |
Which of the stored procedure is used to test the SQL injection attack? |
| A. | xp_write |
| B. | xp_regwrite |
| C. | xp_reg |
| D. | all of the mentioned |
| Answer» C. xp_reg | |
| 47. |
Any user-controlled parameter that gets processed by the application includes vulnerabilities like ___________ |
| A. | Host-related information |
| B. | Browser-related information |
| C. | Application parameters included as part of the body of a POST request |
| D. | All of the mentioned |
| Answer» E. | |
| 48. |
Which of the following script is example of SQL injection attack? |
| A. | var Shipcity; |
| B. | var Shipcity; |
| C. | var Shipcity; |
| D. | All of the mentioned |
| Answer» B. var Shipcity; | |
| 49. |
Which of the following script is an example of Quick detection in the SQL injection attack? |
| A. | SELECT loginame FROM master..sysprocesses WHERE spid = @@SPID |
| B. | For integer inputs : convert(int,@@version) |
| C. | IF condition true-part ELSE false-part (S) |
| D. | SELECT header, txt FROM news UNION ALL SELECT name, pass FROM members |
| Answer» C. IF condition true-part ELSE false-part (S) | |
| 50. |
LANGUAGE variable whose return type nvarchar is specified in _____________ |
| A. | sys.name |
| B. | syslang.name |
| C. | syslanguages.name |
| D. | syslanguages.id |
| Answer» D. syslanguages.id | |