PL/SQL Elements - PL/SQL (MCQ) questions and answers
Here, you can read PL/SQL Elements multiple choice questions and answers with explanation.
1) Which is a schema object that groups logically related PL/SQL types, items, and subprograms? - Published on 08 Jul 15
a. Package Declaration
b. Object_type declaration
c. Procedure declaration
d. None of the above
Answer
Explanation
|
ANSWER: Package Declaration
Explanation: Packages have 2 parts
1. Package specification – It is an interface to the package. It declares the variables, types,constants,cursors and subprograms. 2. Package body or specification – It includes the various code lines in it
|
|
2) Which of the following declares an instance of an object type? - Published on 08 Jul 15
a. record_declaration
b. procedure_declaration
c. object_declaration
d. None of the above
Answer
Explanation
|
ANSWER: object_declaration
Explanation: An object can represent a real world entity.
|
|
3) For which of the following can pragma be applied? - Published on 08 Jul 15
a. Top-level (not nested) anonymous PL/SQL blocks
b. Local, standalone, and packaged functions and procedures
c. Methods of a SQL object type
d. Database triggers
e. All mentioned above
Answer
Explanation
|
ANSWER: All mentioned above
Explanation: The pragma is marked to a subprogram so that it can do the SQL operations and commit or rollback these operations. That is why a pragma can be applied to all the options mentioned above.
|
|
4) Which keyword and parameter used for declaring an explicit cursor? - Published on 08 Jul 15
a. constraint
b. cursor_variable_declaration
c. collection_declaration
d. cursor_declaration
Answer
Explanation
|
ANSWER: cursor_declaration
Explanation: cursor_declaration
cursor - This means it will have the name of the explicit cursor that we are declaring and will define it later in the same block,subprogram or package. It can be any identifier except for the reserved words. It follows the same scoping rules as the variables.
|
|
5) Which statements execute a sequence of statements multiple times? - Published on 07 Jul 15
a. LOOP statement
b. NULL statement
c. MERGE statement
d. None of the above
Answer
Explanation
|
ANSWER: LOOP statement
Explanation: A loop helps us in executing a statement or a group of statement multiple times depending on the block of code.
|
|
6) __________ is a numeric expression that must return a value of type PLS_INTEGER,BINARY_INTEGER, or a value implicitly convertible to that datatype. - Published on 07 Jul 15
a. index
b. indicator_name
c. field_name
d. host_variable_name
Answer
Explanation
|
ANSWER: index
Explanation: No explanation is available for this question!
|
|
7) The AUTONOMOUS_TRANSACTION pragma changes the way a subprogram works within a transaction. - Published on 07 Jul 15
a. True
b. False
Answer
Explanation
|
ANSWER: True
Explanation: This pragma is marked to a subprogram so that it can do the SQL operations and commit or rollback these operations. That is why the AUTONOMOUS_TRANSACTION pragma changes the way a subprogram works within a transaction.
|
|
8) Which statement chooses from a sequence of conditions, and executes a corresponding statement? - Published on 03 Jul 15
a. CASE Statement
b. CLOSE Statement
c. COMMIT Statement
d. None of the above
Answer
Explanation
|
ANSWER: CASE Statement
Explanation: The CASE statement selects one sequence of statements to execute. To select a sequence it uses a selector. It is an expression, whose value is used to select one of the several alternative.
|
|
9) Pragmas are processed at ___________ . - Published on 03 Jul 15
a. Run time
b. Compile time
c. Both A & B
d. None of the above
Answer
Explanation
|
ANSWER: Compile time
Explanation: PRAGMA refers to a compiler directive it is used to provide an instruction to the compiler. They are processed at compile time where the necessary information is passed to the compiler. they are not processed at runtime.
|
|