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

Answer : B

Answer : B

Explanation

The label should be enclosed by double angle brackets (<< and >>)

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 5 - What would be the output of the following code?

DECLARE
   num number;
   fn number;

FUNCTION fx(x number)
RETURN number 
IS
   f number;
BEGIN
   IF x=0 THEN
      f := 1;
   ELSE
      f := x * fx(x-1);
   END IF;
RETURN f;
END;

BEGIN
   num:= 5;
   fn := fx(num);
   dbms_output.put_line(fn);
END;

A - 1

B - 5

C - 10

D - 125

Answer : D

Q 6 - Which of the following code will open a cursor named cur_employee?

A - OPEN cur_employee;

B - OPEN CURSOR cur_employee;

C - FETCH cur_employee;

D - FETCH CURSOR cur_employee;

Answer : A

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

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

plsql_questions_answers.htm
Advertisements