Multiple Choice Questions on PL/SQL
PLSQL - Procedural Language/SQL
Advantage : It offers extensive error checking ,
numerous data types and
a variety of programming structures.
Q1. 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.
Ans : c
Q2. Consider the following code snippet: how many times the loop will run?
DECLARE
a number(2);
BEGIN
FOR a in 10 .. 20 LOOP
END LOOP;
END;
A - 11
B - 10
C - 9
D - Infinite loop
Ans : A
Q3. Which of the following is true about PL/SQL package body?
A - The package body has the codes for various methods declared in the package specification and other private declarations.
B - It is created using the CREATE PACKAGE Statement.
C - The codes, methods and types declared in package body are not hidden from code outside the package.
D - All of the above.
Ans : A
Q4. 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;
Ans :A
Q5. PL/SQL programs are written as lines of text using a specific set of characters.
a. Upper- and lower-case letters A .. Z and a .. z
b. Numerals 0 .. 9
c. Symbols ( ) + - * / < > = ! ~ ^ ; : . ' @ % , " # $ & _ | { } ? [ ]
d. Tabs, spaces, and carriage returns
e. All mentioned above
Ans : e
Q6. Which statements execute a sequence of statements multiple times?
a. EXIT
b. LOOP
c. Both A & B
d. None of the above
Ans : b
Q7. A Variable in PL/SQL should not exceed –
a. 10 b. 20
c. 30 d. 40
Ans : c
Q8. What is the syntax of PL/SQL Loop?
a. LOOP
END LOOP;
Sequence of statements;
b. END LOOP;
LOOP
Sequence of statements;
c. LOOP
Sequence of statements;
END LOOP;
d. END LOOP;
Sequence of statements;
LOOP
Ans : c
Q9. How many types of PL/SQL Loops are there?
a. 3 b. 5
c. 4 d. 6
Ans: c
Q10. In order to remove the PL/SQL function, which function is used?
a. REMOVE FUNCTION b. DELETE FUNCTION
c. ERASE FUNCTION d. DROP FUNCTION
Ans: d
Q11. ____________is not a PL/SQL unit.
A. Type
B.Table
C.Trigger
D.none
Ans : Table
Comments
Post a Comment