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.
Q 1 - Which of the following is not true about the declaration section of a PL/SQL block?
A - This section starts with the DECLARE keyword.
B - It is a mandatory section.
C - It defines all variables, cursors, subprograms, and other elements to be used in the program.
D - None of the above.
Q 2 - Which of the following is true about scalar data types in PL/SQL?
A - They hold single values with no internal components.
B - Examples of scalar data types are NUMBER, DATE, or BOOLEAN.
C - PL/SQL provides subtypes of data types.
D - All are true.
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.
Q 4 - A subprogram can be created −
A - At schema level.
B - Inside a package.
C - Inside a PL/SQL block.
D - All of the above.
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
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;
Q 7 - Which of the following is not true about PL/SQL triggers?
A - Triggers are stored programs.
B - They are automatically executed or fired when some events occur.
C - Triggers could be defined on the table, view, schema, or database with which the event is associated.
D - None of the above.
Q 8 - Which of the following is not true about PL/SQL packages?
A - PL/SQL packages are schema objects that groups logically related PL/SQL types, variables and subprograms.
B - A package has two parts: Package specification and Package body or definition.
C - Both the parts are mandatory.
D - None of the above.
Q 9 - Which of the following is true about PL/SQL nested tables?
A - Nested tables are like one-dimensional arrays with arbitrary number of elements.
B - Unlike arrays a nested table doesn’t have declared number of elements. The size of a nested table can increase dynamically.
C - Initially a nested array has consecutive subscripts or dense, but it can become sparse when elements are deleted from it.
D - All of the above.
Q 10 - Which of the following is not true about the comparison methods?
A - These are used for comparing objects.
B - The Map method is a function implemented in such a way that its value doesn’t depend upon the value of the attributes.
C - The Order methods implement some internal logic for comparing two objects.
D - None of the above. 
The Map method is a function implemented in such a way that its value depends upon the value of the attributes.
 Print
 Add Notes
 Bookmark this page