- 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 execution section of a PL/SQL block?
A - It should have more than one executable line of code.
B - It may have just a NULL command to indicate that nothing should be executed.
Answer : A
Q 2 - What is wrong in the following code?
DECLARE c_id := 1; c_name customers.name%type; c_addr customers.address%type; BEGIN SELECT name, address INTO c_name, c_addr FROM customers WHERE id = c_id; END;
A - You cannot use the SELECT INTO statement of SQL to assign values to PL/SQL variables.
B - The SELECT INTO statement here is wrong. It should be: SELECT c_name, c_address INTO name, addr
C - The WHERE statement is wrong. It should be: WHERE id := c_id;
D - The variable c_id should be declared as a type-compatible variable as −
c_id customers.id%type := 1;
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 - Which of the following is true about the parameter modes in PL/SQL Subprograms?
A - An IN parameter lets you pass a value to the subprogram. It is a read-only parameter.
B - An OUT parameter returns a value to the calling program.
Answer : D
Q 5 - Observe the following code and fill in the blanks −
DECLARE total_rows number(2); BEGIN UPDATE employees SET salary = salary + 500; IF ____________ THEN dbms_output.put_line('no employees selected'); ELSIF ___________ THEN total_rows := _____________; dbms_output.put_line( total_rows || ' employees selected '); END IF; END;
A - %notfound, %found, %rowcount.
B - sql%notfound, sql%found, sql%rowcount.
Answer : B
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 - 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 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 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 not true about the Constructors?
A - These are functions that return a new object as its value.
B - Every object has a system defined constructor method.
To Continue Learning Please Login
Login with Google