PL/SQL Test Questions Set 6

1)   Which of the following is used to declare a record?

a. %ROWTYPE
b. %TYPE
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: %ROWTYPE

Explanation:
The %ROWTYPE attribute helps in creating table and cursor based records.


2)   Which of the following has a return type in its specification and must return a value specified in that type?

a. Function
b. Procedure
c. Package
d. None of the above
Answer  Explanation 

ANSWER: Function

Explanation:
Functions in a subprogram act like new expressions and operators. A function computes a value in a subprogram. The function has a return clause.


3)   PL/SQL is completely portable, high-performance transaction processing language that offers which of the following advantages -

a. Tight Integration with SQL
b. Better Performance
c. Higher Productivity,Full Portability,Tight Security
d. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


4)   From the following PL/SQL Delimiters which symbol is exponentiation operator.

a. <>
b. ~=
c. **
d.
Answer  Explanation 

ANSWER: **

Explanation:
The **(Exponentiation operator) raises one operand to the power of the other.


5)   In CASE Expressions, which expression selects a result from one or more alternatives, and returns the result?

a. Simple CASE Expression
b. Searched CASE Expression
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Simple CASE Expression

Explanation:
The CASE statement helps to select and execute one set of statements. It uses a selector rather than the multiple Boolean expression to select the sequence. An expression whose value will be used to select one of the several alternatives is known as an selector.


6)   Which of the following is an explicit numeric, character, string, or BOOLEAN value not represented by an identifier?

a. Delimiters
b. Literals
c. Comments
d. None of the above
Answer  Explanation 

ANSWER: Literals

Explanation:
Literals are similar to the constants. There are 4 types of literals
1. Text literals
2. Integer literals
3. Number
4. Date/Time literals.


7)   PL/SQL provides many powerful functions to help you manipulate data. These built-in functions fall into which of these following categories?

a. Error reporting,Character, Datatype conversion
b. Number,Date,Object reference
c. Miscellaneous
d. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


8)   A searched CASE expression lets you test different conditions instead of comparing a single expression to various values.

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
A searched CASE expression does not contain any selector. A search condition can also be found in each WHEN clause to determine a BOOLEAN value. Besides this, it also allows the testing of different variables or multiple conditions in a single WHEN clause.


9)   PL/SQL Server Pages (PSPs) enable you to develop Web pages with dynamic content.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
PL/SQL Server Pages (PSPs) enable you to develop Web pages with dynamic content. In this the PL/SQL scripts are embedded in the HTML pages.


10)   Using DBMS_DB_VERSION Package Constants which represents the condition that the database version is less than or equal to 10; it is TRUE.

a. VER_LE_10
b. VER_LE_10_2
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: VER_LE_10

Explanation:
VER_LE_10 is a boolean type of a constant. Its version is less than or equal to 10. VER_LE_10 is a type of DB version.


11)   Which internal exception is raised when a program references a nested table or varray element using an index number larger than the number of elements in the collection.

a. NO_DATA_FOUND
b. COLLECTION_IS_NULL
c. SUBSCRIPT_OUTSIDE_LIMIT
d. SUBSCRIPT_BEYOND_COUNT
Answer  Explanation 

ANSWER: SUBSCRIPT_BEYOND_COUNT

Explanation:
The SUBSCRIPT_BEYOND_COUNT error is where the in-limit of a subscript was greater than that of the count of a varray or was too large for a nested table.


12)   A package cursor is a cursor which you declare in the package specification without an SQL statement.

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
No explanation is available for this question!


13)   In which of the following, do you specify the same parameters in the same order as they are declared in the procedure?

a. Positional notation
b. Named notation
c. Mixed notation
d. All mentioned above
Answer  Explanation 

ANSWER: Positional notation

Explanation:
Calling a stored procedure by simply just passing the parameter values and assuming that the values will be associated with the parameters in the order of the declaration is known as positional notation. In this notation the value which is passed first is associated with the first parameter, the second value with the second parameter and so on so forth. Here, the values must be passed in a proper order in a stored procedure.


14)   In which mode parameter lets you pass values to the subprogram being called? It cannot be assigned a value.

a. Using the IN mode
b. Using the OUT mode
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Using the IN mode

Explanation:
IN parameter is which helps us to pass a value to the subprogram. This parameter is a read-only parameter and it acts like a constant in a subprogram. No value can be assigned to it.


15)   To call a subprogram directly, users must have the EXECUTE privilege on that subprogram. By granting the privilege, you allow a user to -

a. Call the subprogram directly
b. Compile functions and procedures that call the subprogram
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
The EXECUTE privilege is a schema object privilege for procedures. It is granted to the users who execute or compile a procedure which calls it.


16)   Which is a database object that groups logically related PL/SQL types, objects and subprograms?

a. Package
b. Module
c. Body
d. Name
Answer  Explanation 

ANSWER: Package

Explanation:
A package is divided into 2 parts a specification and a body. The specification is an interface to the package and it declares the types,variables,subprograms etc. which can be referenced from outside the package. The body consists of queries for the cursor and the code for subprograms.


17)   Only EXISTS can be applied to automatically null collections. If you apply another method to such collections, PL/SQL raises COLLECTION_IS_NULL.

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
A built in function or procedure which is operated on collections and usually called using the dot notation is known as a collection method.


