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

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

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

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

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

  5. 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, we need to understand the concept of overloading in packages.

Option A) Only local or packaged subprograms can be overloaded. This option is true. Overloading in packages allows us to define multiple subprograms with the same name, but they must be either local or packaged subprograms.

Option B) Overloading allows different functions with the same name that differ only in their return types. This option is false. Overloading in packages does not allow different functions with the same name that differ only in their return types. Overloading is based on the parameters, not the return types.

Option C) Overloading allows different subprograms with the same number, type, and order of the parameter. This option is false. Overloading does not consider the order of the parameters. It only considers the number and types of the parameters.

Option D) Overloading allows different subprograms with the same name and the same number or type of the parameters. This option is false. Overloading allows different subprograms with the same name, but they must have different number or type of parameters.

Option E) Overloading allows different subprograms with the same name but different in either number or type or order of the parameter. This option is true. Overloading in packages allows us to define multiple subprograms with the same name, but they must have different number or type or order of parameters.

Therefore, the correct statements about the overloading feature of packages are A) Only local or packaged subprograms can be overloaded, and E) Overloading allows different subprograms with the same name but different in either number or type or order of the parameter.

Find more quizzes: