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.

Questions and Answers

PL/SQL Mock Test IV

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;

C - package_name.element_name;

D - None of the above.

Answer : C

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);

D - None of the above.

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;

C - TABLE salary IS NESTED BY INTEGER;

D - TABLE salary IS INDEXED BY INTEGER;

Answer : A

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;

A - Hello!

     Hope you are doing well!

B - He

     Ho

C - Hello!

     Hope you

D - Hello!

Answer : A

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 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.

D - None of the above

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
plsql_questions_answers.htm
Advertisements