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 4 - Which of the following is the correct syntax for creating a VARRAY named grades, which can hold 100 integers, in a PL/SQL block?

A - TYPE grades IS VARRAY(100) OF INTEGERS;

B - VARRAY grades IS VARRAY(100) OF INTEGER;

C - TYPE grades VARRAY(100) OF INTEGER;

D - TYPE grades IS VARRAY(100) OF INTEGER;

Answer : D

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 6 - Consider the exception declared as −

emp_exception1 EXCEPTION;

Which of the following statement will correctly call the exception in a PL/SQL block?

A - IF c_id <= 0 THEN ex_invalid_id;

B - IF c_id <= 0 THEN CALL ex_invalid_id;

C - IF c_id <= 0 THEN RAISE ex_invalid_id;

D - IF c_id <= 0 THEN EXCEPTION ex_invalid_id;

Answer : C

plsql_questions_answers.htm
Advertisements