- 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.
Answer : A
Q 2 - What will be the output of the following code snippet?
DECLARE
a number (2) := 21;
b number (2) := 10;
BEGIN
IF ( a <= b ) THEN
dbms_output.put_line(a);
END IF;
IF ( b >= a ) THEN
dbms_output.put_line(a);
END IF;
IF ( a <> b ) THEN
dbms_output.put_line(b);
END IF;
END;
Answer : C
Q 3 - Which of the following is not true about labelling PL/SQL loops?
A - PL/SQL loops can be labelled.
B - The label should be enclosed by angle brackets (< and >).
C - The label name appears at the beginning of the LOOP statement.
D - The label name can also appear at the end of the LOOP statement or with an EXIT statement.
Answer : B
Explanation
The label should be enclosed by double angle brackets (<< and >>)
Q 4 - Which of the following is not true about the PL/SQL data structure VARRAY?
A - In oracle environment, the starting index for VARRAYs is always 1.
Answer : D
Q 5 - What would be the output of the following code?
DECLARE
a number;
b number;
c number;
FUNCTION fx(x IN number, y IN number)
RETURN number
IS
z number;
BEGIN
IF x > 2*y THEN
z:= x;
ELSE
z:= 2*y;
END IF;
RETURN z;
END;
BEGIN
a:= 23;
b:= 47;
c := fx(a, b);
dbms_output.put_line(c);
END;
Answer : C
Q 6 - The following code tries to fetch some information from all the rows in a table named customers for use in a PL/SQL block. What is wrong in the following code?
DECLARE
c_id customers.id%type;
c_name customers.name%type;
c_addr customers.address%type;
CURSOR c_customers is
SELECT id, name, address FROM customers;
BEGIN
LOOP
FETCH c_customers into c_id, c_name, c_addr;
EXIT WHEN c_customers%notfound;
dbms_output.put_line(c_id || ' ' || c_name || ' ' || c_addr);
END LOOP;
CLOSE c_customers;
END;
Answer : B
Q 7 - Which of the following is true for querying a table in the same trigger?
Answer : A
Q 8 - Which of the following is true about PL/SQL package body?
Answer : A
Q 9 - Which of the following code is the correct syntax for creating a nested table named salary that will store integer values?
A - TYPE salary IS TABLE OF INTEGER;
B - TYPE salary IS NESTED TABLE OF INTEGER;
Answer : A
Q 10 - Which of the following is true about the inheritance for PL/SQL Objects?
A - PL/SQL allows creating object from existing base objects.
B - To implement inheritance, the base objects should be declared as NOT FINAL.
C - The NOT INSTANTIABLE clause allows you to declare an abstract object.