PL SQL MCQ Questions 5
Which collection exception is raised when a subscript exceeds in a collection?
- VALUE_ERROR
- COLLECTION_IS_NULL
- SUBSCRIPT_BEYOND_COUNT
- SUBSCRIPT_OUTSIDE_LIMIT
Ans : 3
Which exception is raised when a nonexistent element of an associative array?
- NO_DATA_FOUND
- COLLECTION_IS_NULL
- SUBSCRIPT_BEYOND_COUNT
- SUBSCRIPT_OUTSIDE_LIMIT
Ans : 1
In which subprogram a RETURN statement does not return a value ?
- In Procedures
- In Functions
- Both A & B
- None of the above
Ans : 1
Which part of a subprogram heading is optional?
- Name of the subprogram
- Declaration part of a subprogram
- Parameters
- Exception handling part
Ans : 3
Which of the following is not a subprogram?
- Procedure
- Function
- Package
- Anonymous PL/SQL block
Ans : 3
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
Where can a subprogram be created?
- Inside a PL/SQL block or a package only.
- Inside a PL/SQL block, inside a package, or at schema level.
- Inside a package only.
- Inside a PL/SQL block only.
Ans : 2
Which of the following subprogram is stored in the database?
- Standalone subprogram
- Nested subprogram in an anonymous block
- Package subprogram
- Standalone and nested subprogram
Ans : 1
When should forward declaration be used in procedures?
- Always for nested procedures
- If nested subprograms in the same PL/SQL block invoke each other
- For packaged subprograms always
- For two standalone subprograms invoking each other
Ans : 2
What is a standalone subprogram?
- A subprogram created at the schema level
- A subprogram created at the database level
- A subprogram created at the user level
- A subprogram created at the session level
Ans : 1
Which of the following part of a PL/SQL subprogram is mandatory?
- Executable and exception handling part only
- Declaration, Executable and Exception handling part
- Declaration and Executable part
- Executable part only
Ans : 4
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
Differentiates a declaration part of a subprogram from an anonymous block?
- The declaration part of a subprogram never begins with DECLARE keyword.
- Declaration part of a subprogram is not mandatory but anonymous block is mandatory.
- Declaration of a subprogram can be written after the execution but not possible in anblock.
- None of the above
Ans : 1
How many RETURN statements can a function have?
- Zero or more
- Zero or one
- Always one only
- One or more
Ans : 4
Which of the following is incorrect about functions?
- A function is a module that returns a value.
- A function is a standalone executable statement.
- A function can be said to have a datatype.
- A function can be used in place of an expression in a PL/SQL statement.
Ans : 2
What is a standalone function?
- It is the function created in memory
- It is the function inside another PL/SQL lock
- It is the function that is stored in the database
- It is the function that cannot have any parameters
Ans : 3
Which of the following is not a difference between procedure and function?
- Functions can be called from SQL whereas procedures cannot be called.
- Function can be used in place of an expression whereas a procedure can’t be used so.
- The return statement is mandatory for a function which is not for a procedure
- Functions are used for executing business logic and computation but a procedure is not.
Ans : 4
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
What does a return statement in a function do?
- It returns control to the calling program and returns the results of the function.
- It returns control to the calling program only if there are no results to show.
- It only returns the results of the function if any.
- It terminates the function without return any results & returns control to the calling program.
Ans : 1
What should be done to change the definition of an existing function?
- DROP the function and create it again with CREATE function syntax.
- Use ALTER function to re-create the function
- A function once created cannot be changed later
- Use CREATE or REPLACE to overwrite the existing function.
Ans : 4
Where are functions normally used?
- To perform computation
- To do some business logic
- To transfer data
- To take IN OUT parameters
Ans : 1
Which of the following is incorrect about a RETURN statement?
- A function can have more than one RETURN statement.
- All the RETURN statements is executed each time the function is called.
- The RETURN statement can accept any expression for evaluation and return.
- It is processed, the function terminates immediately and returns plsql block;
Ans : 2
Which of the following subprograms can use parameters?
- Procedures and Functions
- Procedures only
- Functions only
- Packages only
Ans : 1
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
What is the method passed actual & formal parameters refer to same memory location?
- By Reference
- By Value
- By copy
- By default values
Ans : 1
Which are the optional parts of a formal parameter declaration?
- Name, Datatype, Mode and default value
- Datatype, Mode and default value
- Mode and default value
- Default value only
Ans : 3
Which of the following is incorrect about actual parameters in a procedure?
- These are the expressions placed in the parameter list of the actual call to the procedure.
- Corresponding actual and formal parameters must have compatible datatypes.
- Same names should be given for formal and actual subprogram parameter always.
- None of the above
Ans : 3
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
Read More PL/SQL Objective Questions and Answers