Oracle
1Z0-147 · Question #21
Examine this code: CREATE OR REPLACE PACKAGE metric_converter IS c_height CONSTANT NUMBER := 2.54; c_weight CONSTANT NUMBER := .454; FUNCTION calc_height (p_height_in_inches NUMBER) RETURN NUMBER…
The correct answer is C. If you remove the package specification, then the package body is removed. See the full explanation below for the reasoning.
Question
Examine this code:
CREATE OR REPLACE PACKAGE metric_converter
IS
c_height CONSTANT NUMBER := 2.54;
c_weight CONSTANT NUMBER := .454;
FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER;
FUNCTION calc_weight (p_weight_in_pounds NUMBER)
RETURN NUMBER;
END;
/
CREATE OR REPLACE PACKAGE BODY metric_converter
IS
FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_height_in_inches * c_height;
END calc_height;
FUNCTION calc_weight (p_weight_in_pounds NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_weight_in_pounds * c_weight;
END calc_weight;
END metric_converter;
/
CREATE OR REPLACE FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_height_in_inches * metric_converter.c_height;
END calc_height;
/
Which statement is true?
Options
- AIf you remove the package specification, then the package body and the stand alone stored function CALC_HEIGHT are removed.
- BIf you remove the package body, then the package specification and the stand alone stored function CALC_HEIGHT are removed.
- CIf you remove the package specification, then the package body is removed.
- DIf you remove the package body, then the package specification is removed.
- EIf you remove the package stored function CALC_HEIGHT , then the METRIC_CONVERTER package body and the package specification are removed.
- FThe stand alone function CALC_HEIGHT cannot be created because its name is used in a packaged function.
How the community answered
(55 responses)- A7% (4)
- B4% (2)
- C85% (47)
- D2% (1)
- F2% (1)
Community Discussion
No community discussion yet for this question.