Oracle Certification Exam Quiz: MCQ!

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Sunil.aketi
S
Sunil.aketi
Community Contributor
Quizzes Created: 2 | Total Attempts: 3,950
| Attempts: 2,182
SettingsSettings
Please wait...
  • 1/75 Questions

    While creating a package, you placed the function name in the specification and the body. Which type of construct have you created?

    • PUBLIC
    • Illegal
    • Private
    • One-time only
Please wait...
About This Quiz

What do you know about the Oracle Certification Exam? Would you like to put your knowledge to the test? The Oracle Certification Program certifies candidates on skills and experience pertaining to Oracle manufactured goods and technologies. Credentials are presented based on a combination of passing exams, training, and performance-based assignments, depending upon the level of certification. If you intend to learn more about the Oracle Certification Exam, look no further than this quiz.

Oracle Certification Exam Quiz: MCQ! - Quiz

Quiz Preview

  • 2. 

    The GET_BUDGET function is no longer needed and should be removed. Which command will successfully remove this function from the database?

    • DROP get_budget;

    • REMOVE get_budget;

    • DROP FUNCTION get_budget;

    • ALTER get_budget DROP FUNCTION;

    Correct Answer
    A. DROP FUNCTION get_budget;
    Explanation
    The correct answer is "DROP FUNCTION get_budget;". This command is used to remove a function from the database. The "DROP FUNCTION" statement is specifically designed to drop functions, while the other options are not valid commands for removing a function.

    Rate this question:

  • 3. 

    Examine this package specification: CREATE OR REPLACE PACKAGE theater_package IS PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER); PROCEDURE update_theater (v_name IN VARCHAR2); PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER); PROCEDURE add_theater; END theater_package; Which statement about the procedures in this specification is true?

    • They are public procedures

    • They are private procedures

    • Each procedure is missing code and, therefore, is illegal.

    • Each procedure contains an argument list and, therefore, is illegal.

    Correct Answer
    A. They are public procedures
    Explanation
    The procedures in this package specification are considered public procedures because they are declared without any access modifiers. Public procedures can be accessed and called by other programs or packages.

    Rate this question:

  • 4. 

    When creating a function in SQL*Plus, you receive an error message stating that the function created with compilation errors. What must you do to see the compilation errors?

    • Issue the SHOW ERRORS command.

    • Issue the DISPLAY ERRORS command.

    • Query the FUNCTION_ERRORS data dictionary view.

    • Do nothing. The errors will display after a five-second delay.

    Correct Answer
    A. Issue the SHOW ERRORS command.
    Explanation
    To see the compilation errors when creating a function in SQL*Plus, you need to issue the SHOW ERRORS command. This command will display the specific errors encountered during the compilation process, allowing you to identify and resolve them. It is important to review these errors to ensure the function is created correctly and functions as intended.

    Rate this question:

  • 5. 

    The AUDIT_THEATER trigger on the THEATER table is no longer needed and must be removed. Which command will successfully remove this trigger from the database?

    • DROP audit_theater;

    • DROP TRIGGER audit_theater;

    • ALTER TRIGGER audit_theater DROP;

    • ALTER TABLE theater DROP TRIGGER audit_theater;

    Correct Answer
    A. DROP TRIGGER audit_theater;
    Explanation
    The correct answer is "DROP TRIGGER audit_theater;". This command is used to remove a trigger from the database. The "DROP" keyword is used to indicate that the trigger is being dropped, and "audit_theater" specifies the name of the trigger that needs to be removed.

    Rate this question:

  • 6. 

    For which purpose are formal parameters used when creating functions?

    • Restricting pragma references

    • Passing values to the function

    • Bypassing directives to the compiler

    • Prompting the end user for information

    Correct Answer
    A. Passing values to the function
    Explanation
    Formal parameters are used when creating functions to pass values to the function. These parameters act as placeholders for the values that will be provided when the function is called. By passing values to the function through formal parameters, the function can perform operations on these values and return a result or perform a specific task based on the provided values. This allows for the reuse and flexibility of functions, as different values can be passed to achieve different outcomes.

    Rate this question:

  • 7. 

    Evaluate this statement: DROP PACKAGE dept_pack; Which statement is true?

    • This statement removes only the package body.

    • The statement removes only the package specification.

    • The statement removes the package specification and the package body.

    • This statement contains a syntax error.

    Correct Answer
    A. The statement removes the package specification and the package body.
    Explanation
    The given statement "DROP PACKAGE dept_pack;" is used to remove a package in a database. In this case, it removes both the package specification and the package body for the package named "dept_pack". Therefore, the correct answer is "The statement removes the package specification and the package body."

    Rate this question:

  • 8. 

    Examine this package specification and body: CREATE OR REPLACE PACKAGE theater_pck IS PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER); END theater_pck; CREATE OR REPLACE PACKAGE BODY theater_pck IS current_avg_cost_per_ticket NUMBER; PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER) IS v_seats_sold gross_receipt.seats_sold%TYPE; v_budget studio.yearly_budget%TYPE; BEGIN SELECT seats_sold INTO v_seats_sold FROM gross_receipt WHERE movie_id = v_movie_id AND theater_id = v_theater_id; END find_seats_sold; FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; RETURN v_yearly_budget; END get_budget; END theater_pck; Which type of variable is CURRENT_AVG_COST_PER_TICKET?

    • Public

    • Private

    • Invalid

    • Constant

    Correct Answer
    A. Private
    Explanation
    In the given package body, the variable CURRENT_AVG_COST_PER_TICKET is declared before the PROCEDURE find_seats_sold. It is not declared within any procedure or function, making it a private variable. Private variables can only be accessed within the package body and are not visible to other packages or outside the package.

    Rate this question:

  • 9. 

    For which trigger timing can you reference the NEW and OLD qualifiers?

    • Row only

    • Statement only

    • Statement and row

    • Oracle Forms trigger

    Correct Answer
    A. Row only
    Explanation
    The NEW and OLD qualifiers can be referenced for the "row only" trigger timing. This means that the qualifiers can be used when a trigger is fired for each row affected by a DML statement. In this case, the trigger can access the old and new values of the affected row.

    Rate this question:

  • 10. 

    Examine this procedure: CREATE OR REPLACE PROCEDURE find_cpt (v_movie_id {argument mode} NUMBER, v_cost_per_ticket {argument mode} NUMBER) IS BEGIN IF v_cost_per_ticket > 8.50 THEN SELECT cost_per_ticket INTO v_cost_per_ticket FROM gross_receipt WHERE movie_id = v_movie_id; END IF; END; Which argument mode should be used for V_MOVIE_ID?

    • IN

    • OUT

    • IN OUT

    • IN RETURN

    Correct Answer
    A. IN
    Explanation
    The argument mode for V_MOVIE_ID should be IN. This is because the procedure is using the value of V_MOVIE_ID to perform a SELECT query in the IF statement. It is not modifying the value of V_MOVIE_ID, so there is no need for it to be an OUT or IN OUT parameter. Additionally, there is no need for it to be a RETURN parameter, as the procedure is not returning any value related to V_MOVIE_ID. Therefore, the most appropriate argument mode for V_MOVIE_ID in this procedure is IN.

    Rate this question:

  • 11. 

    The CALC_COMM procedure is no longer needed and should be removed. Which command will successfully remove this procedure from the database?

    • DROP calc_comm;

    • REMOVE calc_comm;

    • DROP PROCEDURE calc_comm;

    • ALTER calc_comm DROP PROCEDURE;

    Correct Answer
    A. DROP PROCEDURE calc_comm;
    Explanation
    The correct answer is "DROP PROCEDURE calc_comm;". This command is used to remove a procedure from the database. In this case, it specifically removes the "calc_comm" procedure. The other options, "DROP calc_comm;", "REMOVE calc_comm;", and "ALTER calc_comm DROP PROCEDURE;", are not valid commands for removing a procedure.

    Rate this question:

  • 12. 

    Which command must you issue in SQL*Plus to display the result of the DBMS_OUTPUT package?

    • SET ECHO ON

    • SET OUTPUT ON

    • SET FEEDBACK ON

    • SET SERVEROUTPUT ON

    Correct Answer
    A. SET SERVEROUTPUT ON
    Explanation
    The correct answer is SET SERVEROUTPUT ON. This command enables the display of the result of the DBMS_OUTPUT package in SQL*Plus. It allows the output from procedures, functions, and triggers to be shown in the SQL*Plus command-line interface.

    Rate this question:

  • 13. 

    Examine this code: CREATE OR REPLACE PACKAGE prod_pack IS g_tax_rate NUMBER := .08; END prod_pack; Which statement about this code is true?

    • This package specification can exist without a body.

    • This package body can exist without a specification.

    • This package body cannot exist without a specification.

    • This package specification cannot exist without a body.

    Correct Answer
    A. This package specification can exist without a body.
    Explanation
    The given code is a package specification, which defines the interface of a package. In Oracle PL/SQL, a package specification can exist without a body. The package specification contains declarations of variables, constants, types, cursors, and subprograms that are accessible to other program units. The package body, on the other hand, contains the implementation of the subprograms declared in the specification. However, it is not necessary to have a package body for a package specification to exist.

    Rate this question:

  • 14. 

    Due to a disk failure, the AUDIT_THEATER table is unavailable until further notice. The CHECK_THEATER database trigger references this table when a DML operation is performed on the THEATER table. Which command should you issue to prevent this database trigger from executing until this problem is resolved?

    • ALTER TRIGGER check_theater DROP;

    • MODIFY TRIGGER check_theater DROP;

    • ALTER TRIGGER check_theater DISABLE;

    • MODIFY TRIGGER check_theater DISABLE;

    Correct Answer
    A. ALTER TRIGGER check_theater DISABLE;
    Explanation
    The correct answer is "ALTER TRIGGER check_theater DISABLE." This command will disable the "check_theater" trigger, preventing it from executing until the problem with the AUDIT_THEATER table is resolved.

    Rate this question:

  • 15. 

    You created a database trigger that will be executed for all data manipulation statements on the THEATER table. Within the code, you will determine which type of manipulation has caused the trigger to execute. Which would you use to test for the type of manipulation being performed?

    • DBMS_SQL

    • DBMS_TRIGGER

    • DBMS_CHECK_MANIPULATION_TYPE

    • DELETING, UPDATING, and INSERTING

    Correct Answer
    A. DELETING, UPDATING, and INSERTING
    Explanation
    To test for the type of manipulation being performed, you would use the options DELETING, UPDATING, and INSERTING. These options represent the different types of data manipulation statements that can be executed on the THEATER table. By checking which of these options is true within the trigger code, you can determine the type of manipulation that caused the trigger to execute.

    Rate this question:

  • 16. 

    Examine this function: CREATE OR REPLACE FUNCTION set_budget (v_studio_id IN NUMBER, v_new_budget IN NUMBER) RETURN number IS BEGIN UPDATE studio SET yearly_budget = v_new_budget WHERE id = v_studio_id; COMMIT; RETURN SQL%ROWCOUNT; END; While executing this in SQL*Plus, you want to see the value of SQL%ROWCOUNT displayed on the screen. Which line of code will accomplish this?

    • OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT));

    • DBMS_DEBUG.PUT_LINE(TO_CHAR(SQL%ROWCOUNT));

    • DBMS_OUTPUT.DISPLAY(TO_CHAR(SQL%ROWCOUNT));

    • DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT));

    Correct Answer
    A. DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT));
    Explanation
    The correct answer is DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT));. This line of code will display the value of SQL%ROWCOUNT on the screen using the DBMS_OUTPUT.PUT_LINE function. The TO_CHAR function is used to convert the value of SQL%ROWCOUNT to a character string before displaying it.

    Rate this question:

  • 17. 

    Examine this database trigger: CREATE OR REPLACE TRIGGER audit_gross_modification AFTER INSERT OR DELETE ON gross_receipt BEGIN INSERT INTO audit_gross VALUES (USER, SYSDATE); END; To test this trigger, you delete 30 rows from the GROSS_RECEIPT table. How many rows are inserted into the AUDIT_GROSS table due to this event?

    • 1

    • 30

    • 31

    • None

    Correct Answer
    A. 1
    Explanation
    When the trigger is fired after deleting 30 rows from the GROSS_RECEIPT table, only one row is inserted into the AUDIT_GROSS table. This is because the trigger is designed to insert a single row into the AUDIT_GROSS table every time it is fired, regardless of the number of rows affected by the DELETE statement. Therefore, regardless of the number of rows deleted, only one row will be inserted into the AUDIT_GROSS table.

    Rate this question:

  • 18. 

    Examine this procedure: CREATE PROCEDURE add_theater IS BEGIN INSERT INTO theater VALUES (35, 'Riverplace Theatre', '1222 River Drive, Austin, Tx.'); END; This procedure already exists in the database. You have made a change to the code and want to recreate the procedure. Which command must you now use to prevent an error?

    • REPLACE PROCEDURE

    • RECREATE PROCEDURE

    • UPDATE PROCEDURE WITH

    • CREATE OR REPLACE PROCEDURE

    Correct Answer
    A. CREATE OR REPLACE PROCEDURE
    Explanation
    The correct answer is "CREATE OR REPLACE PROCEDURE". This command allows you to recreate the procedure without causing an error. By using the "CREATE OR REPLACE" syntax, you can replace the existing procedure with the updated code, ensuring that any changes you have made are implemented correctly.

    Rate this question:

  • 19. 

    Procedures and functions are very similar. For which reason would you choose a function over a procedure?

    • A function allows Oracle group functions.

    • A function can be used in a SQL statement.

    • A function guarantees read consistency, while a procedure cannot.

    • A function can only be executed from a previously created procedure.

    Correct Answer
    A. A function can be used in a SQL statement.
    Explanation
    A function can be used in a SQL statement because it returns a value that can be used in a query. This allows for more flexibility in manipulating and retrieving data from the database. In contrast, a procedure does not return a value and is typically used for performing a series of actions or tasks without returning a result.

    Rate this question:

  • 20. 

    The auditing utility in Oracle records the type of data manipulation operation and not the actual changed values. To enhance auditing by capturing the new and old values, you create which type of trigger?

    • Row only

    • Statement only

    • Either statement or row

    • Neither statement or row

    Correct Answer
    A. Row only
    Explanation
    To enhance auditing by capturing the new and old values, you create a "row only" trigger. This type of trigger is specifically designed to capture the changes made to individual rows in a table. It allows you to track the old and new values of the modified data, providing more detailed information for auditing purposes. By using a "row only" trigger, you can ensure that the actual changed values are recorded along with the type of data manipulation operation.

    Rate this question:

  • 21. 

    When a database trigger routine does not have to take place before the triggering event, which timing should you assign to the trigger?

    • On

    • Off

    • After

    • Before

    Correct Answer
    A. After
    Explanation
    When a database trigger routine does not have to take place before the triggering event, the timing that should be assigned to the trigger is "after". This means that the trigger will be executed after the triggering event has occurred.

    Rate this question:

  • 22. 

    When declaring arguments within a procedure, which specification is NOT allowed?

    • %TYPE

    • Data type

    • %ROWTYPE

    • Maximum length

    Correct Answer
    A. Maximum length
    Explanation
    The specification "maximum length" is not allowed when declaring arguments within a procedure. The other options, "%TYPE", "data type", and "%ROWTYPE" are all valid specifications that can be used when declaring arguments.

    Rate this question:

  • 23. 

    CREATE OR REPLACE PACKAGE theater_pck IS PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER); END theater_pck; CREATE OR REPLACE PACKAGE BODY theater_pck IS current_avg_cost_per_ticket NUMBER; PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER) IS v_seats_sold gross_receipt.seats_sold%TYPE; v_budget studio.yearly_budget%TYPE; BEGIN SELECT seats_sold INTO v_seats_sold FROM gross_receipt WHERE movie_id = v_movie_id AND theater_id = v_theater_id; END find_seats_sold; FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; RETURN v_yearly_budget; END get_budget; END theater_pck; Which will successfully invoke the FIND_SEATS_SOLD procedure within SQL*Plus?

    • EXECUTE find_seats_sold (500,11);

    • Theater_pck.find_seats_sold (500,11);

    • EXECUTE theater_pck.find_seats_sold (500,11);

    • SELECT find_seats_sold(movie_id, theater_id) FROM gross_receipt;

    Correct Answer
    A. EXECUTE theater_pck.find_seats_sold (500,11);
    Explanation
    The correct answer is "EXECUTE theater_pck.find_seats_sold (500,11);" because it uses the correct syntax to invoke a procedure within SQL*Plus. The EXECUTE keyword is used to execute a stored procedure, followed by the fully qualified name of the procedure, which includes the package name "theater_pck" and the procedure name "find_seats_sold". The procedure is then passed the arguments 500 and 11.

    Rate this question:

  • 24. 

    You decide to use packages to logically group related programming constructs. Which two types of constructs can be grouped within a package? (Choose two.)

    • View

    • Cursor

    • Variable

    • Database trigger

    • Application trigger

    Correct Answer(s)
    A. Cursor
    A. Variable
    Explanation
    Packages in programming are used to logically group related programming constructs. Two types of constructs that can be grouped within a package are cursors and variables. Cursors are used to retrieve and manipulate data from a database, while variables are used to store and manipulate data within a program. By grouping these constructs within a package, it allows for better organization, modularity, and reusability of code.

    Rate this question:

  • 25. 

    Examine this procedure: PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER) IS BEGIN IF v_cost_per_ticket > 8.50 THEN SELECT cost_per_ticket INTO v_cost_per_ticket FROM gross_receipt WHERE movie_id = v_movie_id; END IF; END; You decide to create this procedure within the THEATER_PCK package. It will be accessible outside of the package. What will you add to the package specification?

    • PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER);

    • PUBLIC PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER);

    • PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER) IS BEGIN IF v_cost_per_ticket > 8.50 THEN SELECT cost_per_ticket INTO v_cost_per_ticket FROM gross_receipt WHERE movie_id = v_movie_id; END IF; END;

    • PUBLIC PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER) IS BEGIN IF v_cost_per_ticket > 8.50 THEN SELECT cost_per_ticket INTO v_cost_per_ticket FROM gross_receipt WHERE movie_id = v_movie_id; END IF; END;

    Correct Answer
    A. PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER);
    Explanation
    The correct answer is "PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER);". This is the correct syntax for adding a procedure to the package specification. It includes the procedure name, the input and output parameters, and their data types.

    Rate this question:

  • 26. 

    Each month a SQL*Loader application is executed to insert approximately 1 million rows into the GROSS_RECEIPT table. This table has three database triggers that execute for each row inserted. Which command can you issue immediately before the SQL*Loader operation to improve performance?

    • DISABLE TRIGGERS ON gross_receipt;

    • DISABLE ALL TRIGGERS ON gross_receipt;

    • ALTER TRIGGER ALL DISABLE ON gross_receipt;

    • ALTER TABLE gross_receipt DISABLE ALL TRIGGERS;

    Correct Answer
    A. ALTER TABLE gross_receipt DISABLE ALL TRIGGERS;
    Explanation
    Disabling all triggers on the "gross_receipt" table using the "ALTER TABLE" command can improve performance during the SQL*Loader operation. By disabling the triggers, the database will not have to execute them for each row inserted, which can reduce the overall processing time and improve performance. This allows the SQL*Loader application to insert the rows more efficiently into the table.

    Rate this question:

  • 27. 

    Examine this procedure: CREATE PROCEDURE update_theater IS BEGIN UPDATE theater SET name = v_name WHERE id = 34; END; Because a value for the new theater name must be passed to this procedure upon invocation, you decide to create a parameter called V_NAME to hold the value. To be successful, which additional change must you make to this procedure?

    • Add (v_name IN VARCHAR2) immediately after the IS keyword.

    • Add v_name VARCHAR2(30); immediately after the IS keyword.

    • Add (v_name IN VARCHAR2) immediately before the IS keyword.

    • Add (v_name IN VARCHAR2) immediately after the BEGIN keyword.

    Correct Answer
    A. Add (v_name IN VARCHAR2) immediately before the IS keyword.
    Explanation
    To be successful, an additional change that must be made to this procedure is to add (v_name IN VARCHAR2) immediately before the IS keyword. This indicates that a parameter called V_NAME of type VARCHAR2 should be passed to the procedure when it is invoked.

    Rate this question:

  • 28. 

    Which statement about packages is true?

    • A package can be called.

    • A package can be nested.

    • A package can be parameterized.

    • Package contents can be shared by multiple applications.

    Correct Answer
    A. Package contents can be shared by multiple applications.
    Explanation
    Packages in programming languages like Java allow for better organization and encapsulation of code. They can contain classes, interfaces, and other packages. One of the main advantages of using packages is that their contents can be shared by multiple applications. This means that different programs can access and use the classes and resources within a package, promoting code reuse and modularity. This helps in avoiding code duplication and makes development more efficient. Therefore, the statement "Package contents can be shared by multiple applications" is true.

    Rate this question:

  • 29. 

    A stored function can be invoked in many different ways. Which invocation example is NOT valid?

    • Executing the stored function within an INSERT statement

    • Executing the stored function within a server-side function

    • Executing the stored function within a client-side function

    • Executing the stored function within the DEFAULT clause of the CREATE TABLE statement

    Correct Answer
    A. Executing the stored function within the DEFAULT clause of the CREATE TABLE statement
  • 30. 

    CREATE OR REPLACE PACKAGE theater_pck IS v_total_budget NUMBER; PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER); END theater_pck; CREATE OR REPLACE PACKAGE BODY theater_pck IS current_avg_cost_per_ticket NUMBER; PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER) IS v_seats_sold gross_receipt.seats_sold%TYPE; v_budget studio.yearly_budget%TYPE; BEGIN SELECT seats_sold INTO v_seats_sold FROM gross_receipt WHERE movie_id = v_movie_id AND theater_id = v_theater_id; END find_seats_sold; FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; RETURN v_yearly_budget; END get_budget; END theater_pck; Which statement about the V_TOTAL_BUDGET variable is true?

    • It must also be declared in the body.

    • It can only be referenced from inside the package

    • It can only be referenced from outside the package.

    • It can be referenced from inside and outside the package.

    Correct Answer
    A. It can be referenced from inside and outside the package.
    Explanation
    The V_TOTAL_BUDGET variable can be referenced from both inside and outside the package. This is because it is declared in the package specification, which allows it to be accessed by any program that uses the package. It does not need to be declared again in the package body.

    Rate this question:

  • 31. 

    Examine this package specification and body: CREATE OR REPLACE PACKAGE theater_pck IS PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER); END theater_pck; CREATE OR REPLACE PACKAGE BODY theater_pck IS current_avg_cost_per_ticket NUMBER; PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER) IS v_seats_sold gross_receipt.seats_sold%TYPE; v_budget studio.yearly_budget%TYPE; BEGIN SELECT seats_sold INTO v_seats_sold FROM gross_receipt WHERE movie_id = v_movie_id AND theater_id = v_theater_id; END find_seats_sold; FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; RETURN v_yearly_budget; END get_budget; END theater_pck; Which statement about the GET_BUDGET function is true?

    • It can be referenced within a SQL statement.

    • It can be referenced from outside of the package.

    • It can only be referenced from within the package.

    • It must also be specified in the specification because it is specified in the body.

    Correct Answer
    A. It can only be referenced from within the package.
    Explanation
    The GET_BUDGET function can only be referenced from within the package. This means that it cannot be called or used outside of the package. It is only accessible within the package's body, and cannot be accessed or called from any other part of the code or program.

    Rate this question:

  • 32. 

    Procedures and functions are explicitly executed. This is different from a database trigger. When is a database trigger executed?

    • When the transaction is committed

    • During a data manipulation statement

    • When it is explicitly invoked by another construct

    • When an Oracle supplied package references the trigger

    Correct Answer
    A. During a data manipulation statement
    Explanation
    A database trigger is executed during a data manipulation statement. This means that whenever a specific action, such as an insert, update, or delete, is performed on the data in a table, the trigger associated with that table will be automatically executed. The trigger can be used to perform additional actions or enforce certain rules before or after the data manipulation statement is executed.

    Rate this question:

  • 33. 

    Examine this trigger: CREATE OR REPLACE TRIGGER audit_gross_receipt AFTER DELETE OR UPDATE OF seats_sold, cost_per_ticket ON gross_receipt BEGIN ... END; How many times will the trigger body execute upon invocation?

    • Once

    • Twice

    • Once for each row deleted or updated

    • Once for each row deleted or seats_sold_cost_per_ticket updated

    Correct Answer
    A. Once
    Explanation
    The trigger body will execute once upon invocation. This is because the trigger is defined as an "AFTER" trigger, which means it will only execute after the specified event (in this case, a delete or update of seats_sold or cost_per_ticket on the gross_receipt table) has occurred. Therefore, regardless of the number of rows affected by the delete or update statement, the trigger body will only execute once.

    Rate this question:

  • 34. 

    CREATE OR REPLACE TRIGGER update_studio BEFORE UPDATE OF yearly_budget ON STUDIO FOR EACH ROW BEGIN ... END; Which event will invoke this trigger?

    • STUDIO table update

    • YEARLY_BUDGET column update

    • STUDIO table insert, update, or delete

    • Any column update other than YEARLY_BUDGET

    Correct Answer
    A. YEARLY_BUDGET column update
    Explanation
    This trigger will be invoked when there is an update specifically on the "YEARLY_BUDGET" column of the "STUDIO" table. It will not be triggered by any other column updates or by insert, update, or delete operations on the "STUDIO" table.

    Rate this question:

  • 35. 

    Examine this function: CREATE OR REPLACE FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; END; To execute this function successfully, what additional code must be added to the executable section?

    • RETURN

    • RETURN get_budget;

    • OUT v_yearly_budget;

    • RETURN v_yearly_budget;

    Correct Answer
    A. RETURN v_yearly_budget;
    Explanation
    The additional code that must be added to the executable section is "RETURN v_yearly_budget;". This is because the function is declared to return a number, and the variable v_yearly_budget holds the value that should be returned. By adding "RETURN v_yearly_budget;", the function will successfully return the value of v_yearly_budget when executed.

    Rate this question:

  • 36. 

    Which statement about declaring parameters is true?

    • Only data type is required.

    • Data type and maximum length are required.

    • Data type and maximum length are not required.

    • Only maximum length is required for the VARCHAR2 data type.

    Correct Answer
    A. Only data type is required.
    Explanation
    When declaring parameters, only the data type is required. The maximum length is not necessary to specify when declaring parameters.

    Rate this question:

  • 37. 

    CREATE OR REPLACE PACKAGE theater_pck IS PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER); END theater_pck; CREATE OR REPLACE PACKAGE BODY theater_pck IS current_avg_cost_per_ticket NUMBER; PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER) IS v_seats_sold gross_receipt.seats_sold%TYPE; v_budget studio.yearly_budget%TYPE; BEGIN SELECT seats_sold INTO v_seats_sold FROM gross_receipt WHERE movie_id = v_movie_id AND theater_id = v_theater_id; END find_seats_sold; FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; RETURN v_yearly_budget; END get_budget; END theater_pck; Which statement about the CURRENT_AVG_COST_PER_TICKET variable is true?

    • It can only be referenced from outside the package

    • It can be referenced from outside and within the package.

    • It can be referenced by all constructs within the package.

    • It must be moved to the specification to compile successfully

    Correct Answer
    A. It can be referenced by all constructs within the package.
    Explanation
    The CURRENT_AVG_COST_PER_TICKET variable can be referenced by all constructs within the package. This means that it can be accessed and used by any procedure or function within the package, including the find_seats_sold procedure and the get_budget function. It does not need to be moved to the package specification in order to compile successfully.

    Rate this question:

  • 38. 

    Examine this database trigger: CREATE OR REPLACE TRIGGER update_show_gross {additional trigger information} BEGIN {additional code} END; This trigger should execute for each row when the SEATS_SOLD or COST_PER_TICKET columns are updated and when a row is inserted into the GROSS_RECEIPT table. Which trigger information must you add?

    • BEFORE (gross_receipt, seats_sold, cost_per_ticket) INSERT, UPDATE

    • BEFORE INSERT OR UPDATE OF seats_sold, cost_per_ticket ON gross_receipt

    • BEFORE INSERT OR UPDATE(seats_sold, cost_per_ticket) ON gross_receipt FOR EVERY ROW

    • BEFORE INSERT OR UPDATE OF seats_sold, cost_per_ticket ON gross_receipt FOR EACH ROW

    Correct Answer
    A. BEFORE INSERT OR UPDATE OF seats_sold, cost_per_ticket ON gross_receipt FOR EACH ROW
    Explanation
    The trigger should execute for each row when the SEATS_SOLD or COST_PER_TICKET columns are updated and when a row is inserted into the GROSS_RECEIPT table. Therefore, the trigger information must specify that the trigger should be executed before an insert or update operation on the SEATS_SOLD and COST_PER_TICKET columns of the GROSS_RECEIPT table. Additionally, the trigger should be executed for each row affected by the insert or update operation.

    Rate this question:

  • 39. 

    Examine this function: CREATE OR REPLACE FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; RETURN v_yearly_budget; END; This function is owned by the account, PROD. The user, JSMITH, must execute this function. Which GRANT command(s) should be issued?

    • GRANT EXECUTE ON get_budget TO jsmith;

    • GRANT EXECUTE, SELECT ON studio TO jsmith;

    • GRANT EXECUTE, SELECT ON get_budget TO jsmith;

    • GRANT SELECT ON studio TO jsmith; GRANT EXECUTE ON get_budget TO jsmith;

    Correct Answer
    A. GRANT EXECUTE ON get_budget TO jsmith;
    Explanation
    The function "get_budget" is owned by the account PROD and the user JSMITH needs to execute this function. To grant JSMITH the permission to execute the function, the GRANT command "GRANT EXECUTE ON get_budget TO jsmith;" should be issued. This command specifically grants the EXECUTE privilege on the "get_budget" function to the user JSMITH.

    Rate this question:

  • 40. 

    Examine this code: BEGIN theater_pck.v_total_seats_sold_overall := theater_pck.get_total_for_year; END; For this code to be successful, what must be true?

    • Only the GET_TOTAL_FOR_YEAR variable must exist in the specification of the THEATER_PCK package.

    • Only the V_TOTAL_SEATS_SOLD_OVERALL variable must exist in the specification of the THEATER_PCK package.

    • Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist only in the body of the THEATER_PCK package.

    • Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist in the specification of the THEATER_PCK package.

    Correct Answer
    A. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist in the specification of the THEATER_PCK package.
    Explanation
    For the code to be successful, both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist in the specification of the THEATER_PCK package. This means that both the variable and the function must be declared and defined in the package specification, allowing them to be accessed and used in the code. If either the variable or the function is missing from the package specification, the code will not be able to compile and execute successfully.

    Rate this question:

  • 41. 

    Examine this procedure: CREATE OR REPLACE PROCEDURE find_seats_sold (v_movie_id IN NUMBER) IS v_seats_sold gross_receipt.seats_sold%TYPE; BEGIN SELECT seats_sold INTO v_seats_sold FROM gross_receipt WHERE movie_id = v_movie_id; END; The value of V_SEATS_SOLD must be returned to the calling environment. Which change should you make to the code?

    • Declare V_SEATS_SOLD as an OUT argument.

    • Declare V_SEATS_SOLD as a RETURN argument.

    • Add RETURN V_SEATS_SOLD immediately before the IS keyword.

    • Add RETURN V_SEATS_SOLD immediately before the END keyword.

    Correct Answer
    A. Declare V_SEATS_SOLD as an OUT argument.
    Explanation
    To return the value of V_SEATS_SOLD to the calling environment, it should be declared as an OUT argument. An OUT argument allows the procedure to pass a value back to the calling environment. This can be done by adding the OUT keyword before the parameter declaration of V_SEATS_SOLD in the procedure declaration.

    Rate this question:

  • 42. 

    Examine this package specification and body: CREATE OR REPLACE PACKAGE theater_pck IS PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER); END theater_pck; CREATE OR REPLACE PACKAGE BODY theater_pck IS current_avg_cost_per_ticket NUMBER; PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER) IS v_seats_sold gross_receipt.seats_sold%TYPE; v_budget studio.yearly_budget%TYPE; BEGIN SELECT seats_sold INTO v_seats_sold FROM gross_receipt WHERE movie_id = v_movie_id AND theater_id = v_theater_id; END find_seats_sold; FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; RETURN v_yearly_budget; END get_budget; END theater_pck;Which statement about the FIND_SEATS_SOLD procedure is true?

    • It can be referenced within a SQL statement.

    • It can only be referenced from within the package.

    • It can be referenced from within and outside of the package.

    • It cannot also be specified in the specification because it is specified in the body.

    Correct Answer
    A. It can be referenced from within and outside of the package.
    Explanation
    The FIND_SEATS_SOLD procedure can be referenced from both within and outside of the package. This means that the procedure can be called and used in SQL statements as well as in other parts of the code outside of the package.

    Rate this question:

  • 43. 

    Which subprogram type can be invoked from within a SQL statement?

    • Function

    • Procedure

    • Public packaged procedure

    • Private packaged procedure

    • Private packaged function

    Correct Answer
    A. Function
    Explanation
    A function can be invoked from within a SQL statement. Functions are subprograms that can be called within SQL statements to perform a specific task and return a value. They can be used to manipulate data, perform calculations, or retrieve specific information from the database. Unlike procedures, functions always return a value and can be used in expressions or as part of a query. Therefore, a function is the correct subprogram type that can be invoked from within a SQL statement.

    Rate this question:

  • 44. 

    Which statement about error propagation is true?

    • An exception can propagate across remote procedure calls.

    • The RAISE; statement in an exception handler ends the current exception.

    • An exception raised inside an exception handler will not propagate to the enclosing block.

    • When an exception is raised in a called procedure, control goes to the exception section of that block.

    Correct Answer
    A. When an exception is raised in a called procedure, control goes to the exception section of that block.
    Explanation
    When an exception is raised in a called procedure, control goes to the exception section of that block. This means that if an exception occurs within a procedure or function that is called by another block of code, the control will be transferred to the exception handling section of the called procedure. This allows for proper handling and management of exceptions, ensuring that the appropriate actions are taken to handle the error and prevent program termination.

    Rate this question:

  • 45. 

    Modifications to the THEATER table are not allowed during the last week in December. When creating a database trigger to enforce this rule, which timing will you use to be most efficient?

    • After

    • Weekly

    • Before

    • Monthly

    Correct Answer
    A. Before
    Explanation
    Using the "before" timing for the trigger will be most efficient in enforcing the rule that modifications to the THEATER table are not allowed during the last week in December. This is because the "before" timing allows the trigger to be executed before the modification takes place, effectively preventing any modifications from occurring during the specified time period. By using the "before" timing, the trigger can quickly and efficiently check the date and prevent any unauthorized modifications, saving resources and ensuring that the rule is enforced effectively.

    Rate this question:

  • 46. 

    Which statement about packages is true?

    • Package constructs stored in the database are public.

    • Package constructs defined within the package specification are private.

    • Private and public package constructs are both declared and defined within the package body.

    • A private package construct can only be referenced only by other constructs within the same package.

    Correct Answer
    A. A private package construct can only be referenced only by other constructs within the same package.
    Explanation
    Private package constructs are only accessible within the same package and cannot be referenced by any other constructs outside of the package. This means that they are not public and cannot be accessed by other packages or programs. Therefore, the statement "A private package construct can only be referenced only by other constructs within the same package" is true.

    Rate this question:

  • 47. 

    Examine this package specification and body: CREATE OR REPLACE PACKAGE theater_pck IS PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER); END theater_pck; CREATE OR REPLACE PACKAGE BODY theater_pck IS current_avg_cost_per_ticket NUMBER; PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT 34, v_theater_id IN NUMBER) IS v_seats_sold gross_receipt.seats_sold%TYPE; v_budget studio.yearly_budget%TYPE; BEGIN SELECT seats_sold INTO v_seats_sold FROM gross_receipt WHERE movie_id = v_movie_id AND theater_id = v_theater_id; END find_seats_sold; FUNCTION get_budget (v_studio_id IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; RETURN v_yearly_budget; END get_budget; END theater_pck; Which code will successfully invoke the GET_BUDGET function within SQL*Plus?

    • VARIABLE g_budget_amount NUMBER EXECUTE :g_budget_amount := get_budget(11);

    • VARIABLE g_budget_amount NUMBER EXECUTE theater_pck.get_budget(g_budget_amount, 11);

    • VARIABLE g_budget_amount NUMBER EXECUTE :g_budget_amount := theater_pck.get_budget(11);

    • This function cannot be referenced from outside the package.

    Correct Answer
    A. This function cannot be referenced from outside the package.
    Explanation
    The code to invoke the GET_BUDGET function within SQL*Plus is not provided. However, based on the given package specification and body, the GET_BUDGET function is not declared as a public function in the package. Therefore, it cannot be referenced or invoked from outside the package.

    Rate this question:

  • 48. 

    Examine this procedure: CREATE OR REPLACE PROCEDURE FIND_ORDERS (v_total IN sales_order.total%TYPE) IS CURSOR c1 IS SELECT order_id FROM sales_order WHERE total > v_total; BEGIN FOR sales_order_rec in c1 LOOP --process the row END LOOP; END; This procedure returns all orders with a total greater than an amount that is passed in the V_TOTAL parameter. Occasionally, a user might want to process all orders regardless of the total amount. They could do this by passing 0 in the V_TOTAL parameter, however, they would prefer not to pass anything. Which change can you make to the procedure to allow a user to process all orders in the SALES_ORDER table without having to pass a 0 total amount?

    • Remove only the V_TOTAL parameter.

    • Remove the NVL function from the WHERE clause.

    • Use (v_total IN sales_order.total%TYPE => 0) as the parameter definition.

    • Use (v_total IN sales_order.total%TYPE DEFAULT 0) as the parameter definition.

    Correct Answer
    A. Use (v_total IN sales_order.total%TYPE DEFAULT 0) as the parameter definition.
    Explanation
    The correct answer is to use (v_total IN sales_order.total%TYPE DEFAULT 0) as the parameter definition. By using the DEFAULT keyword, the parameter will have a default value of 0 if no value is explicitly passed when calling the procedure. This allows the user to process all orders in the SALES_ORDER table without having to pass a 0 total amount.

    Rate this question:

  • 49. 

    You have just successfully dropped the CALC_COMM procedure and deleted the script file containing the source code. Which command can you execute to recover this procedure?

    • ROLLBACK ;

    • ROLLBACK TO PROCEDURE calc_comm;

    • ALTER PROCEDURE calc_comm COMPILE;

    • Only the database administrator can recover this procedure using backups.

    Correct Answer
    A. Only the database administrator can recover this procedure using backups.
    Explanation
    The correct answer states that only the database administrator can recover the CALC_COMM procedure using backups. This implies that there is no specific command mentioned in the given options that can be executed to recover the procedure. Instead, it suggests that the procedure can only be recovered by restoring the database from a backup, which can be done by the database administrator.

    Rate this question:

Quiz Review Timeline (Updated): Jul 4, 2024 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jul 04, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 10, 2009
    Quiz Created by
    Sunil.aketi
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.