
- PL/SQL - Home
- PL/SQL - Overview
- PL/SQL - Environment
- PL/SQL - Basic Syntax
- PL/SQL - Data Types
- PL/SQL - Variables
- PL/SQL - Constants and Literals
- PL/SQL - Operators
- PL/SQL - Conditions
- PL/SQL - Loops
- PL/SQL - Strings
- PL/SQL - Arrays
- PL/SQL - Procedures
- PL/SQL - Functions
- PL/SQL - Cursors
- PL/SQL - Records
- PL/SQL - Exceptions
- PL/SQL - Triggers
- PL/SQL - Packages
- PL/SQL - Collections
- PL/SQL - Transactions
- PL/SQL - Date & Time
- PL/SQL - DBMS Output
- PL/SQL - Object Oriented
PL/SQL Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to PL/SQL. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q 1 - Which of the following is not true about the exception handling section of a PL/SQL block?
A - This section starts with the EXCEPTION keyword.
B - It is a mandatory section.
C - It contains exception(s) that handle errors in the program.
Answer : B
Q 2 - What would be printed when the following code is executed?
DECLARE x NUMBER; BEGIN x := 5; x := 10; dbms_output.put_line(-x); dbms_output.put_line(+x); x := -10; dbms_output.put_line(-x); dbms_output.put_line(+x); END;
Answer : A
Q 3 - What is the output of the following code?
DECLARE x number := 4; BEGIN LOOP dbms_output.put_line(x); x := x + 1; exit WHEN x > 5; END LOOP; dbms_output.put_line(x); END;
Answer : A
Q 4 - Which of the following is not true about the PL/SQL data structure VARRAY?
A - It is a fixed-size sequential collection of elements.
B - The elements can of various data types.
C - It is used to store an ordered collection of data.
D - Each element in a VARRAY has an index associated with it.
Answer : B
Q 5 - What is wrong in the following code snippet?
CREATE OR REPLACE FUNCTION totalCustomers total number(2) := 0; BEGIN SELECT count(*) into total FROM customers; RETURN total; END;
A - It doesnt have the RETURN clause in function declaration.
B - The RETURN statement is wrong.
Answer : A
Explanation
The correct code should be
CREATE OR REPLACE FUNCTION totalCustomers RETURN number IS total number(2) := 0; BEGIN SELECT count(*) into total FROM customers; RETURN total; END;
Q 6 - Which of the following is the correct syntax for creating an explicit cursor?
A - CURSOR cursor_name IS select_statement;
B - CREATE CURSOR cursor_name IS select_statement;
Answer : A
Q 7 - Which of the following is not true about PL/SQL triggers?
A - Triggers are stored programs.
B - They are automatically executed or fired when some events occur.
Answer : D
Q 8 - Which of the following is true about PL/SQL index-by tables?
A - It is a set of key-value pairs.
B - Each key is unique and is used to locate the corresponding value.
Answer : D
Q 9 - Which of the following code is the correct syntax for creating an index-by table named salary that will store integer values along with names and the name field will be the key?
A - TYPE salary IS TABLE OF NUMBER INDEX BY VARCHAR2(20);
B - CREATE TABLE salary OF NUMBER INDEX BY VARCHAR2(20);
C - TYPE salary IS INDEXED TABLE OF NUMBER INDEX BY VARCHAR2(20);