PL-SQL and SQL Database Concepts

Quiz covering PL/SQL control structures, block syntax, and SQL functions, queries, and data manipulation commands

20 Questions Published

Questions

Question 1 Multiple Choice (Multiple Answers)

What is true about MERGE command? Choose all that apply.

  1. It is a DML command
  2. It is a DDL command
  3. Provides the ability to conditionally update or insert data into a database table
  4. Provides the ability to MERGE VIEWS and INDICES of a TABLE
Question 2 Multiple Choice (Multiple Answers)

Select TYPES of JOINS. Choose all that apply.

  1. EQUI-JOIN
  2. NONEQUI-JOIN
  3. SELF-JOIN
  4. OUTER-JOIN
  5. MERGE-JOIN
  6. TRANSACTION-JOIN
Question 3 Multiple Choice (Multiple Answers)

Choose the MANDATORY clauses of SELECT SQL statement

  1. SELECT
  2. WHERE
  3. GROUP BY
  4. FROM
  5. ORDER BY
  6. HAVING
Question 4 True/False

ALIAS can be used for TABLE as well as COLUMN to simplify interpretation of SQL query

  1. True
  2. False
Question 5 Multiple Choice (Single Answer)

Identify the correct output
select INITCAP('ORACLE BASICS') from dual;

  1. ORACLE BASICS
  2. Oracle Basics
  3. oracle basics
  4. oracleBasics
Question 6 Multiple Choice (Single Answer)

Identify the correct output ---
select CONCAT('ORACLE' || 'BASICS') from dual;

  1. ORACLE BASICS
  2. ORACLEBASICS
  3. oraclebasics
  4. oracleBasics
Question 7 Multiple Choice (Single Answer)

Identify the correct output --- select SUBSTR('ORACLE BASICS',-6,5) from dual;

  1. BASIC
  2. BASICS
  3. E BAS
  4. ORACL
Question 8 Multiple Choice (Single Answer)

Identify the correct output --- select TRUNC(TO_DATE('01-SEP-1995', 'DD-MON-YYYY'),'YEAR') from dual;

  1. 01-SEP-1995
  2. 01-JAN-1995
  3. 01-JAN-1996
  4. 1995
  5. 1996
Question 9 Multiple Choice (Single Answer)

Identify the correct output --- select ADD_MONTHS(TO_DATE('01-SEP-1995', 'DD-MON-YYYY'), 6) from dual;

  1. 01-MAR-1996
  2. 01-FEB-1996
  3. 07-SEP-1995
  4. 06-SEP-1995
Question 10 Multiple Choice (Single Answer)

Identify the correct output --- select LAST_DAY(TO_DATE('01-SEP-1995', 'DD-MON-YYYY')) from dual;

  1. 31-AUG-1995
  2. 30-SEP-1995
  3. 31-OCT-1995
  4. 31-DEC-1995
Question 11 Multiple Choice (Multiple Answers)

Which functions mentioned below are GROUP functions? Choose all that apply

  1. ADD_MONTHS
  2. COUNT
  3. ROUND
  4. DISTINCT
  5. AVG
  6. SUM
Question 12 True/False

WHERE clause is used to restrict groups

  1. True
  2. False
Question 13 Multiple Choice (Multiple Answers)

One can NOT delete a row from the VIEW if view definition contains ... Choose all that apply

  1. WHERE clause
  2. GROUP BY clause
  3. GROUP functions
  4. DISTINCT keyword
  5. FROM clause
Question 14 Multiple Choice (Single Answer)

An application developer wants to query row count of a table, ORDERS which has millions of records. ORDERS table has composite PRIMARY KEY on (ORDER_ID, CUSTOMER_ID) columns and those two columns appear at position 1 and 2 respectively in the ORDERS table. Which query will be more efficient?

  1. select count(*) from orders;
  2. select count(1) from orders;
  3. select count(3) from orders;
  4. select count(5) from orders;
Question 15 Multiple Choice (Multiple Answers)

Identify the MANDATORY sections of a PL/SQL block

  1. DECLARE
  2. BEGIN
  3. EXCEPTION
  4. END
Question 16 True/False

%ROWTYPE attribute is used to declare a variable and associate it's data type with the TABLE/CURSOR object.

  1. True
  2. False
Question 17 Multiple Choice (Multiple Answers)

Within a PL/SQL block, which commands are allowed? Choose all that apply

  1. SELECT
  2. CREATE
  3. DELETE
  4. DROP
  5. UPDATE
  6. INSERT
Question 18 True/False

INSERT, UPDATE, DELETE commands when used in a PL/SQL block, should contain INTO clause to hold the data returned by SQL statement

  1. True
  2. False
Question 19 Multiple Choice (Single Answer)

IF-THEN-ELSE-ENDIF construct is used for conditional control in a PL/SQL block. What happens if the condition in IF-THEN-ELSE-ENDIF block evaluates to NULL?

  1. The SQL statements in the IF condition are processed.
  2. The SQL statements in the ELSE condition are processed.
  3. IF-THEN-ELSE-ENDIF construct is skipped.
  4. The SQL statements in the IF condition as well as ELSE condition are processed.
Question 20 Multiple Choice (Multiple Answers)

Identify the ITERATIVE control constructs in PL/SQL. Choose all that apply

  1. Cursors
  2. Cursor For Loop
  3. Simple Loop
  4. Exit Loop
  5. Numeric For Loop
  6. While Loop