You are on page 1of 44

Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)

1. Package CURSPACK declares a global cursor in the package specification. The


package contains three public procedures: OPENPROC opens the cursor; FETCHPROC fetches 5 rows
from the cursor's active set; CLOSEPROC closes the cursor.

What will happen when a user session executes the following commands in the order shown?

curspack.openproc; -- line 1

curspack.fetchproc; -- line 2

curspack.fetchproc; -- line 3

curspack.openproc; -- line 4

curspack.fetchproc; -- line 5

curspack.closeproc; -- line 6

Mark for Review

(1) Points

The first 15 rows will be fetched.

The first 10 rows will be fetched, then the first 5 rows will be fetched again.

The first 5 rows will be fetched three times.


An error will occur at line 2.

An error will occur at line 4. (*)

Incorrect Incorrect. Refer to Section 11 Lesson 1.

2. A cursor is declared in a package specification. User SIOBHAN opens the


cursor and fetches the first three rows from the cursor's active set, but does not close the cursor.

User FRED now connects to the database. FRED can immediately fetch the next three rows without
opening the cursor. True or False? Mark for Review

(1) Points

True

False (*)

Incorrect Incorrect. Refer to Section 11 Lesson 1.


3. A cursor's state is defined only by whether it is open or closed and, if open,
how many rows it holds. True or False? Mark for Review

(1) Points

True

False (*)

Incorrect Incorrect. Refer to Section 11 Lesson 1.

4. A package's state is initialized when the package is first loaded. True or


False? Mark for Review

(1) Points

True (*)

False
Incorrect Incorrect. Refer to Section 11 Lesson 1.

5. In the following example, which statement best fits in Line 1? (Choose 1)

DECLARE

v_more_rows_exist BOOLEAN := TRUE;

BEGIN

-- Line 1

LOOP

v_more_rows_exist := curs_pkg.fetch_n_rows(3);

DBMS_OUTPUT.PUT_LINE('-------');

EXIT WHEN NOT v_more_rows_exist;

END LOOP;

curs_pkg.close_curs;

END;

Mark for Review

(1) Points

curs_pkg.close_curs;

curs_pkg.emp_curs%ISOPEN;

curs_pkg.open_curs; (*)
EXIT WHEN curs_pkg.emp_curs%NOTFOUND;

Correct Correct

Page 1 of 3 Next Summary

Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)

6. The SEND procedure is for sending messages without attachments. True or


False? Mark for Review

(1) Points

True (*)

False
Incorrect Incorrect. Refer to Section 11 Lesson 2.

7. The DBMS_OUTPUT gives programmers an easy-to-use interface to see, for


instance, the current value of a loop counter, or whether or not a program reaches a particular
branch of an IF statement. (True or False?) Mark for Review

(1) Points

True (*)

False

Incorrect Incorrect. Refer to Section 11 Lesson 2.

8. The UTL_MAIL package allows sending email from the Oracle database to
remote recipients. Mark for Review

(1) Points

True (*)
False

Correct Correct

9. Which DBMS_OUTPUT package subprogram places text into the buffer at


Line 1? (Choose one)

IF v_bool1 AND NOT v_bool2 AND v_number < 25 THEN

--Line 1

ELSE

...

END IF;

DBMS_OUTPUT.NEW_LINE; Mark for Review

(1) Points

DBMS_OUTPUT.PUT('IF branch was executed'); (*)

DBMS_OUTPUT.GET_LINE('IF branch was executed');

DBMS_OUTPUT.NEW_LINE('IF branch was executed');


DBMS_OUTPUT.PUT_LINE('IF branch was executed');

Incorrect Incorrect. Refer to Section 11 Lesson 2.

10. Which general exceptions may be handled by the UTL_FILE package?


(Choose 2) Mark for Review

(1) Points

(Choose all correct answers)

VALUE_ERROR (*)

ZERO_DIVIDE

TOO_MANY_ROWS