18)   Which collection exception is raised when a subscript designates an element that was deleted, or a nonexistent element of an associative array?

a. NO_DATA_FOUND
b. COLLECTION_IS_NULL
c. SUBSCRIPT_BEYOND_COUNT
d. SUBSCRIPT_OUTSIDE_LIMIT
Answer  Explanation 

ANSWER: NO_DATA_FOUND

Explanation:
The NO_DATA_FOUND exception is raised when the FETCH statement is not able to find the relevant data that we have asked for.


19)   Which collection exception is raised when a subscript exceeds the number of elements in a collection?

a. VALUE_ERROR
b. COLLECTION_IS_NULL
c. SUBSCRIPT_BEYOND_COUNT
d. SUBSCRIPT_OUTSIDE_LIMIT
Answer  Explanation 

ANSWER: SUBSCRIPT_BEYOND_COUNT

Explanation:
The SUBSCRIPT_BEYOND_COUNT error is where the in-limit of a subscript was greater than that of the count of a varray or was too large for a nested table.


20)   Which of the following executes the query and identifies the result set, consisting of all rows that meet the query search criteria.

a. Fetching with a Cursor
b. Opening a cursor
c. Fetching bulk data with a cursor
d. None of the above
Answer  Explanation 

ANSWER: Opening a cursor

Explanation:
Once we have declared the cursor the next thing would be to open the cursor. The cursor is opened with the OPEN statement. Syntax: OPEN cursor_name;


21)   Which statement associates a cursor variable with a multi-row query, executes the query, and identifies the result set?

a. OPEN-FOR
b. FETCH
c. CLOSE
d. All mentioned above
Answer  Explanation 

ANSWER: OPEN-FOR

Explanation:
The query associated with a cursor variable executes using the OPEN-FOR statement. It helps in identifying the result set.


22)   LOB parameters are not permitted in a server-to-server RPC.

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
No explanation is available for this question!


23)   The CLOSE statement enables a cursor variable and makes the associated result set undefined.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
The above statement is false. The correct statement is: The CLOSE statement disables the cursor, and the result set becomes undefined.


24)   You use cursor variables to pass query result sets between PL/SQL stored subprograms and various clients.

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
You use cursor variables to pass query result sets between PL/SQL stored subprograms and client programs because any client program or PL/SQL does not own a result set, a pointer is shared in the work area where the result set will be stored.


25)   A subquery is a query (usually enclosed by parentheses) that appears within another SQL data manipulation statement.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
On evaluation a value or a set of values to the statement is provided by the subquery. The WHERE clause is used by the subqueries. An evaluation which is done once for each table is carried out by the subquery and a correlated subquery evaluates only once for for each of the rows.


26)   A nested cursor is implicitly opened when the containing row is fetched from the parent cursor. The nested cursor is closed in which of the following case(s)?

a. The nested cursor is explicitly closed by the user
b. The parent cursor is re-executed
c. The parent cursor is closed
d. The parent cursor is canceled
e. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


27)   Which datatype is used to store large blocks of character data in the database, in-line or out-of-line? Both fixed-width and variable-width character sets are supported.

a. BLOB
b. CLOB
c. BFILE
d. NCLOB
Answer  Explanation 

ANSWER: CLOB

Explanation:
No explanation is available for this question!


28)   Is it possible to define a CONSTANT value in a record?

a. Yes
b. No


Answer  Explanation 

ANSWER: No

Explanation:
A CONSTANT is a reserved word whose value does not change at all.


29)   Which data type supports only sequential access of objects?

a. LONG
b. LOB
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: LONG

Explanation:
LONG is a data type of PL/SQL. It stores variable length character strings.


30)   Can BOOLEAN datatype be used in functions that are called from SQL statements?

a. Yes
b. No


Answer  Explanation 

ANSWER: No

Explanation:
The BOOLEAN datatype answers in either a YES or a NO and a function cannot be returned as a YES or no.


31)   PL/SQL is a transaction processing procedural language that has which of the following advantages?

a. Integration with database
b. Better Performance
c. Higher Productivity
d. Portability
e. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


32)   Explicit datatypes, %TYPE and %ROWTYPE, without size specification can be used for parameters in a procedure.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
These attributes allow parameters because the result of both are unconstrained declarations.


33)   Oracle-supplied package called DBMS_LOB is used to manipulate the LOB objects.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
The subprograms which are required to operate on BLOBs, CLOBs, NCLOBs, BFILEs, and temporary LOBs are provided by the DBMS_LOB package. They are used to access and manipulate the specific parts of the LOB or complete LOBs.


34)   What is the advantage of using the %ROWTYPE datatype?

a. It is useful to retrieve an entire row from a table. If you do not use the %ROWTYPE datatype, then you have to declare variables for each column separately.
b. It can be used even if data type of the table columns is not known.
c. It ensures that data type of the variable changes dynamically if the underlying table is altered.
d. All mentioned above
e. Both A & B
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


35)   The LOB objects can be stored in-line or out-of-line. The in-line storage means that objects are stored.

a. Along with the row
b. Outside the row
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Along with the row

Explanation:
It means that there is a locater which stores the row along with the other table columns which in turn points to the real data.