- PL/SQL Tutorial
- 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 Useful Resources
- PL/SQL - Questions and Answers
- PL/SQL - Quick Guide
- PL/SQL - Useful Resources
- PL/SQL - Discussion
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 - Which of the following is true about scalar data types in PL/SQL?
A - They hold single values with no internal components.
B - Examples of scalar data types are NUMBER, DATE, or BOOLEAN.
Answer : D
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 - Consider the following code snippet: what will be the output?
DECLARE a number(2) ; BEGIN FOR a IN REVERSE 10 .. 20 LOOP END LOOP; dbms_output.put_line(a); END;
Answer : B
Q 5 - What would be the output of the following code?
DECLARE num number; fn number; FUNCTION fx(x number) RETURN number IS f number; BEGIN IF x=0 THEN f := 1; ELSE f := x * fx(x-1); END IF; RETURN f; END; BEGIN num:= 5; fn := fx(num); dbms_output.put_line(fn); END;
Answer : D
Q 6 - Which of the following code will open a cursor named cur_employee?
Answer : A
Q 7 - Observe the syntax given below −
CREATE [OR REPLACE ] TRIGGER trigger_name {BEFORE | AFTER | INSTEAD OF } {INSERT [OR] | UPDATE [OR] | DELETE} [OF col_name] ON table_name [REFERENCING OLD AS o NEW AS n] [FOR EACH ROW] WHEN (condition) DECLARE Declaration-statements BEGIN Executable-statements EXCEPTION Exception-handling-statements END;
The {INSERT [OR] | UPDATE [OR] | DELETE} clause specifies a
Answer : B
Q 8 - Which of the following statement will create the specification for a package named cust_sal
A -
CREATE PACKAGE BODY cust_sal AS
PROCEDURE find_sal(c_id customers.id%type);
END cust_sal;
B -
CREATE PACKAGE cust_sal AS
PROCEDURE find_sal(c_id customers.id%type);
END cust_sal;
D -
PACKAGE cust_sal AS
PROCEDURE find_sal(c_id customers.id%type);
END cust_sal;
Answer : B
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);
To Continue Learning Please Login
Login with Google