- 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 declaration section of a PL/SQL block?
A - This section starts with the DECLARE keyword.
B - It is a mandatory section.
C - It defines all variables, cursors, subprograms, and other elements to be used in the program.
Answer : B
Q 2 - Consider the following code −
DECLARE
-- Global variables
num number := 95;
BEGIN
dbms_output.put_line('num: ' || num1);
DECLARE
-- Local variables
num number := 195;
BEGIN
dbms_output.put_line('num: ' || num1);
END;
END;
What will happen when the code is executed?
A - It wont execute, it has syntax error
B - It will print num: 95 num: 195
Answer : B
Q 3 - Which of the following is true about the following PL/SQL CASE statement syntax?
CASE selector
WHEN 'value1' THEN S1;
WHEN 'value2' THEN S2;
WHEN 'value3' THEN S3;
...
ELSE Sn; -- default case
END CASE;
C - It is you can specify the literal NULL for all the S expressions and the default Sn.
Answer : B
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 - Which of the following is not true about PL/SQL cursors?
A - A cursor is a view on a table.
B - A cursor holds the rows (one or more) returned by a SQL statement.
C - The set of rows the cursor holds is referred to as the active set.
Answer : A
Explanation
A cursor is a memory area, known as context area, for processing an SQL statement, which contains all information needed for processing the statement.
Q 6 - Which of the following code correctly create a record named book with two field title and author?
A - TYPE book IS RECORD
(title varchar(50),
author varchar(50),
);
B - RECORD book
(title varchar(50),
author varchar(50),
);
C - CREATE RECORD book
(title varchar(50),
author varchar(50),
);
D - CREATE TYPE book
(title varchar(50),
author varchar(50),
);
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;
Which of the following holds true for the WHEN clause?
Answer : A
Q 8 - Which of the following is a PL/SQL collection types?
A - Index-by tables or Associative array
Answer : D
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 - 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.