NO_DATA_FOUND (*)
Incorrect Incorrect. Refer to Section 11 Lesson 2.

Previous Page 2 of 3 Next Summary

Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)

11. Which of the following procedures is not valid for the UTL_MAIL package
Mark for Review

(1) Points

All are valid.

SEND_ATTACH_BOOLEAN (*)

SEND_ATTACH_VARCHAR2
SEND_ATTACH_RAW

SEND

Correct Correct

12. Why is it better to use DBMS_OUTPUT only in anonymous blocks, not inside
stored subprograms such as procedures? Mark for Review

(1) Points

Because DBMS_OUTPUT can raise a NO_DATA_FOUND exception if used inside a packaged


procedure

Because DBMS_OUTPUT should be used only for testing and debugging PL/SQL code (*)

Because anonymous blocks display messages while the block is executing, while procedures
do not display anything until their execution has finished

Because DBMS_OUTPUT cannot be used inside procedures


Incorrect Incorrect. Refer to Section 11 Lesson 2.

13. The UTL_FILE package can be used to read and write binary files such as
JPEGs as well as text files. True or False? Mark for Review

(1) Points

True

False (*)

Incorrect Incorrect. Refer to Section 11 Lesson 2.

14. The UTL_FILE package contains several exceptions exclusively used in this
package. Which are they? (Choose 3) Mark for Review

(1) Points

(Choose all correct answers)

INVALID_PATH (*)
WRITE_ERROR (*)

ZERO_DIVIDE

NO_DATA_FOUND

INVALID_OPERATION (*)

Incorrect Incorrect. Refer to Section 11 Lesson 2.

15. DBMS_OUTPUT.PUT_LINE can be invoked from inside a private packaged


function. True or False? Mark for Review

(1) Points

True (*)

False
Incorrect Incorrect. Refer to Section 11 Lesson 2.

Previous Page 3 of 3 Summary

Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)

1. In the following example, which statement best fits in Line 1? (Choose 1)

DECLARE

v_more_rows_exist BOOLEAN := TRUE;

BEGIN

-- Line 1

LOOP

v_more_rows_exist := curs_pkg.fetch_n_rows(3);

DBMS_OUTPUT.PUT_LINE('-------');

EXIT WHEN NOT v_more_rows_exist;

END LOOP;

curs_pkg.close_curs;

END;

Mark for Review

(1) Points
curs_pkg.open_curs; (*)

curs_pkg.close_curs;

EXIT WHEN curs_pkg.emp_curs%NOTFOUND;

curs_pkg.emp_curs%ISOPEN;

Incorrect Incorrect. Refer to Section 11 Lesson 1.

2. Package CURSPACK declares a global cursor in the package specification. The


package contains three public procedures: OPENPROC opens the cursor; FETCHPROC fetches 5 rows
from the cursor's active set; CLOSEPROC closes the cursor.

What will happen when a user session executes the following commands in the order shown?

curspack.openproc; -- line 1

curspack.fetchproc; -- line 2

curspack.fetchproc; -- line 3

curspack.openproc; -- line 4

curspack.fetchproc; -- line 5

curspack.closeproc; -- line 6
Mark for Review

(1) Points

An error will occur at line 2.

The first 5 rows will be fetched three times.

The first 15 rows will be fetched.

An error will occur at line 4. (*)

The first 10 rows will be fetched, then the first 5 rows will be fetched again.

Incorrect Incorrect. Refer to Section 11 Lesson 1.

3. Users A and B call the same procedure in a package to initialize a global


variable my_pkg.g_var. What will be the value of my_pkg.g_var for User A at Point A?

User A: my_pkg.g_var is 10

User B: my_pkg.g_var is 10

User A: my_pkg.g_var is 50
User B: my_pkg.g_var is 25

Point A

Mark for Review

(1) Points

50 (*)

25

10

Incorrect Incorrect. Refer to Section 11 Lesson 1.

