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,183 | Questions: 75
Please wait...
Question 1 / 75
0 %
0/100
Score 0/100
1. While creating a package, you placed the function name in the specification and the body. Which type of construct have you created?

Explanation

By placing the function name in both the specification and the body, you have created a PUBLIC construct. This means that the function can be accessed and used by other parts of the code or other packages.

Submit
Please wait...
About This Quiz
Oracle Certification Exam Quiz: MCQ! - 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,... see moredepending upon the level of certification. If you intend to learn more about the Oracle Certification Exam, look no further than this quiz.
see less

Personalize your quiz and earn a certificate with your name on it!
2. The GET_BUDGET function is no longer needed and should be removed. Which command will successfully remove this function from the database?

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
6. For which purpose are formal parameters used when creating functions?

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.

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

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."

Submit
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?

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.

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

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.

Submit
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?

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.

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

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.

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

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

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

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.

Submit
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?

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.

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

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.

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

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.

Submit
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?

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.

Submit
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.)

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
28. Which statement about packages is true?

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.

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

Explanation

not-available-via-ai

Submit
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?

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.

Submit
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?

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.

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

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
36. Which statement about declaring parameters is true?

Explanation

When declaring parameters, only the data type is required. The maximum length is not necessary to specify when declaring parameters.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

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

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.

Submit
44. Which statement about error propagation is true?

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.

Submit
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?

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.

Submit
46. Which statement about packages is true?

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.

Submit
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?

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.

Submit
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?

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.

Submit
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?

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.

Submit
50. 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; BEGIN current_avg_cost_per_ticket := 8.50; END theater_pck; Which statement about the value of CURRENT_AVG_COST_PER_TICKET is true?

Explanation

The value of CURRENT_AVG_COST_PER_TICKET is assigned 8.50 when the package is first invoked within a session.

Submit
51. 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 assign a value to the CURRENT_AVG_COST_PER_TICKET variable within SQL*Plus?

Explanation

The explanation for the given correct answer is that the variable CURRENT_AVG_COST_PER_TICKET is declared within the package body and is not accessible outside of the package. Therefore, it cannot be directly assigned a value within SQL*Plus.

Submit
52. Examine this trigger: CREATE OR REPLACE TRIGGER budget_trig AFTER INSERT ON studio FOR EACH ROW DECLARE v_sum NUMBER; BEGIN SELECT sum(yearly_budget) INTO v_sum FROM studio; UPDATE parent_company SET overall_budget = v_sum; END; You insert a row into the STUDIO table and receive this message: ORA-04091: table SCOTT.STUDIO is mutating, trigger/function may not see it How do you correct this error?

Explanation

The error message "ORA-04091: table SCOTT.STUDIO is mutating, trigger/function may not see it" indicates that the trigger is trying to access the table it is defined on (STUDIO) while it is still being modified. To correct this error, the trigger should be converted to a statement level trigger by removing the "FOR EACH ROW" clause. This change ensures that the trigger operates on the entire statement rather than individual rows, avoiding the mutation error.

Submit
53. 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?

Explanation

To test for the type of manipulation being performed, you would use "DELETING, UPDATING, and INSERTING". These are the options that represent the different types of data manipulation statements that can be executed on the THEATER table. By checking which type of manipulation is being performed, you can determine the appropriate action to take within the trigger code.

Submit
54. Examine this function: CREATE OR REPLACE FUNCTION get_budget 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; What additional code is needed to compile this function successfully?

Explanation

To compile the given function successfully, the additional code needed is to add "(v_studio_id IN NUMBER)" right before the RETURN statement of the header. This is necessary because the function is using the variable v_studio_id in the SELECT statement, but it is not declared in the function header. By adding this parameter in the header, the function will be able to compile and execute correctly.

Submit
55. Evaluate this procedure: CREATE OR REPLACE PROCEDURE remove_department (v_deptno IN NUMBER(9)) IS BEGIN DELETE dept WHERE deptno = v_deptno; END; Why does this statement fail when compiled?

Explanation

The statement fails when compiled because specifying a precision for a formal parameter is not permitted. In PL/SQL, formal parameters do not have a precision, as they are placeholders for values that will be passed into the procedure at runtime. Therefore, specifying a precision for v_deptno is not allowed and causes the compilation to fail.

