
- 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 true about comments in PL/SQL?
A - Comments are explanatory statements.
B - PL/SQL supports both single-line and multi-line comments.
Answer : D
Q 2 - Which of the following is not true about PL/SQL constants and literals?
A - A constant holds a value that once declared, does not change in the program.
B - The CONSTANT declaration cannot impose the NOT NULL constraint.
Answer : B
Q 3 - Which of the following is true about the following code snippet?
DECLARE a number(3) := 100; BEGIN IF (a = 50 ) THEN dbms_output.put_line('Value of a is 10' ); ELSEIF ( a = 75 ) THEN dbms_output.put_line('Value of a is 20' ); ELSE dbms_output.put_line('None of the values is matching'); END IF; dbms_output.put_line('Exact value of a is: '|| a ); END;
B - It will print 'None of the values is matching'.
None of the values is matching
Exact value of a is: 100
Answer : A
Explanation
the ELSIF statement is wrongly written as ELSEIF
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 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 - Consider the exception declared as −
emp_exception1 EXCEPTION;
Which of the following statement will correctly call the exception in a PL/SQL block?
A - IF c_id <= 0 THEN ex_invalid_id;
B - IF c_id <= 0 THEN CALL ex_invalid_id;
Answer : C
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 - Any subprogram not in the package specification but coded in the package body is called a
Answer : B
Q 9 - A transaction starts when
A - The first SQL statement is performed after connecting to the database.
B - At each new SQL statement issued after a transaction is completed.
Answer : D
Q 10 - What will be the output of the following code?
DECLARE lines dbms_output.chararr; num_lines number; BEGIN dbms_output.enable; dbms_output.put_line('Hello!'); dbms_output.put_line('Hope you are doing well!'); num_lines := 2; dbms_output.get_lines(lines, num_lines); FOR i IN 1..num_lines LOOP dbms_output.put_line(lines(i)); END LOOP; END;
Hope you are doing well!
Ho
Hope you