Which two statements about the overloading feature of packages are true? (Choose two)

  1. a) Only local or packaged sub programs can be overloaded.

  2. b) Overloading allows different functions with the same name that differ only in their return types.

  3. c) Overloading allows different subprograms with the same number, type and order of the parameter.

  4. d) Overloading allows different subprograms with the same name and same number or type of the parameters.

  5. e) Overloading allows different subprograms with the same name but different in either number or type or order of parameter.


Correct Option: A,E

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Only local or packaged subprograms can be overloaded. - This option is correct. Overloading can only be applied to subprograms that are defined either locally or within a package.

Option B) Overloading allows different functions with the same name that differ only in their return types. - This option is incorrect. Overloading allows different subprograms (procedures or functions) with the same name, but they must differ in either the number or type or order of parameters, not just the return types.

Option C) Overloading allows different subprograms with the same number, type, and order of the parameter. - This option is incorrect. Overloading requires the subprograms to have differences in either the number or type or order of parameters, not just the same.

Option D) Overloading allows different subprograms with the same name and the same number or type of the parameters. - This option is incorrect. Overloading requires differences in either the number or type or order of parameters, so subprograms with the same number and type of parameters cannot be overloaded.

Option E) Overloading allows different subprograms with the same name but different in either number or type or order of parameters. - This option is correct. Overloading allows subprograms with the same name but with differences in either the number or type or order of parameters.

The correct answer is A and E. These options are correct because overloading can only be applied to local or packaged subprograms, and it allows different subprograms with the same name but different in either the number or type or order of parameters.

Find more quizzes: