- 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 PL/SQL language?
A - It supports embedded SQL statements.
B - It has all the features of a modern structured programming language.
Answer : C
Q 2 - Which of the following is true about character data types and subtypes in PL/SQL?
A - LONG is a variable-length character string with maximum size of 32,760 bytes.
B - ROWID is a physical column identifier, the address of a column in an ordinary table.
C - CHAR is a variable-length character string with maximum size of 32,767 bytes.
D - NCHAR is a variable-length national character string with maximum size of 32,767 bytes.
Answer : A
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 - 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 will be printed by the following PL/SQL block?
DECLARE a number; b number; c number; PROCEDURE findMin(x IN number, y IN number, z OUT number) IS BEGIN IF x < y THEN z:= x; ELSE z:= y; END IF; END; BEGIN a:= 2; b:= 5; findMin(a, b, c); dbms_output.put_line(c); END;
Answer : A
Q 6 - Which of the following code will open a cursor named cur_employee?
Answer : A
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 - 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 - 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 - The following code tries to create a base object named rectangle, which will be inherited. What is wrong in the code?
CREATE OR REPLACE TYPE rectangle AS OBJECT (length number, width number, member function enlarge( inc number) return rectangle, NOT FINAL member procedure display)
A - The declaration should read as CREATE OR REPLACE OBJECT rectangle AS …
B - The base object should not have any member attribute or functions.
C - The base object rectangle should be declared as NOT FINAL.
Answer : C
Explanation
The corrected code is −
CREATE OR REPLACE TYPE rectangle AS OBJECT (length number, width number, member function enlarge( inc number) return rectangle, NOT FINAL member procedure display) NOT FINAL
To Continue Learning Please Login
Login with Google