Total Pageviews

June 24, 2015

6/24/2015 11:46:00 AM
Oracle Certification Questions

QUESTION 1 Examine this package:CREATE OR REPLACE PACKAGE discounts
IS
   g_id            NUMBER := 7829;
   discount_rate   NUMBER := 0.00;

   PROCEDURE display_price (p_price NUMBER);
END discounts;
/

CREATE OR REPLACE PACKAGE BODY discounts
IS
   PROCEDURE display_price (p_price NUMBER)
   IS
   BEGIN
      DBMS_OUTPUT.PUT_LINE (
         'Discounted ' || TO_CHAR (p_price * NVL (discount_rate, 1))
      );
   END display_price;
BEGIN
   discount_rate := 0.10;
END discounts;
Which statement is true? 
A. The value of DISCOUNT_RATE always remains 0.00 in a session.
 B. The value of DISCOUNT_RATE is set to 0.10 each time the package is invoked in a session.
C. The value of DISCOUNT_RATE is set to 1.00 each time the procedure DISPLAY_PRICE is invoked.
D. The value of DISCOUNT_RATE is set to 0.10 when the package is invoked for the first time in a session. 
Answer: D A one-time-only procedure is executed only once, when the package is first invoked within the user session 
QUESTION 2 
Examine this code:
CREATE OR REPLACE TRIGGER update_emp AFTER UPDATE ON emp BEGIN INSERT INTO
      audit_table (who, dated)
      VALUES (USER, SYSDATE);
      END;
You issue an UPDATE command in the EMP table that results in changing 10 rows. How many rows are inserted into the AUDIT_TABLE? 
A. 1
B. 10
C. None
D. A value equal to the number of rows in the EMP table. 

Answer: A    

Oracle PL/SQL Questions and Answers

QUESTION 3 Examine this package:
 
CREATE OR REPLACE PACKAGE bb_pack IS v_max_team_salary NUMBER(12,2);
    PROCEDURE       add_player(v_id IN NUMBER, v_last_name VARCHAR2, v_salary
      NUMBER;
      END bb_pack;
/
      CREATE OR REPLACE PACKAGE BODY bb_pack IS PROCEDURE upd_player_stat (
      v_id IN NUMBER, v_ab IN NUMBER DEFAULT 4, v_hits IN NUMBER) IS
      BEGIN
      UPDATE PLAYER_BAT_STAT
      SET at_bats = at_bats + v_ab, hits = hits + v_hits
      WHERE player_id = v_id);
      COMMIT;
      END upd_player_stat;

      PROCEDURE add_player (v_id IN NUMBER,
       v_last_name  VARCHAR2,
       v_salary NUMBER) IS
      BEGIN
      INSERT
      INTO player(id,last_name,salary)
      VALUES (v_id, v_last_name, v_salary); upd_player_stat(v_id,0.0);
      END add_player;
      END bb_pack;
Which statement will successfully assign $75,000,000 to the V_MAX_TEAM_SALARY variable from within a stand-alone procedure? 
A. V_MAX_TEAM_SALARY := 7500000;
B. BB_PACK.ADD_PLAYER.V_MAX_TEAM_SALARY := 75000000;
C. BB_PACK.V_MAX_TEAM_SALARY := 75000000;
D. This variable cannot be assigned a value from outside the package. 
Answer: C To assign a value for a public variable which is declared in the package header, all what you have to do is do user the following syntax package_name.var_name:=value; 

QUESTION 4
 There is a CUSTOMER table in a schema that has a public synonym CUSTOMER and you are granted all object privileges on it. You have a procedure PROCESS_CUSTOMER that processes customer information that is in the public synonym CUSTOMER table. You have just created a new table called CUSTOMER within your schema. Which statement is true? 
A. Creating the table has no effect and procedure PROCESS_CUSTOMER still accesses data from public synonym CUSTOMER table.
B. If the structure of your CUSTOMER table is the same as the public synonym CUSTOMER table then the procedure PROCESS_CUSTOMER is invalidated and gives compilation errors.
C. If the structure of your CUSTOMER table is entirely different from the public synonym CUSTOMER table then the procedure PROCESS_CUSTOMER successfully recompiles and accesses your CUSTOMER table.
D. If the structure of your CUSTOMER table is the same as the public synonym CUSTOMER table then the procedure PROCESS_CUSTOMER successfully recompiles when invoked and accesses your CUSTOMER table. 
Answer: D The procedure will first look in the owner of the procedure schema before looking for the public synonym.
Incorrect Answers: A, B, C 
QUESTION 5
Which two statements about packages are true? (Choose two) 
A. Both the specification and body are required components of a package.
B. The package specification is optional, but the package body is required.
C. The package specification is required, but the package body is optional.
D. The specification and body of the package are stored together in the database.
E. The specification and body of the package are stored separately in the database. 
Answer: C,E 
 
Related Posts Plugin for WordPress, Blogger...