4. A package's state is initialized when the package is first loaded. True or


False? Mark for Review

(1) Points

True (*)
False

Correct Correct

5. A cursor is declared in a package specification. User SIOBHAN opens the


cursor and fetches the first three rows from the cursor's active set, but does not close the cursor.

User FRED now connects to the database. FRED can immediately fetch the next three rows without
opening the cursor. True or False? Mark for Review

(1) Points

True

False (*)

Incorrect Incorrect. Refer to Section 11 Lesson 1.

Page 1 of 3 Next Summary


Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)

6. The SEND procedure is for sending messages without attachments. True or


False? Mark for Review

(1) Points

True (*)

False

Incorrect Incorrect. Refer to Section 11 Lesson 2.

7. Which DBMS_OUTPUT package subprogram places text into the buffer at


Line 1? (Choose one)

IF v_bool1 AND NOT v_bool2 AND v_number < 25 THEN

--Line 1

ELSE

...
END IF;

DBMS_OUTPUT.NEW_LINE; Mark for Review

(1) Points

DBMS_OUTPUT.GET_LINE('IF branch was executed');

DBMS_OUTPUT.PUT('IF branch was executed'); (*)

DBMS_OUTPUT.PUT_LINE('IF branch was executed');

DBMS_OUTPUT.NEW_LINE('IF branch was executed');

Incorrect Incorrect. Refer to Section 11 Lesson 2.

8. The UTL_MAIL package allows sending email from the Oracle database to
remote recipients. Mark for Review

(1) Points

True (*)
False

Correct Correct

9. Why is it better to use DBMS_OUTPUT only in anonymous blocks, not inside


stored subprograms such as procedures? Mark for Review

(1) Points

Because anonymous blocks display messages while the block is executing, while procedures
do not display anything until their execution has finished

Because DBMS_OUTPUT cannot be used inside procedures

Because DBMS_OUTPUT can raise a NO_DATA_FOUND exception if used inside a packaged


procedure

Because DBMS_OUTPUT should be used only for testing and debugging PL/SQL code (*)

Incorrect Incorrect. Refer to Section 11 Lesson 2.


10. DBMS_OUTPUT.PUT_LINE can be invoked from inside a private packaged
function. True or False? Mark for Review

(1) Points

True (*)

False

Correct Correct

Previous Page 2 of 3 Next Summary

Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)


11. The DBMS_OUTPUT gives programmers an easy-to-use interface to see, for
instance, the current value of a loop counter, or whether or not a program reaches a particular
branch of an IF statement. (True or False?) Mark for Review

(1) Points

True (*)

False

Correct Correct

12. Using the FOPEN function, you can do which actions with the UTL_FILE
package? (Choose 2) Mark for Review

(1) Points

(Choose all correct answers)

It is used to append to a file until processing is complete. (*)

It is used to read and write text files stored outside the database. (*)
It is used to manipulate large object data type items in columns.

It is used to find out how much free space is left on an operating system disk.

Correct Correct

13. The DBMS_OUTPUT.PUT procedure places text in a buffer but does not
display the contents of the buffer. True or False? Mark for Review

(1) Points

True (*)

False

Correct Correct

14. Which general exceptions may be handled by the UTL_FILE package?


(Choose 2) Mark for Review

(1) Points
(Choose all correct answers)

VALUE_ERROR (*)

ZERO_DIVIDE

NO_DATA_FOUND (*)

TOO_MANY_ROWS

Incorrect Incorrect. Refer to Section 11 Lesson 2.

15. What will be displayed when the following code is executed?

BEGIN

DBMS_OUTPUT.PUT('I do like');

DBMS_OUTPUT.PUT_LINE('to be');

DBMS_OUTPUT.PUT('beside the seaside');

END;

Mark for Review


(1) Points

I do like

to be

beside the seaside

I do like to be

beside the seaside

I do like to be beside the seaside

I do liketo be

(*)

I do like to be

