0% found this document useful (0 votes)
41 views

Plsql New Mcq Part 2(Lesson 1-5)

This document contains a series of multiple-choice questions related to PL/SQL, covering topics such as PL/SQL block structure, subprograms, functions, packages, and their components. It includes lessons on modular programming, error handling, and the use of parameters in PL/SQL. The questions are designed to assess knowledge and understanding of PL/SQL concepts and practices.

Uploaded by

Shawon Sheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Plsql New Mcq Part 2(Lesson 1-5)

This document contains a series of multiple-choice questions related to PL/SQL, covering topics such as PL/SQL block structure, subprograms, functions, packages, and their components. It includes lessons on modular programming, error handling, and the use of parameters in PL/SQL. The questions are designed to assess knowledge and understanding of PL/SQL concepts and practices.

Uploaded by

Shawon Sheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

PeopleNTech Limited

Prepared by: Zakia Sultana

Lesson-1

1. PL/SQL is a block-structured language.


a. True
b. False
2. The PL/SQL code block helps modularize code by using:
a. Packages
b. Procedures and functions
c. Database triggers
d. All of above
e. None
3. Improved data security and integrity is the benefits of using modular program.
a. True
b. False
4. A ….is based on standard PL/SQL structures
a. Anonymous blocks
b. Database triggers
c. Subprogram
d. None
5. It contains a…., an executable section, and an optional …….
a. declarative section
b. exception-handling section.
c. Block section
d. Both a and b
e. a and c
f. none
6. Subprograms cannot be compiled and stored in the database, providing modularity,
extensibility, reusability, and maintainability.
a. True
b. False
7. After modularization, the modules can be used by the same program or shared with other
programs.
a. True
b. False
8. It is easier to maintain and debug code that comprises smaller modules than it is to maintain
code in a single…
a. Small program
b. large program
c. enlarge program
d. none
9. Can be nested within the executable section of any PL/SQL block
a. Anonymous blocks
b. Database triggers
c. Calling environment
d. None
PeopleNTech Limited
Prepared by: Zakia Sultana

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

1. …Is a named PL/SQL block that returns a value.


a. Function
b. Procedure
c. Anonymous block
d. None
2. A function is not a named PL/SQL block that can accept parameters, be invoked, and return a
value
a. True
b. False
3. Functions and procedures are structured different.
a. True
b. False
4. a procedure returns …. values to its calling environment.
a. zero or more
b. one or more
c. two or three
PeopleNTech Limited
Prepared by: Zakia Sultana

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

a. Execute Statement (F11)


b. Execute Statement (F7)
c. Execute Statement (F5)
d. Execute Statement (F9)

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

9. Which one is true for writing a package?


a. The package specification should contain as few constructs as possible.
b. Develop packages for general use
c. Define the package specification before the body.
d. All of above
10. Equal to ___to display the source code for the package specification
a. 'PACKAGE'
b. ‘FUNCTION’
c. CALLING ENVIRONMENT
d. PROCEDURE
11. Equal to 'PACKAGE BODY' to display the source code for the package body
a. True
b. False
12. Create a package specification containing ___variables and constant declarations.
a. Public
b. Private
c. Local
d. Host
13. All procedures or functions ___in the package specification within the package body.
a. Declared
b. Executable
c. Exception
d. None
14. Declarations in the package specification are visible and accessible to applications.
a. True
b. False
15. All coding is…. in the package body
a. Hidden
b. Hide
c. Shown
d. Invisible
16. The package itself can be called, parameterized, or nested
a. True
b. False
17. …..are declared in the package specification.
a. Public components
b. Private components
c. local components
d. user_all compnents

Lesson-4

1. Which two statements are correct about PL/SQL package components? (Choose two)

A. A package must have both specification and body.


PeopleNTech Limited
Prepared by: Zakia Sultana

B. A package body can exist without the package specification.


C. A package specification can exist without the package body.
D. When a packaged public variable is called for the first time in a session, the entire
package is loaded into memory.

2. What is the correct definition of the persistent state of a packaged variable?

A. It is a private variable defined in a procedure or function within a package body whose


value is
consistent within a user session.
B. It is a public variable in a package specification whose value is consistent within a user
session.
C. It is a private variable in a package body whose value is consistent across all current
active sessions.
D. It is a public variable in a package specification whose value is always consistent across
all current active sessions.

3. When using a packaged function in a query, what is true?

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.

4. Which statement is true about removing packages?

A. You must remove the package body first.


B. Removing a package specification removes the body
too.
C. Removing the package body removes the specification
too.
D. You must remove both the package body and the specification separately.
E. Removing a package specification removes all stand alone stored functions named in the
specification.

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.

6. _____ are PL/SQL subtypes of VARCHAR2.


a. VARCHAR
b. STRING
c. CHAR
d. All of above

7. Which is true regarding Overloading Subprograms Restrictions?


a. Two subprograms if their formal parameters differ only in data type and the different data types are
in the same family
b. Two subprograms if their formal parameters differ only in subtype and the different subtypes are
based on types in the same family
c. Two functions that differ only in return type, even if the types are in different families
d. All of above

8. Stand-alone subprograms cannot be overloaded.


a. True
b. False
9. Block-structured languages such as PL/SQL can be declared identifiers before referencing them.
a. True
b. False
10. In the package body, a forward declaration is a private subprogram specification terminated by a
semicolon.
a. True
b. False
11. _______ call each other directly or indirectly.
a. Mutually recursive programs
b. Mutually recursive subprograms
c. Mutually programs
d. None
12. Why is important to control side effects in term of using package functions in SQL?
a. To prevent the proper parallelization of a query
b. To prevent the production of order-dependent and therefore indeterminate results
c. To prevent the required impermissible actions such as the maintenance of package state
across user sessions
d. All of the above

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

You might also like