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 - Which of the following is true about the following PL/SQL CASE statement syntax?

CASE selector
    WHEN 'value1' THEN S1;
    WHEN 'value2' THEN S2;
    WHEN 'value3' THEN S3;
    ...
    ELSE Sn;  -- default case
END CASE;

A - It is wrongly written.

B - It is perfectly written.

C - It is you can specify the literal NULL for all the S expressions and the default Sn.

D - All the expressions like the selector, the value and the returns values, need not be of the same data type.

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;

The INSTEAD OF clause is used for creating trigger on a −

A - View

B - Cursor

C - Table

D - Index

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


plsql_questions_answers.htm

Advertisements