Submit
56. Examine this procedure: CREATE OR REPLACE PROCEDURE find_cpt (v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER DEFAULT 0) 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; Why does this statement fail when executed?

Explanation

The statement fails because the declaration of V_COST_PER_TICKET cannot have a DEFAULT value. In the procedure, V_COST_PER_TICKET is declared as IN OUT parameter, which means it can be both input and output. However, when declaring an IN OUT parameter, it is not allowed to provide a default value.

Submit
57. Which two subprogram headers are correct? (Choose two.)

Explanation

The two correct subprogram headers are "CREATE OR REPLACE PROCEDURE get_sal" with input parameter "v_sal" of type number, and "CREATE OR REPLACE FUNCTION calc_comm" with input parameter "p_amnt" of type number and return type number.

Submit
58. When creating the ADD_PROD procedure in SQL*Plus, you receive this message: Warning: Procedure created with compilation errors. What was saved to the data dictionary?

Explanation

When creating the ADD_PROD procedure in SQL*Plus and receiving the message "Warning: Procedure created with compilation errors," it means that both the source code and compilation errors were saved to the data dictionary. The data dictionary is a collection of metadata that stores information about the database objects, including the source code and any errors encountered during compilation. Therefore, when the procedure is created with compilation errors, both the source code and these errors are saved in the data dictionary.

Submit
59. Which statement about formal parameters is true?

Explanation

The statement that is true about formal parameters is that you cannot assign a value to an IN formal parameter inside the procedure in which it is being used. IN parameters are used for passing values into a procedure, and they are read-only within the procedure. This means that you cannot modify the value of an IN parameter inside the procedure.

Submit
60. Which code successfully calculates commission returning it to the calling environment?

Explanation

The correct answer is the third option: CREATE OR REPLACE FUNCTION calc_comm (v_emp_id IN NUMBER) IS RETURN number v_total NUMBER; BEGIN SELECT SUM(ord.total) INTO v_total FROM ord,customer WHERE ord.custid = customer.custid AND customer.repid = v_emp_id; RETURN (v_total * .20); END;

This option successfully calculates the commission by selecting the sum of the total orders for a specific employee ID and multiplying it by 0.20. It also includes the necessary syntax for creating a function in Oracle PL/SQL.

Submit
61. Which three statements about procedures are true? (Choose three.)

Explanation

Procedures are typically written in SQL and are used to add functionality to SQL DML statements. They promote reusability and maintainability by allowing the same code to be used multiple times and making it easier to make changes to the code in one place. Procedures can perform actions and accept parameters, allowing for flexibility in their use. Additionally, procedures require at least one executable statement in the procedure body to define the actions to be performed.

Submit
62. How do functions simplify maintainability?

Explanation

Functions simplify maintainability by limiting changes to logic to one location. This means that if there is a change needed in the logic of a function, it only needs to be made in that one location. This reduces the chances of introducing errors or inconsistencies, as the logic is centralized and can be easily managed. It also makes it easier to understand and debug the code, as the logic is contained within a specific function. By limiting changes to one location, functions promote modularity and encapsulation, making the code easier to maintain and update.

Submit
63. Which two statements are true? (Choose two.)

Explanation

A function must return a value because it is designed to perform a specific task and produce a result. It is expected to return a value to the caller.

A function can be invoked from within a PL/SQL expression because it can be used as part of a larger expression or calculation within a PL/SQL block. This allows the function to be used to manipulate data or perform calculations within the PL/SQL code.

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

Explanation

not-available-via-ai

Submit
65. Examine this function: CREATE OR REPLACE FUNCTION set_budget (v_studio_id IN NUMBER, v_new_budget IN NUMBER) RETURN BOOLEAN IS BEGIN UPDATE studio SET yearly_budget = v_new_budget WHERE id = v_studio_id; IF SQL%FOUND THEN RETURN TRUE; ELSE RETURN FALSE; END IF; COMMIT; END; Which code will successfully invoke this function?

Explanation

The correct answer is the DECLARE block because it declares a variable v_updated_flag of type BOOLEAN and assigns the result of the set_budget function to it. This allows the function to be invoked and the result to be stored in the variable for further use.

