PLSQL Mock Test I
PLSQL Mock Test I
PLSQL Mock Test I
This section presents you various set of Mock Tests related to PL/SQL. You can download these
sample mock tests at your local machine and solve offline at your convenience. Every mock test is
supplied with a mock test key to let you verify the final score and grade yourself.
A - PL/SQL's general syntax is based on that of ADA and Pascal programming language.
B - Apart from Oracle, PL/SQL is available in TimesTen in-memory database and IBM DB2.
C - PL/SQL provides support for Developing Web Applications and Server Pages.
Q 4 - Which of the following is not true about the declaration section of a PL/SQL
block?
C - It defines all variables, cursors, subprograms, and other elements to be used in the program.
Q 5 - Which of the following is true about the execution section of a PL/SQL block?
B - It is a mandatory section.
Q 6 - Which of the following is not true about the execution section of a PL/SQL block?
B - It may have just a NULL command to indicate that nothing should be executed.
D - The section may contain SQL commands, logical control commands, assignment commands,
as well as other commands.
Q 7 - Which of the following is not true about the exception handling section of a
PL/SQL block?
B - It is a mandatory section.
C - The PL/SQL single-line comments start with the delimiter -- doublehyphen and multi-line
comments are enclosed by /* and */.
A - Table
B - Type
C - Trigger
D - Package
Q 10 - Which of the following is true about data types in PL/SQL?
A - Large Object or LOB data types are pointers to large objects that are stored separately from
other data items, such as text, graphic images, video clips, and sound waveforms.
B - The composite data types have data items that have internal components that can be
accessed individually. For example, collections and records.
Q 12 - Which of the following is true about character data types and subtypes in
PL/SQL?
D - NCHAR is a variable-length national character string with maximum size of 32,767 bytes.
Q 13 - Which of the following is not true about large object data types and in PL/SQL?
A - BFILE is used to store large binary objects in operating system files outside the database.
counter binary_integer;
A-0
B-1
C - NULL
B - It will print
num: 95
num: 195
C - It will print
num: 95
num: 95
D - It will print
num: 195
num: 195
DECLARE
c_id := 1;
c_name customers.name%type;
c_addr customers.address%type;
BEGIN
SELECT name, address INTO c_name, c_addr
FROM customers
WHERE id = c_id;
END;
A - You cannot use the SELECT INTO statement of SQL to assign values to PL/SQL variables.
B - The SELECT INTO statement here is wrong. It should be: SELECT c_name, c_address INTO
name, addr
c_id customers.id%type := 1;
Q 17 - Which of the following is not true about PL/SQL constants and literals?
A - A constant holds a value that once declared, does not change in the program.
DECLARE
a number (2) := 21;
b number (2) := 10;
BEGIN
IF ( a <= b ) THEN
dbms_output.put_line(a);
END IF;
IF ( b >= a ) THEN
dbms_output.put_line(a);
END IF;
IF ( a <> b ) THEN
dbms_output.put_line(b);
END IF;
END;
A-2
B - 21
C - 10
D - 21, 10
DECLARE
x NUMBER;
BEGIN
x := 5;
x := 10;
dbms_output.put_line(-x);
dbms_output.put_line(+x);
x := -10;
dbms_output.put_line(-x);
dbms_output.put_line(+x);
END;
A - -10
10
10
-10
B - 10
-10
10
-10
C - -10
+10
+10
-10
D - 10
-10
-10
10
Q 20 - To get the server output result and display it into the screen, you need to write
A - set serveroutput on
C - set dbmsoutput on
Q 21 - Which of the following is not true about PL/SQL decision making structures?
B - The IF statement also adds the keyword ELSE followed by an alternative sequence of
statement.
DECLARE
a number(3) := 100;
BEGIN
IF (a = 50 ) THEN
dbms_output.put_line('Value of a is 10' );
ELSEIF ( a = 75 ) THEN
dbms_output.put_line('Value of a is 20' );
ELSE
dbms_output.put_line('None of the values is matching');
END IF;
dbms_output.put_line('Exact value of a is: '|| a );
END;
C - It will print
DECLARE
a number(3) := 100;
BEGIN
IF (a = 50 ) THEN
dbms_output.put_line('Value of a is 10' );
ELSIF ( a = 75 )
dbms_output.put_line('Value of a is 20' );
ELSE
dbms_output.put_line('None of the values is matching');
END IF;
dbms_output.put_line('Exact value of a is: '|| a );
END;
C - It will print
Q 24 - 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.
DECLARE
grade char(1) := 'B';
BEGIN
case
when grade = 'A' then dbms_output.put_line('Excellent');
when grade = 'B' then dbms_output.put_line('Very good');
when grade = 'C' then dbms_output.put_line('Well done');
when grade = 'D' then dbms_output.put_line('You passed');
when grade = 'F' then dbms_output.put_line('Better try again');
else dbms_output.put_line('No such grade');
end case;
END;
B-B
C - Very good
D - No such grade
ANSWER SHEET
1 C
2 D
3 D
4 B
5 D
6 A
7 B
8 D
9 A
10 D
11 D
12 A
13 B
14 C
15 B
16 D
17 B
18 C
19 A
20 A
21 D
22 A
23 A
24 B
25 C
Loading [MathJax]/jax/output/HTML-CSS/jax.js