PL/SQL Subprograms - PL/SQL (MCQ) questions and answers

Here, you can read PL/SQL Subprograms multiple choice questions and answers with explanation.

1)   Which is a database object that groups logically related PL/SQL types, objects and subprograms?
- Published on 09 Jul 15

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.


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

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.


3)   In which mode parameter lets you pass values to the subprogram being called? It cannot be assigned a value.
- Published on 09 Jul 15

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.


4)   Which of the following combines the data manipulating power of SQL with the data processing power of Procedural languages?
- Published on 08 Jul 15

a. PQL
b. Advanced SQL
c. PL/SQL
d. SQL
Answer  Explanation 

ANSWER: PL/SQL

Explanation:
PL/SQL is a language formed by combining SQL and the procedural features of programming language. It was developed to enhance the capabilities of SQL. It is one of the key programming language.


5)   In which subprogram a RETURN statement does not return a value and so cannot contain an expression?
- Published on 08 Jul 15

a. In Procedures
b. In Functions
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: In Procedures

Explanation:
Procedures are the subprograms which do not return a value directly because they are mainly used for performing actions.


6)   Which is a procedural extension of Oracle- SQL that offers language constructs similar to those in imperative programming languages?
- Published on 08 Jul 15

a. PQL
b. Advanced SQL
c. PL/SQL
d. SQL
Answer  Explanation 

ANSWER: PL/SQL

Explanation:
PL/SQL is a language formed by combining SQL and the procedural features of programming language. It was developed to enhance the capabilities of SQL. It is one of the key programming language.


7)   PL/SQL has two types of subprograms, procedures and functions. Which subprogram is used to compute a value?
- Published on 08 Jul 15

a. Procedure
b. Function
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Function

Explanation:
A function is same as a procedure but a procedure does not return a value whereas a function returns a value.


8)   In which parameter mode Formal parameter acts like an initialized variable?
- Published on 07 Jul 15

a. IN
b. OUT
c. IN OUT
d. None of the above
Answer  Explanation 

ANSWER: IN OUT

Explanation:
As the IN OUT parameter acts like an initialized variable it can be assigned a value and its value can be assigned to another value. We can use this IN OUT parameter as a normal parameter.


9)   Subprograms let you extend the PL/SQL language. Which subprogram acts like new expressions and operators?
- Published on 07 Jul 15

a. Procedures
b. Functions
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Functions

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.


10)   Subprograms are named PL/SQL blocks that can be called with a set of parameters.
- Published on 19 Oct 15

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
There are two types of subprograms procedures and functions. The procedure is used to perform an action and the function is used to compute a value.


1 2