Incorrect Incorrect. Refer to Section 11 Lesson 2.


Previous Page 3 of 3 Summary

Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)

1. The UTL_FILE package can be used to create binary files such as JPEGs as
well as text files. True or False? Mark for Review

(1) Points

True

False (*)

Correct Correct

2. Which of the following procedures is not valid for the UTL_MAIL package
Mark for Review

(1) Points
SEND_ATTACH_VARCHAR2

SEND_ATTACH_RAW

SEND_ATTACH_BOOLEAN (*)

All are valid.

SEND

Correct Correct

3. Using the FOPEN function, you can do which actions with the UTL_FILE
package? (Choose 2) Mark for Review

(1) Points

(Choose all correct answers)

It is used to find out how much free space is left on an operating system disk.
It is used to manipulate large object data type items in columns.

It is used to read and write text files stored outside the database. (*)

It is used to append to a file until processing is complete. (*)

Correct Correct

4. Why is it better to use DBMS_OUTPUT only in anonymous blocks, not inside


stored subprograms such as procedures? Mark for Review

(1) Points

Because DBMS_OUTPUT should be used only for testing and debugging PL/SQL code (*)

Because DBMS_OUTPUT cannot be used inside procedures

Because anonymous blocks display messages while the block is executing, while procedures
do not display anything until their execution has finished
Because DBMS_OUTPUT can raise a NO_DATA_FOUND exception if used inside a packaged
procedure

Correct Correct

5. The DBMS_OUTPUT.PUT procedure places text in a buffer but does not


display the contents of the buffer. True or False? Mark for Review

(1) Points

True (*)

False

Correct Correct

Page 1 of 3 Next Summary


Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)

6. Which of the following exceptions can be raised ONLY when using the
UTL_FILE package? (Choose two.) Mark for Review

(1) Points

(Choose all correct answers)

NO_DATA_FOUND

INVALID_PATH (*)

READ_ERROR (*)

VALUE_ERROR

E_MYEXCEP
Correct Correct

7. The UTL_FILE package contains several exceptions exclusively used in this


package. Which are they? (Choose 3) Mark for Review

(1) Points

(Choose all correct answers)

WRITE_ERROR (*)

ZERO_DIVIDE

INVALID_PATH (*)

NO_DATA_FOUND

INVALID_OPERATION (*)
Correct Correct

8. Which of the following best describes the purpose of the UTL_FILE package?
Mark for Review

(1) Points

It is used to query CHAR and VARCHAR2 columns in tables.

It is used to find out how much free space is left on an operating system disk.

It is used to read and write text files stored outside the database. (*)

It is used to load binary files such as employees' photos into the database.

Correct Correct

9. Which general exceptions may be handled by the UTL_FILE package?


(Choose 2) Mark for Review

(1) Points
(Choose all correct answers)

ZERO_DIVIDE

VALUE_ERROR (*)

TOO_MANY_ROWS

NO_DATA_FOUND (*)

Correct Correct

10. The UTL_MAIL package allows sending email from the Oracle database to
remote recipients. Mark for Review

(1) Points

True (*)
False

Correct Correct

Previous Page 2 of 3 Next Summary

Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.

Section 11 Quiz

(Answer all questions in this section)

11. Package CURSPACK declares a global cursor in the package specification. The
package contains three public procedures: OPENPROC opens the cursor; FETCHPROC fetches 5 rows
from the cursor's active set; CLOSEPROC closes the cursor.

What will happen when a user session executes the following commands in the order shown?

curspack.openproc; -- line 1

curspack.fetchproc; -- line 2

curspack.fetchproc; -- line 3

curspack.openproc; -- line 4

curspack.fetchproc; -- line 5

curspack.closeproc; -- line 6

Mark for Review


(1) Points

The first 15 rows will be fetched.

The first 5 rows will be fetched three times.

An error will occur at line 4. (*)

The first 10 rows will be fetched, then the first 5 rows will be fetched again.

