- 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 Mock Test
This section presents you various set of Mock Tests related to PL/SQL. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
PL/SQL Mock Test IV
Q 1 - Which of the following statement will create the specification for a package named cust_sal
A -
CREATE PACKAGE BODY cust_sal AS
PROCEDURE find_sal(c_id customers.id%type);
END cust_sal;
B -
CREATE PACKAGE cust_sal AS
PROCEDURE find_sal(c_id customers.id%type);
END cust_sal;
D -
PACKAGE cust_sal AS
PROCEDURE find_sal(c_id customers.id%type);
END cust_sal;
Answer : B
Q 2 - Which of the following syntax will be used to access a package element?
A - package_name element_name;
B - element_name.package_name;
Answer : C
Q 3 - 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 4 - Which of the following is a PL/SQL collection types?
A - Index-by tables or Associative array
Answer : D
Q 5 - 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 6 - Which of the following code is the correct syntax for creating an index-by table named salary that will store integer values along with names and the name field will be the key?
A - TYPE salary IS TABLE OF NUMBER INDEX BY VARCHAR2(20);
B - CREATE TABLE salary OF NUMBER INDEX BY VARCHAR2(20);
C - TYPE salary IS INDEXED TABLE OF NUMBER INDEX BY VARCHAR2(20);
Answer : A
Q 7 - Which of the following is true about PL/SQL nested tables?
A - Nested tables are like one-dimensional arrays with arbitrary number of elements.
Answer : D
Q 8 - Which of the following is not true about PL/SQL nested tables?
B - A nested table can be stored in a database column.
C - Elements of a nested table could be a %ROWTYPE of any database table.
D - Elements of a nested table could also be %TYPE of any database table field.
Answer : A
Q 9 - Which of the following code is the correct syntax for creating a nested table named salary that will store integer values?
A - TYPE salary IS TABLE OF INTEGER;
B - TYPE salary IS NESTED TABLE OF INTEGER;
Answer : A
Q 10 - 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 11 - The collection method LAST
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 : A
Q 12 - The collection method COUNT
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 : B
Q 13 - Which of the following is not true about database transactions?
A - A database transaction is an atomic unit of work.
B - It may consist of one or more related SQL statements.
C - A successfully executed SQL statement and a committed transaction are not same.
Answer : D
Q 14 - Which of the following is true about database transactions?
Answer : D
Q 15 - 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 17 - Savepoints are set to
A - Help in splitting a long transaction into smaller units.
B - Help in rolling back to some checkpoint, within a long transaction.
Answer : D
Q 18 - 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
Answer : A
Q 19 - Which of the following is not true about object oriented PL/SQL?
A - It helps in designing object-oriented database in Oracle.
B - An object type allows you to crate composite types.
C - Objects are created using the CREATE [OR REPLACE] CLASS statement.
Answer : C
Q 20 - Which of the following code will create an object type named local_address with two field house_no and street?
A -
CREATE OR REPLACE OBJECT local_address
(house_no varchar2(10),
street varchar2(30),
);
B -
CREATE OR REPLACE TYPE local_address AS OBJECT
(house_no varchar2(10),
street varchar2(30),
);
C -
CREATE OR REPLACE OBJECT local_address AS
(house_no varchar2(10),
street varchar2(30),
);
D -
CREATE OR REPLACE CLASS local_address
(house_no varchar2(10),
street varchar2(30),
);
Answer : B
Q 21 - Which of the following is true about member methods?
A - Member methods are used for manipulating the attributes of the object.
B - Declaration of a member method is provided while declaring the object type.
C - The object body defines the code for the member methods.
Answer : D
Q 22 - 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.
Answer : D
Q 23 - Which of the following is not true about the comparison methods?
A - These are used for comparing objects.
C - The Order methods implement some internal logic for comparing two objects.
Answer : B
Explanation
The Map method is a function implemented in such a way that its value depends upon the value of the attributes.
Q 24 - Which of the following is true about the inheritance for PL/SQL Objects?
A - PL/SQL allows creating object from existing base objects.
B - To implement inheritance, the base objects should be declared as NOT FINAL.
C - The NOT INSTANTIABLE clause allows you to declare an abstract object.
Answer : D
Q 25 - 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
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | C |
3 | A |
4 | D |
5 | D |
6 | A |
7 | D |
8 | A |
9 | A |
10 | C |
11 | A |
12 | B |
13 | D |
14 | D |
15 | D |
16 | D |
17 | D |
18 | A |
19 | C |
20 | B |
21 | D |
22 | D |
23 | B |
24 | D |
25 | C |
To Continue Learning Please Login
Login with Google