Submit
66. 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; Which set of statements will successfully invoke this function within SQL*Plus?

Explanation

The correct set of statements to successfully invoke the function within SQL*Plus is to declare a variable "g_yearly_budget" of type NUMBER using the "VARIABLE" command, and then use the "EXECUTE" command to assign the result of the function call "GET_BUDGET(11)" to the variable ":g_yearly_budget".

Submit
67. Examine this function: CREATE OR REPLACE FUNCTION set_budget (v_studio_id IN NUMBER, v_new_budget IN NUMBER) IS BEGIN UPDATE studio SET yearly_budget = v_new_budget WHERE id = v_studio_id; IF SQL%FOUND THEN RETURN TRUE; ELSE RETURN FALSE; END IF; COMMIT; END; Which code must be added to successfully compile this function?

Explanation

In order to successfully compile this function, the code "RETURN BOOLEAN" must be added immediately before the IS keyword. This is because the function is expected to return a boolean value, either TRUE or FALSE, based on the result of the UPDATE statement. Adding "RETURN BOOLEAN" before the IS keyword specifies the return type of the function.

Submit
68. The CHECK_THEATER trigger of the THEATER table has been disabled. Which command can you issue to enable this trigger?

Explanation

The correct command to enable a trigger in this scenario is "ALTER TRIGGER check_theater ENABLE;". This command specifically enables the "check_theater" trigger on the table. The other options are not valid commands for enabling a trigger.

Submit
69. You have just created a PL/SQL user-defined function called CALC_COMM. Which statement will successfully test it?

Explanation

The correct answer is "SELECT * FROM ord GROUP BY ordid HAVING calc_comm(total) > 5000;". This statement will successfully test the PL/SQL user-defined function CALC_COMM. It selects all rows from the ORD table, groups them by the ORDID column, and then applies the CALC_COMM function to the TOTAL column. It filters out the rows where the result of the CALC_COMM function is greater than 5000. This statement ensures that the function is being used correctly and returns the desired results.

Submit
70. Examine this statement: SELECT id, theater_pck.get_budget(id) FROM studio; What must be true about the GET_BUDGET function for this statement to be successful?

Explanation

The statement is selecting the ID and the budget of a theater from the studio table. In order for this statement to be successful, the GET_BUDGET function must not modify the database. This means that the function should only retrieve data and not make any changes to the underlying database.

Submit
71. 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 mode should be used for V_COST_PER_TICKET?

Explanation

The mode "IN OUT" should be used for V_COST_PER_TICKET because the procedure is designed to both accept a value for v_cost_per_ticket as an input (IN) and also modify the value of v_cost_per_ticket and return it as an output (OUT). This allows the procedure to both read and update the value of v_cost_per_ticket within the procedure.

Submit
72. Examine this function: CREATE OR REPLACE FUNCTION get_budget (v_studio_id IN NUMBER, v_max_budget IN NUMBER) RETURN number IS v_yearly_budget NUMBER; BEGIN SELECT yearly_budget INTO v_yearly_budget FROM studio WHERE id = v_studio_id; IF v_yearly_budget > v_max_budget THEN RETURN v_max_budget; ELSE RETURN v_yearly_budget; END IF; END; Which set of statements will successfully invoke this function within SQL*Plus?

Explanation

The correct answer is the first option. This is because it correctly invokes the function "get_budget" within the SQL query by passing the "id" column from the "studio" table as the first argument and the value 200 as the second argument. It retrieves the "id" and "name" columns from the "studio" table and also includes the result of the "get_budget" function in the output.

Submit
73. Examine this procedure: CREATE OR REPLACE PROCEDURE remove_department (v_deptno IN NUMBER) IS BEGIN DELETE dept WHERE deptno = v_deptno; END; After executing this procedure, you receive this message: ORA-02292: integrity constraint (SCOTT.FK_DEPTNO) violated - child record found What must be added to the procedure to handle this error?

Explanation

The correct answer is to declare a new exception and associate it with error code -2292. By creating an exception section and adding code to handle this non-predefined exception, the procedure can handle the ORA-02292 error. This allows for proper handling of the integrity constraint violation, ensuring that any child records are dealt with appropriately.

Submit
74. Procedures and functions can be created and stored in the database or in an Oracle Developer application. How is performance improved when storing procedures and functions in the database?

Explanation

Storing procedures and functions in the database improves performance by reducing network roundtrips. When the code is stored in the database, it can be executed directly on the server without the need to transmit data back and forth between the client and the server. This reduces the latency and overhead associated with network communication, resulting in faster execution times.

Submit
75. 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?

Explanation

The correct answer is "BEFORE DELETE OR INSERT OR UPDATE ON gross_receipt". This is the correct syntax for creating a trigger that will be executed before any delete, insert, or update operation is performed on the gross_receipt table. The "BEFORE" keyword indicates that the trigger will be executed before the operation takes place, and the "DELETE OR INSERT OR UPDATE" keywords specify the types of operations that will trigger the execution of the trigger. The "ON gross_receipt" specifies the table on which the trigger will be applied.

Submit
View My Results

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
Cancel
  • All
    All (75)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
While creating a package, you placed the function name in the...
The GET_BUDGET function is no longer needed and should be removed....
Examine this package specification: ...
When creating a function in SQL*Plus, you receive an error message...
The AUDIT_THEATER trigger on the THEATER table is no longer needed and...
For which purpose are formal parameters used when creating functions?
Evaluate this statement: ...
Examine this package specification and body: ...
For which trigger timing can you reference the NEW and OLD qualifiers?
Examine this procedure: ...
The CALC_COMM procedure is no longer needed and should be removed....
Which command must you issue in SQL*Plus to display the result of the...
Examine this code: ...
Due to a disk failure, the AUDIT_THEATER table is unavailable until...
You created a database trigger that will be executed for all data...
Examine this function: ...
Examine this database trigger: ...
Examine this procedure: ...
Procedures and functions are very similar. For which reason would you...
The auditing utility in Oracle records the type of data manipulation...
When a database trigger routine does not have to take place before the...
When declaring arguments within a procedure, which specification is...
CREATE OR REPLACE PACKAGE theater_pck ...
You decide to use packages to logically group related programming...
Examine this procedure: ...
Each month a SQL*Loader application is executed to insert...
Examine this procedure: ...
Which statement about packages is true?
A stored function can be invoked in many different ways. Which...
CREATE OR REPLACE PACKAGE theater_pck ...
Examine this package specification and body: ...
Procedures and functions are explicitly executed. This is different...
Examine this trigger: ...
CREATE OR REPLACE TRIGGER update_studio ...
Examine this function: ...
Which statement about declaring parameters is true?
CREATE OR REPLACE PACKAGE theater_pck ...
Examine this database trigger: ...
Examine this function: ...
Examine this code: ...
Examine this procedure: ...
Examine this package specification and body: ...
Which subprogram type can be invoked from within a SQL statement?
Which statement about error propagation is true?
Modifications to the THEATER table are not allowed during the last...
Which statement about packages is true?
Examine this package specification and body: ...
Examine this procedure: ...
You have just successfully dropped the CALC_COMM procedure and deleted...
CREATE OR REPLACE PACKAGE BODY theater_pck ...
Examine this package specification and body: ...
Examine this trigger: ...
You created a database trigger that will be executed for all data...
Examine this function: ...
Evaluate this procedure: ...
Examine this procedure: ...
Which two subprogram headers are correct? (Choose two.)
When creating the ADD_PROD procedure in SQL*Plus, you receive this...
Which statement about formal parameters is true?
Which code successfully calculates commission returning it to the...
Which three statements about procedures are true? (Choose three.)
How do functions simplify maintainability?
Which two statements are true? (Choose two.)
A stored function can be invoked in many different ways. Which...
Examine this function: ...
Examine this function: ...
Examine this function: ...
The CHECK_THEATER trigger of the THEATER table has been disabled....
You have just created a PL/SQL user-defined function called CALC_COMM....
Examine this statement: ...
Examine this procedure: ...
Examine this function: ...
Examine this procedure: ...
Procedures and functions can be created and stored in the database or...
You created a database trigger that will be executed for all data...
Alert!

Advertisement