Database Management and SQL Functions

Quiz covering database administration concepts including SQL Server performance monitoring, indexing, stored procedures, data types, and PL/SQL functions for string manipulation, NULL handling, and exception handling.

19 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

What output will the follwing statement produce? Select NVL2(NULL,'NOT NULL', NULL) from dual?

  1. NULL
  2. NOT NULL
  3. Function NVL2 is not defined
  4. None of the above
Question 2 Multiple Choice (Single Answer)

Functions for error trapping are contained in which section of a PL/SQL block?

  1. Header
  2. Declarative
  3. Executable
  4. Exception
Question 3 Multiple Choice (Single Answer)

What is the result if two NULL values are compared to each other?

  1. TRUE
  2. FALSE
  3. Undefined
  4. NULL
Question 4 Multiple Choice (Single Answer)

PL/SQL raises an exception, in which TWO of the following cases?

  1. When a SELECT statement returns more than one row
  2. When a SELECT statement returns no rows
  3. When INTO statement is missing in the SELECT statement
  4. Both I and II
Question 5 Multiple Choice (Single Answer)

What output will the follwing statement produce? Select NVL2(NULL,NOT NULL, NULL) from dual?

  1. NULL
  2. NOT NULL
  3. Function NVL2 is not defined
  4. None of the above
Question 6 Multiple Choice (Single Answer)

Which SELECT statement will get the result 'elloworld' from the string 'HelloWorld'?

  1. SELECT INITCAP(TRIM ('HelloWorld', 1,1)) FROM dual;
  2. SELECT SUBSTR( 'HelloWorld',1) FROM dual;
  3. SELECT LOWER(SUBSTR('HelloWorld', 1, 1) FROM dual;
  4. SELECT LOWER(TRIM ('H' FROM 'HelloWorld')) FROM dual;
Question 7 Multiple Choice (Single Answer)

COALESCE (A,B)is equivalent to?

  1. CASE WHEN B IS NOT NULL THEN A ELSE B
  2. CASE WHEN A IS NOT NULL THEN A ELSE B
  3. CASE WHEN A IS NOT NULL THEN B ELSE A
  4. CASE WHEN A IS NOT NULL THEN A ELSE A
Question 8 Multiple Choice (Single Answer)

In which case would you use a FULL OUTER JOIN?

  1. Both tables have NULL values.
  2. You want all matched data from both tables.
  3. You want all unmatched data from both tables.
  4. You want all unmatched data from one table.
Question 9 Multiple Choice (Single Answer)

mod(-15, 4)would return ?

  1. 15
  2. -15
  3. -3
  4. 3
Question 10 Multiple Choice (Single Answer)

instr(Tech on the net, e, -3, 2) would retrun

  1. 10
  2. 8
  3. 6
  4. 2
Question 11 Multiple Choice (Single Answer)

power(-5, 3) would return ?

  1. -15
  2. -125
  3. 125
  4. 15
Question 12 Multiple Choice (Single Answer)

TRUNC(44.647, -1) would retrun ?

  1. 44.6
  2. 44
  3. 40
  4. 43
Question 13 Multiple Choice (Single Answer)

Your company has created a custom application that will require the use of several stored procedures. The lifetime of this application is relatively short and you wish to create the stored procedures such that they can all be dropped with a single DROP PROCEDURE statement command at the end of the application's lifetime. How can you group the procedures together such that they can all be dropped with a single DROP PROCEDURE statement?

  1. Create each procedure with a distinct name followed by a semi-colon and a group name.
  2. Create each procedure with a distinct name followed by a semi-colon and a group number.
  3. Create each procedure with the same name followed by a semi-colon and a group name.
  4. Create each procedure with the same name followed by a semi-colon and a distinct number.
Question 14 Multiple Choice (Single Answer)

You have a mission critical database named MCDB1 that you want to configure for automatic failover. You have decided to utilize database mirroring. Which database mirroring operating mode should you use?

  1. High safety mode
  2. Asynchronously
  3. High performance mode
  4. Synchronously
Question 15 Multiple Choice (Single Answer)

You have been assigned the task of designing a relational database for a client. The database will be used to store an exact copy of specific XML documents that the client needs to retrieve on a regular basis. The client wants to be able to use an application that they created to enter the documents into the database as well as retrieve them. You are in the process of designing a table for the database. What should you do?

  1. Convert the XML documents to relational data and then store them within the database
  2. Create a table that uses XML as the data type for the column that will store the XML documents.
  3. Nothing. You can not store XML documents within a SQL Server 2005 database
  4. Create a table that uses nvarchar(max) as the data type for the column that will store the XML documents
Question 16 Multiple Choice (Single Answer)

EasyYatra is a travel booking company that has a web site available for customers to view and book their vacations online. You have been hired to look after the back-end SQL Server that is used to store customer and booking information. You are creating a table called Booking to keep track of vacations booked by customers. This table will contain a computed column called Total that is derived from other columns in the table. You want to be able to create an index on this Total column to increase performance when any queries are executed using this column. To do this, you want to physically store the computed column in the table. How can this be done?

  1. Mark the computed column as PERSISTED.
  2. Define the computed column as NULL.
  3. Specify the collation for the column using COLLATE Physical.
  4. Do nothing. Computed columns are stored in the table by default.
Question 17 Multiple Choice (Single Answer)

You are gathering performance and optimization data for your SQL Server 2005 database. Your company has three custom applications that routinely make use of the database. Each application accesses the database using separate login credentials. You wish to gather information concerning the queries executed by each custom application. To gather this data you decide to create a trace using the SQL Server Profiler. You decide to use one of the predefined SQL Server Profiler templates to define what data should be gathered. Which predefined SQL Server Profiler template would best suit your requirements?

  1. TSQL_Duration
  2. TSQL_Grouped
  3. TSQL_Replay
  4. TSQL_SPs
Question 18 Multiple Choice (Single Answer)

Which task can you perform using only the TO_CHAR function?

  1. convert 10 to 'TEN'
  2. convert '10' to 10
  3. convert '10' to '10'
  4. convert 'TEN' to 10
Question 19 Multiple Choice (Single Answer)

In which scenario would an index be most useful?

  1. The indexed column is declared as NOT NULL.
  2. The indexed columns are used in the FROM clause.
  3. The indexed columns are part of an expression.
  4. The indexed column contains a wide range of values.