Plsql New Mcq Part 2(Lesson 1-5)
Plsql New Mcq Part 2(Lesson 1-5)
Lesson-1
10. The…. keyword is optional, but it is required if you declare variables, constants, and exceptions
to be used within the PL/SQL block.
a. Declare
b. Executable
c. Exception
d. None
11. BEGIN and END are optional and require at least one statement between them, either
SQL,PL/SQL, or both.
a. True
b. False
12. The …. section is optional and is used to handle errors that occur within the scope of the PL/SQL
block.
a. Executable
b. Declare
c. Exception
d. All
13. Irrespective of the PL/SQL……., the basic architecture remains the same
a. run-time environment
b. real-time environment
c. run-time environments
d. calling environment
14. The SQL environment may also invoke the PL/SQL environment for example when a function is
used in a select statement.
a. True
b. False
15. A PL/SQL subprogram is a …..that can
be called with a set of parameters.
a. named PL/SQL block
b. unnamed PL/SQL block
c. anonymous PL/SQL block
d. none
16. A subprogram cannot be a procedure or a function.
a. True
b. False
17. Subprograms can be grouped into PL/SQL ….
a. Packages
b. Procedure
c. Functions
d. Trigger
e. All
18. To declare a subprogram, you must provide the spec, which includes descriptions of…..
a. any parameters
b. any blocks
c. any triggers
d. any variable
19. PL/SQL has ….of subprograms
PeopleNTech Limited
Prepared by: Zakia Sultana
a. two types
b. three types
c. four types
d. none
e. a procedure
20. a procedure has some additional items such as the RETURN clause or the RETURN statement
a. true
b. false
21. The …clause specifies the data type of the return value
a. RETURN
b. SELECT
c. INTO
d. None
22. The execute privilege does not allow a calling user direct access to objects that are accessible to
the subprogram.
a. True
b. False
23. Anonymous blocks Can take parameters
a. True
b. False
24. …. called functions must return values.
a. Subprograms
b. Parameters
c. Block structure
d. None
25. Anonymous blocks are not persistent database objects
a. True
b. False
26. …and ….are compiled and stored in the database in a compiled form.
a. Procedures
b. Functions
c. Packages
d. Triggers
e. a,b
27. Can be stored in the database as a schema object
a. Procedure
b. Function
c. Block
d. None
28. a procedure to perform an action.
a. True
b. False
29. drop the procedure first using ….
a. Delete
b. Remove
c. Drop
PeopleNTech Limited
Prepared by: Zakia Sultana
d. Drope
30. Parameters can be considered as …
a. local variables
b. global variable
c. host variable
d. none
31. which one is the the default parameter ?
a. IN
b. OUT
c. IN OUT
d. None
32. The ….can be literal values, variables, and expressions that are provided in the parameter list of
a calling subprogram.
a. actual parameters
b. local parameters
c. global parameter
d. none
33. Actual parameters are also referred to as actual arguments
a. True
b. False
34. One or more formal parameters can be declared, each separated by a….
a. Comma
b. Semicolon
c. Colon
d. Colon dash
Lesson-2
d. none
5. A function must have a …. clause in the header
a. RETURN
b. FROM
c. Both
d. None
6. at least one RETURN statement in the executable section
a. true
b. false
7. A function that is stored in the database is referred to as a stored ……
a. function.
b. Package
c. Procedure
d. All of above
8. Functions can be stored in the database as ……for repeated execution.
a. schema objects
b. table objects
c. database objects
d. none
9. Functions promote reusability and…...
a. Maintainability
b. Manageable
c. Maintainabiliti
d. Maintenance
10. The PL/SQL block must have at least …. RETURN statement.
a. One
b. Two
c. More
d. None
11. The …..option indicates that if the function exists.
a. REPLACE
b. RETURN
c. REUSE
d. NONE
12. The …..parameter modes can be used with functions
a. OUT and IN
b. IN and INOUT
c. OUT and IN OUT
d. All of above
13. ….Can contain a RETURN statement without a value
a. Procedure
b. Function
c. Package
d. Trigger
14. Function must return a single value
a. True
PeopleNTech Limited
Prepared by: Zakia Sultana
b. False
15. Functions used in… statements should not use OUT or IN OUT mode parameters.
a. SQL
b. PL/SQL
c. DDL
d. DML
16. Using the …. SQL*Plus command to display error.
a. SHOW ERRORS
b. DECRIBE_ERRORS
c. VIEW ERRORS
d. USER_ERRORS
17. ….variables to hold the returned value from a function.
a. host or local
b. global or local
c. private or global
d. none
18. SQL statements can reference PL/SQL user-defined functions anywhere a SQL expression
is not allowed.
a. True
b. False
19. User-defined functions act like built-in single-row functions and can be used in:
a. SELECT list
b. CONNECT BY, START WITH, ORDER BY, and GROUP BY clauses
c. VALUES clause of the INSERT statement
d. All of above
e. None
20. When calling functions in SQL statements:
a. Be stored in the database
b. Return valid SQL data types, not PL/SQL-specific types
c. Accept only IN parameters with valid SQL data types, not
PL/SQL-specific types
d. All of above
e. None
21. Functions called from:
a. SELECT statement
b. UPDATE or DELETE statement
c. DML statement
d. DDL statement
e. a,b
22. To remove a stored function by using, execute the …
a. DROP FUNCTION
b. DELETE FUNCTION
c. REMOVE FUNCTION
d. DROPE FUNCTION
23. The output of the second code example in the slide was generated using the ……icon on
the toolbar to provide better-formatted output.
PeopleNTech Limited
Prepared by: Zakia Sultana
Lesson-3
1. A ___ is a schema object that groups logically related PL/SQL types, variables, and subprograms.
a. Package
b. Trigger
c. Function
d. Procedure
2. Packages usually have ___
a. two part
b. three part
c. one part
d. none
3. The whole package is loaded into ___
a. memory
b. RAM
c. ROM
d. CPU
4. Packages provide an alternative to creating procedures and functions as stand-alone schema
objects.
a. True
b. False
5. To create packages, you declare all private constructs within the package specification.
a. True
b. False
6. The package specification should contain procedure and function headings terminated by
a…
a. semicolon
b. colon
c. dot
d. none
7. The __option drops and re-creates the package body.
a. OR REPLACE
b. OR REUSE
c. DROP
d. DELETE
8. Public constructs are ….to the package body.
a. Visible
b. Invisible
c. Show
d. Display
PeopleNTech Limited
Prepared by: Zakia Sultana
Lesson-4
1. Which two statements are correct about PL/SQL package components? (Choose two)
A. The COMMIT and ROLLBACK commands are allowed in the packaged function.
B. You can not use packaged functions in a query statement.
C. The packaged function cannot execute an INSERT, UPDATE, or DELETE statement against
the table that is being queried.
D. The packaged function can execute an INSERT, UPDATE, or DELETE statement against the
table that is being queried if it is used in a subquery.
E. The packaged function can execute an INSERT, UPDATE, or DELETE statement against the
table that is being queried if the pragma RESTRICT REFERENCES is used.
5. You want to create two procedures using the overloading feature to search for employee
details based on either the employee name or employee number.
Which two rules should you apply to ensure that the overloading feature is used
successfully? (Choose two.)
A. The procedures can be either stand-alone or packaged.
B. The procedures should be created only as packaged subprograms.
C. The procedures should be created only as stand-alone subprograms.
D. Each subprogram's formal parameters should differ in both name and data type.
E. The formal parameters of each subprogram should differ in data type but can use the
PeopleNTech Limited
Prepared by: Zakia Sultana
same names.
Lesson-5
1. The Oracle-supplied UTL_FILE package is used to access text files in the operating system of the
database server. The database provides functionality through directory objects to allow access
to specific operating system directories.
PeopleNTech Limited
Prepared by: Zakia Sultana
a. True
b. False
2. The Oracle-supplied packages:
a. Are provided with the Oracle server
b. Extend the functionality of the database
c. Enable access to certain SQL features that are normally restricted for PL/SQL
d. All of the above
e. a,b
f. b,c
3. Which package is used for debugging purposes and displaying procedurally generated
information on the screen in SQL*Plus.
a. DBMS_OUTPUT
b. UTL_FILE
c. UTL_MAIL
d. DBMS_SQL
4. Which package is used for creating text files in the operating system
a. UTL_FILE
b. DBMS_OUTPUT
c. UTL_MAIL
d. DBMS_SQL
5. Which package is used for sending email with or without binary or text attachments .
a. DBMS_OUTPUT
b. UTL_MAIL
c. UTL_FILE
d. DBMS_SQL
6. Which package supports asynchronous notification of database events. Messages or alerts are
sent on a COMMIT command.
a. DBMS_ALERT
b. UTL_FILE
c. UTL_MAIL
d. DBMS_APPLICATION_INFO
7. Which package is used to request, convert, and release locks through Oracle Lock Management
services.
a. DBMS_LOCK
b. UTL_FILE
c. UTL_MAIL
d. DBMS_APPLICATION_INFO
8. Which package enables programmatic use of the ALTER SESSION SQL statement and other
session-level commands.
a. DBMS_SESSION
b. UTL_FILE
c. UTL_MAIL
d. DBMS_APPLICATION_INFO
9. Which package can be used with Oracle Trace and the SQL trace facility to record names of
executing modules or transactions in the database for later use when tracking the performance
of various modules and debugging.
a. UTL_FILE
b. UTL_MAIL
c. HTP
PeopleNTech Limited
Prepared by: Zakia Sultana
d. DBMS_APPLICATION_INFO
10. Which package writes HTML-tagged data into database buffers.
a. UTL_FILE
b. HTP
c. UTL_MAIL
d. DBMS_APPLICATION_INFO
11. Which package enables scheduling and automated execution of PL/SQL blocks, stored
procedures, and external procedures and executables
a. UTL_FILE
b. DBMS_SCHEDULER
c. UTL_MAIL
d. DBMS_APPLICATION_INFO
12. Which appends text from the procedure to the current line of the line output buffer.
a. PUT
b. PUT_LINE
c. GET_LINE
d. GET_LINES
13. Which places an end-of-line marker in the output buffer.
a. GET_LINES
b. NEW_LINE
c. PUT_LINE
d. GET_LINE
14. Which combines the action of PUT and NEW_LINE (to trim leading spaces).
a. PUT
b. PUT_LINE
c. GET_LINE
d. GET_LINES
15. Which retrieves the current line from the buffer into a procedure variable.
a. GET_LINES
b. GET_LINE
c. PUT_LINE
d. PUT
16. Which retrieves an array of lines into a procedure-array variable.
a. GET_LINES
b. GET_LINE
c. PUT_LINE
d. PUT
17. Which function determines if a file handle refers to an open file
a. ISOPEN
b. FOPEN
c. FCLOSE
d. FCOPY
18. Which function opens a file for input or output
a. ISOPEN
b. FOPEN
c. FCLOSE
d. FCOPY
19. Which function closes all open file handles
a. ISOPEN
PeopleNTech Limited
Prepared by: Zakia Sultana
b. FCLOSE
c. FOPEN
d. FCOPY
20. Which function copies a contiguous portion of a file to a newly created file
a. ISOPEN
b. FCOPY
c. FOPEN
d. FCLOSE
21. Which is used for reading text in package parameter.
a. 'A'
b. 'R'
c. 'W'
d. 'O'
22. Which is used for writing text in package parameter.
a. 'R'
b. 'W'
c. 'A'
d. 'O'
23. Which is used for appending text in package parameter.
a. 'R'
b. 'W'
c. 'A'
d. 'O'
24. UTL_MAIL Package includes
a. SEND procedure
b. SEND_ATTACH_RAW procedure
c. SEND_ATTACH_VARCHAR2 procedure
d. RECEIVE procedure
e. All of them
f. a,b
g. a,b,c
h. a,d
i. b,c
25. SEND procedure includes not which parameter
a. Sender
b. Recipients
c. mime_type
d. attachment
26. SEND_ATTACH_RAW procedure includes not which parameter
a. Sender
b. Recipients
c. mime_type
d. att_message
27. SEND_ATTACH_VARCHAR2 procedure includes not which parameter
a. Sender
b. Recipients
c. mime_type
d. att_message