- 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.
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 - What is the output of the following code?
DECLARE x number := 4; BEGIN LOOP dbms_output.put_line(x); x := x + 1; exit WHEN x > 5; END LOOP; dbms_output.put_line(x); END;
Answer : A
Q 4 - Consider a variable named greetings declared as −
greetings varchar2(11) := 'Hello World';
What will be the output of the code snippet
dbms_output.put_line ( SUBSTR (greetings, 7, 5));
Answer : A
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 - 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 - Triggers are written to be executed in response to any of the following events −
A - A database manipulation (DML) statement (DELETE, INSERT, or UPDATE).
B - A database definition (DDL) statement (CREATE, ALTER, or DROP).
C - A database operation (SERVERERROR, LOGON, LOGOFF, STARTUP, or SHUTDOWN).
Answer : D
Q 8 - Which of the following is not true about PL/SQL package specifications?
A - The specification is the interface to the package.
C - It contains all information about the content of the package and the code for the subprograms.
Answer : C
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.
To Continue Learning Please Login
Login with Google