Multiple choice technology programming languages

Assume a PL/I program that wants to execute a call to an external procedure. This procedure expects 1 parameter and returns 1 parameter. Which instructions do you have to provide in the main program ? (1) DCL MYSUB ENTRY (CHAR(5)) EXTERNAL; (2) DCL MYSUB ENTRY (CHAR(5)) RETURNS (CHAR(5)) EXTERNAL; (3) DCL MYPARAMETER,MYRESULT CHAR(5); (4) CALL MYSUB (MYPARAMETER); (5) MYRESULT = MYSUB; (6) MYRESULT = MYSUB(MYPARAMETER);

  1. 1, 3 and 4

  2. 2, 3 and 4

  3. 2, 3 and 6

  4. 1, 3 and 5

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

To call an external procedure that returns a value, you must: (2) Declare it with RETURNS clause specifying the return type, (3) Declare both the parameter and result variables, and (6) Call it as a function assignment with the parameter. Option A is incomplete (no RETURNS, wrong call syntax), Option B uses wrong call syntax (CALL with function), Option D omits RETURNS.