Oracle PL/SQL and SQL Fundamentals

Test your knowledge of Oracle PL/SQL programming concepts including packages, procedures, error handling, and SQL queries with functions, aggregations, and subqueries.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which operator can be used with a multiple-row subquery?

  1. =
  2. LIKE
  3. BETWEEN
  4. NOT IN
  5. Is
  6. <>
Question 2 Multiple Choice (Multiple Answers)

Which three SELECT statements display 2000 in the format "$2,000.00"? (Choose three.)

  1. SELECT TO_CHAR(2000, '$#,###.##') from dual
  2. SELECT TO_CHAR(2000, '$0,000.00') from dual
  3. SELECT TO_CHAR(2000, '$9,999.00') from dual
  4. SELECT TO_CHAR(2000, '$9,999.99') from dual
  5. SELECT TO_CHAR(2000, '$2,000.00') FROM dual;
  6. SELECT TO_CHAR(2000, '$N,NNN.NN') FROM dual;
Question 3 Multiple Choice (Single Answer)

Which of the following correctly describe the aggregate functions?

  1. It returns a single result row based on single rows
  2. It returns a single result row based on groups of rows
  3. It can only appear in ORDER BY clauses
  4. It cannot appear in select lists
Question 4 Multiple Choice (Single Answer)

Which of the following SQL statements can calculate and return the absolute value of -33?

  1. SELECT ABS(-33) "Absolute" FROM DUAL;
  2. SELECT ABS(-33), Absolute FROM DUAL;
  3. SELECT ABS("-33") Absolute FROM DUAL;
  4. None of these
Question 5 Multiple Choice (Single Answer)

What does the following SQL script do? SELECT AVG(MAX(salary)) FROM employees GROUP BY department_id;

  1. it has a syntax error, the AVG clause is not valid
  2. it calculates the average of the maximum salaries of all the departments
  3. it has a syntax error, the MAX clause is not valid
  4. it has no error, but the GROUP BY clause is not effective
Question 6 Multiple Choice (Multiple Answers)

Which are DML statements? (Choose all that apply)

  1. COMMIT
  2. MERGE
  3. UPDATE
  4. DELETE
  5. CREATE
  6. DROP
Question 7 Multiple Choice (Single Answer)

Which Function can return a non-Null value if passed null arguments?

  1. NULLIF
  2. LENGTH
  3. CONCAT
  4. INSTR
  5. TAN
Question 8 True/False

SQL has facility for programmed handling of errors that arise during the manipulation of data.

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

In a PL/SQL block structure, which parts are optional?

  1. a) DELCARE and BEGIN
  2. b) DECALRE and EXCEPTION
  3. c) EXCEPTION and END
  4. d) BEGIN and END
Question 10 True/False

A Rollback statement cannot be used to close transaction.

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

You want to create a PL/SQL block of code that calculates discounts on customer orders. This code will be invoked from several places, but only within the program unit ORDERTOTAL. What is the most appropriate location to store the code that calculates the discounts?

  1. a) A stored procedure on the server.
  2. b) A block of code in a PL/SQL library.
  3. c) A standalone procedure on the client machine.
  4. d) A block of code in the body of the program unit ORDERTOTAL.
  5. e) A local subprogram defined within the program unit ORDERTOTAL.
Question 12 Multiple Choice (Multiple Answers)

Which is the procedure used to issue User-Defined error messages from stored Sub-Programs?

  1. a) Raise Application procedure
  2. b) Raise Application Error procedure
  3. c) Application Error procedure
  4. d) None of the Above
Question 13 Multiple Choice (Single Answer)

Which line of the following code has an error? SELECT * FROM emp WHERE comm = NULL ORDER BY ename;

  1. SELECT *
  2. FROM emp
  3. WHERE comm = NULL
  4. There is no error in this statement.
Question 14 Multiple Choice (Multiple Answers)
  1. Examine this procedure: CREATE OR REPLACE PROCEDURE DELETE_PLAYER(V_IDIN NUMBER) IS BEGIN DELETE FROM PLAYER WHERE ID = V_ID EXCEPTION WHEN STATS_EXIST_EXCEPTION THEN DBMS_OUTPUT.PUT_LINE(Cannotdeletethisplayer, childrecordsexistin PLAYER_BAT_STAT table); END; What prevents this procedure from being created successfully?
  1. a) A comma has been left after the STATS_EXIST_EXCEPTION exception.
  2. b) The STATS_EXIST_EXCEPTION has not been declared as a number.
  3. c) The STATS_EXIST_EXCEPTION has not been declared as an exception.
  4. d) none of the above
Question 15 Multiple Choice (Single Answer)

Which operator will be evaluated first in the following SELECT statement? SELECT (2+3*4/2–5) FROM dual;

  1. +
  2. *
  3. /
Question 16 Multiple Choice (Multiple Answers)

Which two statements about the overloading feature of packages are true? (Choose two)

  1. a) Only local or packaged sub programs can be overloaded.
  2. b) Overloading allows different functions with the same name that differ only in their return types.
  3. c) Overloading allows different subprograms with the same number, type and order of the parameter.
  4. d) Overloading allows different subprograms with the same name and same number or type of the parameters.
  5. e) Overloading allows different subprograms with the same name but different in either number or type or order of parameter.
Question 17 Multiple Choice (Multiple Answers)

Which two statements about packages are true? (Choose two)

  1. a) Packages can be nested.
  2. b) You can pass parameters to packages.
  3. c) A package is loaded into memory each time it is invoked.
  4. d) The contents of packages can be shared by many applications.
  5. e) You can achieve information hiding by making package constructs private.
Question 18 Multiple Choice (Multiple Answers)

Which of the following statements is false with respect to packages?

  1. a) The package itself cannot be called, parameterized, or nested.
  2. b) The format of a package is similar to that of a subprogram.
  3. c) The contents can be shared by many applications once written.
  4. d) None of the above.
Question 19 Multiple Choice (Single Answer)

Private constructs in the package body are hidden and inaccessible. Is this an advantage of a package?

  1. a)Yes
  2. b)No
  3. c)
  4. d)
Question 20 Multiple Choice (Single Answer)

When you use the DEFINE variable command, what datatype is the variable?

  1. VARCHAR2
  2. CHAR
  3. LONG
  4. NUMBER