1. Examine this code: CREATE OR REPLACE PACKAGE comm_package IS g_comm NUMBER := 10; PROCEDURE reset_comm(p_comm IN NUMBER); END comm_package; / User Jones executes the following code at 9:01am: EXECUTE comm_package.g_comm := 15 User Smith executes the following code at 9:05am: EXECUTE comm_paclage.g_comm := 20 Which statement is true?
  1. a) g_comm has a value of 15 at 9:06am for Smith.

  2. b) g_comm has a value of 15 at 9:06am for Jones.

  3. c) g_comm has a value of 20 at 9:06am for both Jones and Smith.

  4. d) g_comm has a value of 15 at 9:03 am for both Jones and Smith.

  5. e) g_comm has a value of 10 at 9:06am for both Jones and Smith.


Correct Option: B

AI Explanation

To answer this question, let's analyze the provided code and the sequence of events:

The code defines a package named "comm_package" with a global variable "g_comm" initialized to 10 and a procedure "reset_comm" that takes a parameter "p_comm" of type NUMBER.

User Jones executes the following code at 9:01am:

EXECUTE comm_package.g_comm := 15;

This code attempts to assign a new value of 15 to the global variable "g_comm".

User Smith executes the following code at 9:05am:

EXECUTE comm_package.g_comm := 20;

This code also attempts to assign a new value of 20 to the global variable "g_comm".

Now let's evaluate each option to determine which one is true:

Option A) g_comm has a value of 15 at 9:06am for Smith. This option is incorrect because Smith's code executed at 9:05am, not 9:06am.

Option B) g_comm has a value of 15 at 9:06am for Jones. This option is correct. Since Jones executed the code at 9:01am to assign a value of 15 to g_comm, the value of g_comm will be 15 at 9:06am for Jones.

Option C) g_comm has a value of 20 at 9:06am for both Jones and Smith. This option is incorrect. Since Smith executed the code at 9:05am to assign a value of 20 to g_comm, the value of g_comm will be 20 at 9:06am for Smith, but Jones assigned a value of 15 to g_comm earlier, so it will not be 20 for Jones at 9:06am.

Option D) g_comm has a value of 15 at 9:03am for both Jones and Smith. This option is incorrect. Jones executed the code at 9:01am, not 9:03am.

Option E) g_comm has a value of 10 at 9:06am for both Jones and Smith. This option is incorrect. Both Jones and Smith executed code to assign different values to g_comm, so the value will not be 10 for either of them at 9:06am.

Therefore, the correct answer is: B) g_comm has a value of 15 at 9:06am for Jones.

Find more quizzes: