What will be the output of the following pseudocode when n = 3 ? Integer…

Infosys · 2024

What will be the output of the following pseudocode when n = 3 ?

Integer calc(Integer n)

if(n <= 0)
    return 0;

if(n < 1)
    return 1;

Print n

calc(n-1);

Print n

End function calc

  1. A.

    1 2 3

  2. B.

    3 2 1 0

  3. C.

    3 2 1 1 2 3

  4. D.

    Compiler error

Attempted by 166 students.

Sign up free to check your answer

Sign up free

Explore the full course: Accenture Preparation

Loading lesson…