PL/SQL Online Quiz


Advertisements

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 wrong in the following code snippet?

DECLARE
   x number := 1;
BEGIN
   LOOP
      dbms_output.put_line(x);
      x := x + 1;
      IF x > 10 THEN
         exit;
      END IF;
     dbms_output.put_line('After Exit x is: ' || x);
END;

A - There is nothing wrong.

B - The IF statement is not required.

C - There should be an END LOOP statement.

D - The exit statement should be in capital letters.

Answer : C

Q 5 - What would be the output of the following code?

DECLARE
   a number;
   b number;
   c number;
FUNCTION fx(x IN number, y IN number) 
RETURN number
IS
    z number;
BEGIN
   IF x > 2*y THEN
      z:= x;
   ELSE
      z:= 2*y;
   END IF;

   RETURN z;
END; 
BEGIN
   a:= 23;
   b:= 47;

   c := fx(a, b);
   dbms_output.put_line(c);
END;

A - 46

B - 47

C - 94

D - 23

Answer : C

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;

The {INSERT [OR] | UPDATE [OR] | DELETE} clause specifies a

A - DDL operation.

B - DML operation.

C - None of the above.

D - Both of the above.

Answer : B

plsql_questions_answers.htm
Advertisements