- 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 true about the PL/SQL language?
A - PL/SQL provides access to predefined SQL packages.
B - PL/SQL provides support for Object-Oriented Programming.
C - PL/SQL provides support for Developing Web Applications and Server Pages.
Answer : D
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 - Consider the following code snippet: how many times the loop will run?
DECLARE a number(2); BEGIN FOR a in 10 .. 20 LOOP END LOOP; END;
Answer : A
Q 5 - Which of the following is not true about the PL/SQL functions?
A - A PL/SQL function is same as a procedure except that it returns a value.
B - The function body must contain a RETURN statement.
C - The RETURN clause does not specify the data type of the return value.
D - The AS keyword is used instead of the IS keyword for creating a standalone function.
Answer : C
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 - 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 not true about PL/SQL collections?
A - A collection is an ordered group of elements having the same data type.
B - A collection is an ordered group of elements having different data type.
C - Each element is identified by a unique subscript that represents its position in the collection.
D - Nested tables and Varrays are types of PL/SQL collections.
Answer : A
Q 9 - The collection method LIMIT
A - Returns the last (largest) index numbers in a collection that uses integer subscripts.
B - Returns the number of elements that a collection currently contains.
Answer : C
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