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.

Questions and Answers

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;

A - 4

     5

     6

B - 4

     5

C - 4

D - None of the above.

Answer : A

Q 4 - Consider the following code snippet: what will be the output?

DECLARE
   a number(2) ;
BEGIN
   FOR a IN REVERSE 10 .. 20 LOOP
   END LOOP;
dbms_output.put_line(a);
END;

A - 11

B - 10

C - 29

D - 30

Answer : B

Q 6 - Which of the following code will successfully declare an exception named emp_exception1 in a PL/SQL block?

A - EXCEPTION emp_exception1;

B - emp_exception1 EXCEPTION;

C - CREATE EXCEPTION emp_exception1;

D - CREATE emp_exception1 AS EXCEPTION;

Answer : B

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?

A - This provides a condition for rows for which the trigger would fire and this clause is valid only for row level triggers.

B - This provides a condition for rows for which the trigger would fire and this clause is valid only for table level triggers.

C - This provides a condition for rows for which the trigger would fire and this clause is valid only for view based triggers.

D - All of the above.

Answer : A

Q 8 - 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

plsql_questions_answers.htm
Advertisements