Tuning PL/SQL Applications - PL/SQL (MCQ) questions and answers

1)   Which datatypes make it practical to write PL/SQL programs to do number-crunching, for scientific applications involving floating-point calculations.
- Published on 19 Oct 15

a. BINARY_FLOAT
b. BINARY_DOUBLE
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
Explanation: The BINARY_FLOAT and BINARY_DOUBLE require less storage space which make them more efficient. They do not represent fractional values precisely so they should not be used where accuracy is needed.


2)   In which binding operation a database value is assigned to a PL/SQL variable or a host variable by the RETURNING clause of an INSERT, UPDATE, or DELETE statement.
- Published on 19 Oct 15

a. out-bind
b. in-bind
c. define
d. None of the above
Answer  Explanation 

ANSWER: out-bind

Explanation:
The INSERT,UPDATE,DELETE statements have the out bind variables. They are bulk binded with the RETURNING BULK COLLECT INTO clause of EXECUTE IMMEDIATE.


3)   Which datatypes are PL/SQL-only datatypes that are more efficient than the SQL datatypes NUMBER or INTEGER for integer arithmetic?
- Published on 19 Oct 15

a. PLS_INTEGER
b. BINARY_INTEGER
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
The BINARY_INTEGER is used to store signed integers. They require less storage than the number values. Arithmetic operations work faster.
PLS_INTEGER have the same advantages as the BINARY_INTEGER.


4)   The values of any IN OUT parameters are copied before the subprogram is executed.
- Published on 01 Jul 15

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.


5)   The subprogram is called through a database link or as an external procedure.
- Published on 01 Jul 15

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.


1