An error will occur at line 2.

Correct Correct

12. In the following example, which statement best fits in Line 1? (Choose 1)

DECLARE

v_more_rows_exist BOOLEAN := TRUE;

BEGIN

-- Line 1
LOOP

v_more_rows_exist := curs_pkg.fetch_n_rows(3);

DBMS_OUTPUT.PUT_LINE('-------');

EXIT WHEN NOT v_more_rows_exist;

END LOOP;

curs_pkg.close_curs;

END;

Mark for Review

(1) Points

curs_pkg.close_curs;

EXIT WHEN curs_pkg.emp_curs%NOTFOUND;

curs_pkg.open_curs; (*)

curs_pkg.emp_curs%ISOPEN;

Correct Correct
13. Users A and B call the same procedure in a package to initialize a global
variable my_pkg.g_var. What will be the value of my_pkg.g_var for User A at Point A?

User A: my_pkg.g_var is 10

User B: my_pkg.g_var is 10

User A: my_pkg.g_var is 50

User B: my_pkg.g_var is 25

Point A

Mark for Review

(1) Points

25

10

50 (*)

Correct Correct

14. Package MULTIPACK declares the following global variable:

g_myvar NUMBER;

User DICK executes the following:


multipack.g_myvar := 45;

User HAZEL now connects to the database. Both users immediately execute:

BEGIN

DBMS_OUTPUT.PUT_LINE(multipack.g_myvar);

END;

What values will Dick and Hazel see?

Mark for Review

(1) Points

Dick: 45, Hazel: 45

Both queries will fail because the syntax of DBMS_OUTPUT.PUT_LINE is incorrect

Dick: 0, Hazel: 0

Dick: 45, Hazel: 0

Dick: 45, Hazel: null (*)


Correct Correct

15. A cursor's state is defined only by whether it is open or closed and, if open,
how many rows it holds. True or False? Mark for Review

(1) Points

True

False (*)

Correct Correct

Previous Page 3 of 3 Summary

Test: Section 11 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 11 Quiz

(Answer all questions in this section)

1. Which of the following exceptions can be raised ONLY when using the
UTL_FILE package? (Choose two.) Mark for Review

(1) Points

(Choose all correct answers)

VALUE_ERROR

READ_ERROR (*)

NO_DATA_FOUND

INVALID_PATH (*)

E_MYEXCEP

Incorrect Incorrect. Refer to Section 11 Lesson 2.


2. DBMS_OUTPUT.PUT_LINE can be invoked from inside a private packaged
function. True or False? Mark for Review

(1) Points

True (*)

False

Correct Correct

3. Why is it better to use DBMS_OUTPUT only in anonymous blocks, not inside


stored subprograms such as procedures? Mark for Review

(1) Points

Because DBMS_OUTPUT should be used only for testing and debugging PL/SQL code (*)

Because anonymous blocks display messages while the block is executing, while procedures
do not display anything until their execution has finished
Because DBMS_OUTPUT can raise a NO_DATA_FOUND exception if used inside a packaged
procedure

Because DBMS_OUTPUT cannot be used inside procedures

Correct Correct

4. Using the FOPEN function, you can do which actions with the UTL_FILE
package? (Choose 2) Mark for Review

(1) Points

(Choose all correct answers)

It is used to manipulate large object data type items in columns.

It is used to find out how much free space is left on an operating system disk.

It is used to read and write text files stored outside the database. (*)

It is used to append to a file until processing is complete. (*)


Correct Correct

5. The DBMS_OUTPUT package is useful for which of the following activities?


(Choose two) Mark for Review

(1) Points

(Choose all correct answers)

Interact with a user during execution of a function or procedure

Display results to the developer during testing for debugging purposes (*)

Write operating system text files to the user's screen

Trace the code execution path for a function or procedure (*)

Incorrect Incorrect. Refer to Section 11 Lesson 2.


Page 1 of 3 Next Summary

You might also like