PL/SQL Test Questions Set 1

1)   PL/SQL is a completely portable, high-performance transaction processing language.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
PL/SQL is a completely portable, high-performance transaction processing language because of the following advantages:-

- Support for SQL
- Support for object-oriented programming
- Better performance
- Higher productivity
- Full portability
- Tight integration with Oracle
- Tight security


2)   PL/SQL stored procedures move application code from the server to the client.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
A stored procedure has its own limitations. All the applications are stored on the server and they can be accessed by the clients. If it is stored on clients it becomes difficult to access.


3)   Which is a simple or compound symbol that has a special meaning to PL/SQL?

a. Delimiters
b. Identifiers
c. Literals
d. Comments
Answer  Explanation 

ANSWER: Delimiters

Explanation:
A delimiter is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data streams.


4)   How many types of literals are available in PL/SQL?

a. 6
b. 2
c. 5
d. 4
Answer  Explanation 

ANSWER: 5

Explanation:
PL/SQL supports the following kinds of literals:

- Numeric Literals
- Character Literals
- String Literals
- BOOLEAN Literals
- Date and Time Literals


5)   Which operator tests set membership?

a. IN Operator
b. BETWEEN Operator
c. LIKE Operator
d. IS NULL Operator
Answer  Explanation 

ANSWER: IN Operator

Explanation:
The IN condition helps to reduce the need to use multiple OR conditions.


6)   Which of the following has internal components that can be manipulated individually, such as the elements of an array, record, or table?

a. A Composite
b. A LOB
c. A Reference
d. A Scalar
Answer  Explanation 

ANSWER: A Composite

Explanation:
A composite has internal components that can be accessed from anywhere.


7)   Which subtypes are used to declare fixed-point numbers with a maximum precision of 38 decimal digits?

a. INTEGER,INT,SMALLINT
b. DOUBLE PRECISION,FLOAT
c. DEC,DECIMAL,NUMERIC
d. None of the above
Answer  Explanation 

ANSWER: DEC,DECIMAL,NUMERIC

Explanation:
No explanation is available for this question!


8)   A RECORD is a collection of data items, which differ from each other in data type, but are logically related.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


9)   What is the maximum number of ELSE clauses that can be included in an IF clause that is not nested?

a. 1
b. 0
c. 15
d. Any number
Answer  Explanation 

ANSWER: 1

Explanation:
We can have else clause for every IF clause. But if the IF clause is not nested there is only one else.


10)   Which structure executes a sequence of statements repeatedly as long as a condition holds true?

a. Selection structure
b. Iteration structure
c. Sequence structure
d. None of the above
Answer  Explanation 

ANSWER: Iteration structure

Explanation:
The iteration structure is obtained by the use of loop constructs.


11)   “NO_DATA_FOUND” and “TOO_MANY_ROWS” are the two most common errors found when executing a SELECT statement.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
The “NO_DATA_FOUND” error is where the program is not able to find any data. This type of error can be trapped by the exception block.
The “TOO_MANY_ROWS” error is where one row data is conflicting with another row data so it is unable to fetch a particular data. This error too can be trapped by the exception block.


12)   Varrays are a good choice when -

a. The number of elements is known in advance.
b. The elements are usually all accessed in sequence.
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
A varray can store a fixed sequential collection of elements of the same type. It is used to store ordered collection of data.


13)   A collection method is a built-in function or procedure that operates on collections and is called using dot notation.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


14)   When building up a single SQL statement in a string, do not include any semicolon at the end.

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
When we are building a single statement we need not add a semicolon at the end but if we are creating an PL/SQL block then we should add a semicolon at the end of each statement.


15)   Dynamic SQL enables you to build SQL statements dynamically at runtime.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
Dynamic SQL helps to write programs that refer SQL statements whose full text is not known until the runtime.


16)   Which of the following returns the current value in a specified sequence.

a. CURRVAL
b. NEXTVAL
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: CURRVAL

Explanation:
The CURRVAL returns the current value of the sequence.


17)   Which operators combine the results of two queries into one result?

a. Set operator
b. Row Operator
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Set operator

Explanation:
The set operators combines the results of two queries into a single result. Queries which contain these set operators are known as compound queries.


18)   A recursive subprogram is one that calls itself.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
Every recursive call creates a new instance of the items declared in the subprogram including parameters, variables, cursors and exceptions.


19)   Which of the following provides a way for your program to select multiple rows of data from the database and then process each row individually.

a. PL/SQL Cursors
b. PL/SQL Trigger
c. PL/SQL Select
d. PL/SQL Process
Answer  Explanation 

ANSWER: PL/SQL Cursors

Explanation:
Oracle creates a memory area which is known as the context area where the SQL statement is processed and which contains all the information which is needed for the processing. The cursor is the pointer to this context area.


20)   Abbreviate SMTP?

a. Single Mail Transaction Protocol
b. Simple Mail Transfer Protocol
c. Simple Mail Transaction Protocol
d. Simple Mail Transfer Package
Answer  Explanation 

ANSWER: Simple Mail Transfer Protocol

Explanation:
SMTP is an internet standard email transmission. This protocol is widespread used today. It by default uses TCP port 25.


21)   Packages HTF and HTP allow your PL/SQL programs to generate HTML tags.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


22)   PL/SQL Exception message consists of -

a. Type of Exception
b. An Error Code
c. A message
d. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
The exception is written in an block called as the exception block. The errors are described in this block.


23)   The keyword All is a shorthand way to refer to all warning messages.

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
The all keyword will handle all the errors. We need not name any of the error in specific.


24)   The subprogram is called through a database link or as an external procedure.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
The NOCOPY is a hint and not a directive means that the compiler can ignore and pass the parameters by value without producing the errors. The above statement is a situation where the NOCOPY hint will be ignored.


25)   The values of any IN OUT parameters are copied before the subprogram is executed.

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
The IN OUT parameters are passed by values by default. During the subprogram execution the temporary variables hold the output parameter values. If the program is normal the values are copied to the actual parameters. If the program exits with an unhandled exception the original parameters remain unchanged.